bootm.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #ifdef SHARED_RESOURCES
  49. swap_to(FLASH);
  50. #endif
  51. /* find kernel entry point */
  52. if (images->legacy_hdr_valid) {
  53. ep = image_get_ep (images->legacy_hdr_os);
  54. #if defined(CONFIG_FIT)
  55. } else if (images->fit_uname_os) {
  56. fit_unsupported_reset ("AVR32 linux bootm");
  57. do_reset (cmdtp, flag, argc, argv);
  58. #endif
  59. } else {
  60. puts ("Could not find kernel entry point!\n");
  61. do_reset (cmdtp, flag, argc, argv);
  62. }
  63. appl = (int (*)(char *))ep;
  64. printf("Starting Kernel at = %x\n", appl);
  65. cmdline = make_command_line();
  66. if (icache_status()) {
  67. flush_instruction_cache();
  68. icache_disable();
  69. }
  70. if (dcache_status()) {
  71. flush_data_cache();
  72. dcache_disable();
  73. }
  74. (*appl) (cmdline);
  75. }
  76. char *make_command_line(void)
  77. {
  78. char *dest = (char *)CMD_LINE_ADDR;
  79. char *bootargs;
  80. if ((bootargs = getenv("bootargs")) == NULL)
  81. return NULL;
  82. strncpy(dest, bootargs, 0x1000);
  83. dest[0xfff] = 0;
  84. return dest;
  85. }