[U-Boot-Users] [PATCH 2/9] [new uImage] ppc: Determine if we are booting an OF style

Kumar Gala galak at kernel.crashing.org
Wed Feb 20 05:03:44 CET 2008


If we are bootin OF style than we can skip setting up some things
that are used for the old boot method.

Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
---
 lib_ppc/bootm.c |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 1f1be69..5158ccc 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -71,8 +71,21 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	bd_t	*kbd;
 	void	(*kernel)(bd_t *, ulong, ulong, ulong, ulong);
 
+	int	has_of = 0;
+
 #if defined(CONFIG_OF_LIBFDT)
 	char	*of_flat_tree;
+
+	/* determine if we are booting w/of */
+	if (argc > 3)
+		has_of = 1;
+	if (image_check_type (hdr, IH_TYPE_MULTI)) {
+		ulong fdt_data, fdt_len;
+		image_multi_getimg (hdr, 2, &fdt_data, &fdt_len);
+
+		if (fdt_len)
+			has_of = 1;
+	}
 #endif
 
 	/*
@@ -90,12 +103,14 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag,
 	alloc_current = sp_limit = get_boot_sp_limit(sp);
 	debug ("=> set upper limit to 0x%08lx\n", sp_limit);
 
-	/* allocate space and init command line */
-	alloc_current = get_boot_cmdline (alloc_current, &cmd_start, &cmd_end);
+	if (!has_of) {
+		/* allocate space and init command line */
+		alloc_current = get_boot_cmdline (alloc_current, &cmd_start, &cmd_end);
 
-	/* allocate space for kernel copy of board info */
-	alloc_current = get_boot_kbd (alloc_current, &kbd);
-	set_clocks_in_mhz(kbd);
+		/* allocate space for kernel copy of board info */
+		alloc_current = get_boot_kbd (alloc_current, &kbd);
+		set_clocks_in_mhz(kbd);
+	}
 
 	/* find kernel */
 	kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))image_get_ep (hdr);
-- 
1.5.3.8





More information about the U-Boot mailing list