From 6cfea33477b04b63ed47386ed1629529484c33ba Mon Sep 17 00:00:00 2001 From: Haiying Wang Date: Wed, 10 May 2006 09:38:06 -0500 Subject: Remove unneeded INIT_RAM_LOCK cache twiddling. Correctly tracks r29 as global data pointer now. Signed-off-by: Haiying Wang --- common/cmd_bootm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index fdf7180..e5d70fa 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -809,7 +809,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, #ifndef CONFIG_OF_FLAT_TREE -#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) +#if defined(CFG_INIT_RAM_LOCK) && (!defined(CONFIG_E500) || !defined(CONFIG_MPC86xx)) unlock_ram_in_cache(); #endif @@ -827,7 +827,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, ft_setup(of_flat_tree, OF_FLAT_TREE_MAX_SIZE, kbd, initrd_start, initrd_end); /* ft_dump_blob(of_flat_tree); */ -#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) +#if defined(CFG_INIT_RAM_LOCK) && (!defined(CONFIG_E500)||!defined(CONFIG_MPC86xx)) unlock_ram_in_cache(); #endif /* -- cgit v1.1 From e6cd2a1785d74ec3d30a86f1cb360be8de478151 Mon Sep 17 00:00:00 2001 From: Jason Jin Date: Fri, 7 Jul 2006 10:01:45 -0500 Subject: We made a u-boot patch to fix the hang up issue when booting filesystem from ramdisk. Signed-off-by:Jason Jin --- common/cmd_bootm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index e5d70fa..a78a16d 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -538,6 +538,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, initrd_copy_to_ram = 0; } else { /* not set, no restrictions to load high */ initrd_high = ~0; + initrd_copy_to_ram = 0; } #ifdef CONFIG_LOGBUFFER -- cgit v1.1 From fcb28e763415e0e4e66b0f45842d1557ae198e5e Mon Sep 17 00:00:00 2001 From: Jin Zhengxiong Date: Thu, 13 Jul 2006 10:35:10 -0500 Subject: Fixed initrd issue by define big RAM Signed-off-by:Jason Jin --- common/cmd_bootm.c | 1 - 1 file changed, 1 deletion(-) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index a78a16d..e5d70fa 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -538,7 +538,6 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, initrd_copy_to_ram = 0; } else { /* not set, no restrictions to load high */ initrd_high = ~0; - initrd_copy_to_ram = 0; } #ifdef CONFIG_LOGBUFFER -- cgit v1.1 From 0267768eddc5ca7bc1865bc40c866829ac5efbfe Mon Sep 17 00:00:00 2001 From: Matthew McClintock Date: Wed, 28 Jun 2006 10:41:37 -0500 Subject: * Modify bootm command to support booting with flat device trees Patch by Matthew McClintock 26-June-2006 --- common/cmd_bootm.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index fdf7180..a472a1d 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -465,6 +465,13 @@ U_BOOT_CMD( "[addr [arg ...]]\n - boot application image stored in memory\n" "\tpassing arguments 'arg ...'; when booting a Linux kernel,\n" "\t'arg' can be the address of an initrd image\n" +#ifdef CONFIG_OF_FLAT_TREE + "\tWhen booting a Linux kernel which requires a flat device-tree\n" + "\ta third argument is required which is the address of the of the\n" + "\tdevice-tree blob. To boot that kernel without an initrd image,\n" + "\tuse a '-' for the second argument. If you do not pass a third\n" + "\ta bd_info struct will be passed instead\n" +#endif ); #ifdef CONFIG_SILENT_CONSOLE @@ -500,11 +507,6 @@ 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, @@ -616,7 +618,17 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, /* * Check if there is an initrd image */ + +#ifdef CONFIG_OF_FLAT_TREE + /* Look for a '-' which indicates to ignore the ramdisk argument */ + if (argc >= 3 && strcmp(argv[2], "-") == 0) { + debug ("Skipping initrd\n"); + data = 0; + } + else +#endif if (argc >= 3) { + debug ("Not skipping initrd\n"); SHOW_BOOT_PROGRESS (9); addr = simple_strtoul(argv[2], NULL, 16); @@ -724,6 +736,15 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, len = data = 0; } +#ifdef CONFIG_OF_FLAT_TREE + if (argc >= 3) + { + of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16); + printf ("Booting using flat device tree at 0x%x\n", + of_flat_tree); + } +#endif + if (!data) { debug ("No initrd\n"); } @@ -793,15 +814,6 @@ 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); -- cgit v1.1 From 5498d90312aad9f6bdbf047986027c35b03cd163 Mon Sep 17 00:00:00 2001 From: Matthew McClintock Date: Wed, 28 Jun 2006 10:42:24 -0500 Subject: * Patch to modify ft_build.c to update flat device trees in place Patch by Matthew McClintock 26-June-2006 --- common/cmd_bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index a472a1d..f1c0eb4 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -836,7 +836,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); #else - ft_setup(of_flat_tree, OF_FLAT_TREE_MAX_SIZE, kbd, initrd_start, initrd_end); + ft_setup(of_flat_tree, kbd, initrd_start, initrd_end); /* ft_dump_blob(of_flat_tree); */ #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) -- cgit v1.1 From 1c8f6d8fb028f156094d05f2d14298e6479364ac Mon Sep 17 00:00:00 2001 From: Haiying Wang Date: Tue, 15 Aug 2006 15:12:55 -0400 Subject: Unlock cache before kernel starts up for MPC86xx --- common/cmd_bootm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 0225cb7..f1c0eb4 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -821,7 +821,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, #ifndef CONFIG_OF_FLAT_TREE -#if defined(CFG_INIT_RAM_LOCK) && (!defined(CONFIG_E500) || !defined(CONFIG_MPC86xx)) +#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) unlock_ram_in_cache(); #endif @@ -839,7 +839,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, ft_setup(of_flat_tree, kbd, initrd_start, initrd_end); /* ft_dump_blob(of_flat_tree); */ -#if defined(CFG_INIT_RAM_LOCK) && (!defined(CONFIG_E500)||!defined(CONFIG_MPC86xx)) +#if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) unlock_ram_in_cache(); #endif /* -- cgit v1.1 From 87a449c8ac396420cb24260f717ea9e6faa82047 Mon Sep 17 00:00:00 2001 From: Matthew McClintock Date: Tue, 22 Aug 2006 09:23:55 -0500 Subject: Support for FDT in uImage format, error when using FDT from flash Signed-off-by: Matthew McClintock --- common/cmd_bootm.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 5 deletions(-) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index f1c0eb4..f980659 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -528,7 +528,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, void (*kernel)(bd_t *, ulong, ulong, ulong, ulong); image_header_t *hdr = &header; #ifdef CONFIG_OF_FLAT_TREE - char *of_flat_tree; + char *of_flat_tree = NULL; #endif if ((s = getenv ("initrd_high")) != NULL) { @@ -737,14 +737,73 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, } #ifdef CONFIG_OF_FLAT_TREE - if (argc >= 3) - { + if(argc >= 3) { of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16); - printf ("Booting using flat device tree at 0x%x\n", + hdr = (image_header_t *)of_flat_tree; + + if (*(ulong *)of_flat_tree == OF_DT_HEADER) { +#ifndef CFG_NO_FLASH + if (addr2info((ulong)of_flat_tree) != NULL) { + printf ("Cannot modify flat device tree stored in flash\n" \ + "Copy to memory before using the bootm command\n"); + return; + } +#endif + } else if (ntohl(hdr->ih_magic) == IH_MAGIC) { + printf("## Flat Device Tree Image at %08lX\n", hdr); + print_image_hdr(hdr); + + if ((ntohl(hdr->ih_load) < ((unsigned long)hdr + ntohl(hdr->ih_size) + sizeof(hdr))) && + ((ntohl(hdr->ih_load) + ntohl(hdr->ih_size)) > (unsigned long)hdr)) { + printf ("ERROR: Load address overwrites Flat Device Tree uImage\n"); + return; + } + + printf(" Verifying Checksum ... "); + memmove (&header, (char *)hdr, sizeof(image_header_t)); + checksum = ntohl(header.ih_hcrc); + header.ih_hcrc = 0; + + if(checksum != crc32(0, (uchar *)&header, sizeof(image_header_t))) { + printf("ERROR: Flat Device Tree header checksum is invalid\n"); + return; + } + + checksum = ntohl(hdr->ih_dcrc); + addr = (ulong)((uchar *)(hdr) + sizeof(image_header_t)); + len = ntohl(hdr->ih_size); + + if(checksum != crc32(0, (uchar *)addr, len)) { + printf("ERROR: Flat Device Tree checksum is invalid\n"); + return; + } + printf("OK\n"); + + if (ntohl(hdr->ih_type) != IH_TYPE_FLATDT) { + printf ("ERROR: uImage not Flat Device Tree type\n"); + return; + } + if (ntohl(hdr->ih_comp) != IH_COMP_NONE) { + printf("ERROR: uImage is not uncompressed\n"); + return; + } + if (*((ulong *)(of_flat_tree + sizeof(image_header_t))) != OF_DT_HEADER) { + printf ("ERROR: uImage data is not a flat device tree\n"); + return; + } + + memmove((void *)ntohl(hdr->ih_load), + (void *)(of_flat_tree + sizeof(image_header_t)), + ntohl(hdr->ih_size)); + of_flat_tree = (char *)ntohl(hdr->ih_load); + } else { + printf ("Did not find a flat flat device tree at address %08lX\n", of_flat_tree); + return; + } + printf (" Booting using flat device tree at 0x%x\n", of_flat_tree); } #endif - if (!data) { debug ("No initrd\n"); } @@ -1272,6 +1331,7 @@ print_type (image_header_t *hdr) case IH_TYPE_MULTI: type = "Multi-File Image"; break; case IH_TYPE_FIRMWARE: type = "Firmware"; break; case IH_TYPE_SCRIPT: type = "Script"; break; + case IH_TYPE_FLATDT: type = "Flat Device Tree"; break; default: type = "Unknown Image"; break; } -- cgit v1.1 From 5de62c47a8628b3da4d73f7c07027f32a3342d40 Mon Sep 17 00:00:00 2001 From: Matthew McClintock Date: Tue, 22 Aug 2006 09:31:59 -0500 Subject: Fix disable_of booting Signed-off-by: Matthew McClintock --- common/cmd_bootm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index f980659..652d843 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -737,7 +737,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, } #ifdef CONFIG_OF_FLAT_TREE - if(argc >= 3) { + if(argc > 3) { of_flat_tree = (char *) simple_strtoul(argv[3], NULL, 16); hdr = (image_header_t *)of_flat_tree; @@ -802,6 +802,9 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, } printf (" Booting using flat device tree at 0x%x\n", of_flat_tree); + } else if(getenv("disable_of") == NULL) { + printf ("ERROR: bootm needs flat device tree as third argument\n"); + return; } #endif if (!data) { -- cgit v1.1 From 1eaf3a5ff4960a46f3a9063568ba2af7883f07c5 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 10 Oct 2006 00:23:32 -0600 Subject: Fix possible uninitialized variable compiler warning. When CONFIG_OF_FLAG_TREE is set, the compiler complains that 'len' in do_bootm_linux() may be uninitialized. There is no possibility in the current code that len will get used uninitialized, but this fix follows the existing convention of setting both len and data to zero at the same time. Signed-off-by: Grant Likely --- common/cmd_bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/cmd_bootm.c') diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index e2cb6b9..c533c00 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -625,7 +625,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag, /* Look for a '-' which indicates to ignore the ramdisk argument */ if (argc >= 3 && strcmp(argv[2], "-") == 0) { debug ("Skipping initrd\n"); - data = 0; + len = data = 0; } else #endif -- cgit v1.1