diff options
Diffstat (limited to 'common/cmd_bootm.c')
-rw-r--r-- | common/cmd_bootm.c | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 6a5576c..8599a49 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -34,6 +34,10 @@ #include <environment.h> #include <asm/byteorder.h> +#ifdef CONFIG_OF_FLAT_TREE +#include <ft_build.h> +#endif + /*cmd_boot.c*/ extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); @@ -197,7 +201,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) checksum = ntohl(hdr->ih_hcrc); hdr->ih_hcrc = 0; - if (crc32 (0, (char *)data, len) != checksum) { + if (crc32 (0, (uchar *)data, len) != checksum) { puts ("Bad Header Checksum\n"); SHOW_BOOT_PROGRESS (-2); return 1; @@ -221,7 +225,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if (verify) { puts (" Verifying Checksum ... "); - if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) { + if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) { printf ("Bad Data CRC\n"); SHOW_BOOT_PROGRESS (-3); return 1; @@ -489,6 +493,11 @@ fixup_silent_linux () } #endif /* CONFIG_SILENT_CONSOLE */ +#ifdef CONFIG_OF_FLAT_TREE +extern const unsigned char oftree_dtb[]; +extern const unsigned int oftree_dtb_len; +#endif + #ifdef CONFIG_PPC static void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, @@ -511,6 +520,9 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, bd_t *kbd; void (*kernel)(bd_t *, ulong, ulong, ulong, ulong); image_header_t *hdr = &header; +#ifdef CONFIG_OF_FLAT_TREE + char *of_flat_tree; +#endif if ((s = getenv ("initrd_high")) != NULL) { /* a value of "no" or a similar string will act like 0, @@ -621,7 +633,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, checksum = hdr->ih_hcrc; hdr->ih_hcrc = 0; - if (crc32 (0, (char *)data, len) != checksum) { + if (crc32 (0, (uchar *)data, len) != checksum) { puts ("Bad Header Checksum\n"); SHOW_BOOT_PROGRESS (-11); do_reset (cmdtp, flag, argc, argv); @@ -649,13 +661,13 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, if (chunk > CHUNKSZ) chunk = CHUNKSZ; - csum = crc32 (csum, (char *)cdata, chunk); + csum = crc32 (csum, (uchar *)cdata, chunk); cdata += chunk; WATCHDOG_RESET(); } #else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */ - csum = crc32 (0, (char *)data, len); + csum = crc32 (0, (uchar *)data, len); #endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */ if (csum != hdr->ih_dcrc) { @@ -776,15 +788,26 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, initrd_end = 0; } +#ifdef CONFIG_OF_FLAT_TREE + if (initrd_start == 0) + of_flat_tree = (char *)(((ulong)kbd - OF_FLAT_TREE_MAX_SIZE - + sizeof(bd_t)) & ~0xF); + else + of_flat_tree = (char *)((initrd_start - OF_FLAT_TREE_MAX_SIZE - + sizeof(bd_t)) & ~0xF); +#endif debug ("## Transferring control to Linux (at address %08lx) ...\n", (ulong)kernel); SHOW_BOOT_PROGRESS (15); +#ifndef CONFIG_OF_FLAT_TREE + #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) unlock_ram_in_cache(); #endif + /* * Linux Kernel Parameters: * r3: ptr to board info data @@ -794,6 +817,25 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, * r7: End of command line string */ (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); + +#else + ft_setup(of_flat_tree, OF_FLAT_TREE_MAX_SIZE, kbd); + /* ft_dump_blob(of_flat_tree); */ + +#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) + unlock_ram_in_cache(); +#endif + /* + * Linux Kernel Parameters: + * r3: ptr to OF flat tree, followed by the board info data + * r4: initrd_start or 0 if no initrd + * r5: initrd_end - unused if r4 is 0 + * r6: Start of command line string + * r7: End of command line string + */ + (*kernel) ((bd_t *)of_flat_tree, initrd_start, initrd_end, cmd_start, cmd_end); + +#endif } #endif /* CONFIG_PPC */ @@ -1037,7 +1079,7 @@ static int image_info (ulong addr) checksum = ntohl(hdr->ih_hcrc); hdr->ih_hcrc = 0; - if (crc32 (0, (char *)data, len) != checksum) { + if (crc32 (0, (uchar *)data, len) != checksum) { puts (" Bad Header Checksum\n"); return 1; } @@ -1049,7 +1091,7 @@ static int image_info (ulong addr) len = ntohl(hdr->ih_size); puts (" Verifying Checksum ... "); - if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) { + if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) { puts (" Bad Data CRC\n"); return 1; } @@ -1094,7 +1136,7 @@ int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) checksum = ntohl(header.ih_hcrc); header.ih_hcrc = 0; - if (crc32 (0, (char *)&header, sizeof(image_header_t)) + if (crc32 (0, (uchar *)&header, sizeof(image_header_t)) != checksum) goto next_sector; @@ -1105,7 +1147,7 @@ int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) len = ntohl(hdr->ih_size); puts (" Verifying Checksum ... "); - if (crc32 (0, (char *)data, len) != ntohl(hdr->ih_dcrc)) { + if (crc32 (0, (uchar *)data, len) != ntohl(hdr->ih_dcrc)) { puts (" Bad Data CRC\n"); } puts ("OK\n"); |