bootm.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * U-boot - bootm.c - misc boot helper functions
  3. *
  4. * Copyright (c) 2005-2008 Analog Devices Inc.
  5. *
  6. * (C) Copyright 2000-2004
  7. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  8. *
  9. * Licensed under the GPL-2 or later.
  10. */
  11. #include <common.h>
  12. #include <command.h>
  13. #include <image.h>
  14. #include <asm/blackfin.h>
  15. #ifdef SHARED_RESOURCES
  16. extern void swap_to(int device_id);
  17. #endif
  18. static char *make_command_line(void)
  19. {
  20. char *dest = (char *)CMD_LINE_ADDR;
  21. char *bootargs = getenv("bootargs");
  22. if (bootargs == NULL)
  23. return NULL;
  24. strncpy(dest, bootargs, 0x1000);
  25. dest[0xfff] = 0;
  26. return dest;
  27. }
  28. int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
  29. {
  30. int (*appl) (char *cmdline);
  31. char *cmdline;
  32. if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
  33. return 1;
  34. #ifdef SHARED_RESOURCES
  35. swap_to(FLASH);
  36. #endif
  37. appl = (int (*)(char *))images->ep;
  38. printf("Starting Kernel at = %x\n", appl);
  39. cmdline = make_command_line();
  40. icache_disable();
  41. dcache_disable();
  42. (*appl) (cmdline);
  43. /* does not return */
  44. return 1;
  45. }