bootm.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * (C) Copyright 2003
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * (c) Copyright 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
  6. * (c) Copyright 2008 Renesas Solutions Corp.
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  24. *
  25. */
  26. #include <common.h>
  27. #include <command.h>
  28. #include <asm/byteorder.h>
  29. #ifdef CONFIG_SYS_DEBUG
  30. static void hexdump(unsigned char *buf, int len)
  31. {
  32. int i;
  33. for (i = 0; i < len; i++) {
  34. if ((i % 16) == 0)
  35. printf("%s%08x: ", i ? "\n" : "",
  36. (unsigned int)&buf[i]);
  37. printf("%02x ", buf[i]);
  38. }
  39. printf("\n");
  40. }
  41. #endif
  42. int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
  43. {
  44. /* Linux kernel load address */
  45. void (*kernel) (void) = (void (*)(void))images->ep;
  46. /* empty_zero_page */
  47. unsigned char *param
  48. = (unsigned char *)image_get_load(images->legacy_hdr_os);
  49. /* Linux kernel command line */
  50. char *cmdline = (char *)param + 0x100;
  51. /* PAGE_SIZE */
  52. unsigned long size = images->ep - (unsigned long)param;
  53. char *bootargs = getenv("bootargs");
  54. if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
  55. return 1;
  56. /* Setup parameters */
  57. memset(param, 0, size); /* Clear zero page */
  58. strcpy(cmdline, bootargs);
  59. kernel();
  60. /* does not return */
  61. return 1;
  62. }