bootm.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * U-boot - bf533_linux.c
  3. *
  4. * Copyright (c) 2005-2007 Analog Devices Inc.
  5. *
  6. * (C) Copyright 2000-2004
  7. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
  25. * MA 02110-1301 USA
  26. */
  27. /* Dummy functions, currently not in Use */
  28. #include <common.h>
  29. #include <command.h>
  30. #include <image.h>
  31. #include <zlib.h>
  32. #include <asm/byteorder.h>
  33. #define LINUX_MAX_ENVS 256
  34. #define LINUX_MAX_ARGS 256
  35. #define CMD_LINE_ADDR 0xFF900000 /* L1 scratchpad */
  36. #ifdef SHARED_RESOURCES
  37. extern void swap_to(int device_id);
  38. #endif
  39. extern void flush_instruction_cache(void);
  40. extern void flush_data_cache(void);
  41. static char *make_command_line(void);
  42. void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
  43. bootm_headers_t *images)
  44. {
  45. int (*appl) (char *cmdline);
  46. char *cmdline;
  47. ulong ep = 0;
  48. if (!images->autostart)
  49. return ;
  50. #ifdef SHARED_RESOURCES
  51. swap_to(FLASH);
  52. #endif
  53. /* find kernel entry point */
  54. if (images->legacy_hdr_valid) {
  55. ep = image_get_ep (images->legacy_hdr_os);
  56. #if defined(CONFIG_FIT)
  57. } else if (images->fit_uname_os) {
  58. int ret = fit_image_get_entry (images->fit_hdr_os,
  59. images->fit_noffset_os, &ep);
  60. if (ret) {
  61. puts ("Can't get entry point property!\n");
  62. goto error;
  63. }
  64. #endif
  65. } else {
  66. puts ("Could not find kernel entry point!\n");
  67. goto error;
  68. }
  69. appl = (int (*)(char *))ep;
  70. printf("Starting Kernel at = %x\n", appl);
  71. cmdline = make_command_line();
  72. if (icache_status()) {
  73. flush_instruction_cache();
  74. icache_disable();
  75. }
  76. if (dcache_status()) {
  77. flush_data_cache();
  78. dcache_disable();
  79. }
  80. (*appl) (cmdline);
  81. /* does not return */
  82. return;
  83. error:
  84. if (images->autostart)
  85. do_reset (cmdtp, flag, argc, argv);
  86. return;
  87. }
  88. char *make_command_line(void)
  89. {
  90. char *dest = (char *)CMD_LINE_ADDR;
  91. char *bootargs;
  92. if ((bootargs = getenv("bootargs")) == NULL)
  93. return NULL;
  94. strncpy(dest, bootargs, 0x1000);
  95. dest[0xfff] = 0;
  96. return dest;
  97. }