[U-Boot] [PATCH][for 1.3.5] Fix handling of mem reserves for ramdisk

Kumar Gala galak at kernel.crashing.org
Mon Sep 8 16:02:21 CEST 2008


> Hmm... OK, now the code will do the same as before, but is this  
> optimal?
>
> Why must we do a
>
> a) dummy mem reservation
> b) search for it
> c) delete it
> d) make the right mem reservation?
>
> Think the steps a) - c) are useless ...
>
> Please have a look at the following patch, it deletes the steps a) -  
> c)
> and fixes the fdt chosen command ...
>
> [PATCH] powerpc: Fix bootm to boot up again with a Ramdisk.
>
> Patch
> http://git.denx.de/?p=u-boot.git;a=commitdiff;h=2a1a2cb6e2b87ee550e6f27b647d23331dfd5e1b#patch3
>
> didnt remove the dummy mem reservation which was set up
> in fdt_chosen, and this stopped Linux from booting with a
> Ramdisk. This patch fixes this, by deleting the useless
> dummy mem reservation.
>
> Signed-off-by: Heiko Schocher <hs at denx.de>
> ---
> common/cmd_fdt.c      |    3 ++-
> common/fdt_support.c  |    4 +---
> include/fdt_support.h |    2 +-
> lib_ppc/bootm.c       |    5 +++--
> 4 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
> index 0593bad..288a5c4 100644
> --- a/common/cmd_fdt.c
> +++ b/common/cmd_fdt.c
> @@ -450,7 +450,8 @@ int do_fdt (cmd_tbl_t * cmdtp, int flag, int  
> argc, char *argv[])
> 			initrd_end = simple_strtoul(argv[3], NULL, 16);
> 		}
>
> -		fdt_chosen(working_fdt, initrd_start, initrd_end, 1);
> +		fdt_chosen(working_fdt, 1);
> +		fdt_initrd(working_fdt, initrd_start, initrd_end, 1);

You are removing functionality, if you want to do this add a command  
'fdt initrd' that sets the initrd props and the mem reserve information.

>
> 	}
> 	/* resize the fdt */
> 	else if (strncmp(argv[1], "re", 2) == 0) {
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index a7773ab..8ceeb0f 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -165,7 +165,7 @@ int fdt_initrd(void *fdt, ulong initrd_start,  
> ulong initrd_end, int force)
> 	return 0;
> }
>
> -int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int  
> force)
> +int fdt_chosen(void *fdt, int force)
> {
> 	int   nodeoffset;
> 	int   err;
> @@ -215,8 +215,6 @@ int fdt_chosen(void *fdt, ulong initrd_start,  
> ulong initrd_end, int force)
> 		}
> 	}
>
> -	fdt_initrd(fdt, initrd_start, initrd_end, force);
> -
> #ifdef CONFIG_OF_STDOUT_VIA_ALIAS
> 	path = fdt_getprop(fdt, nodeoffset, "linux,stdout-path", NULL);
> 	if ((path == NULL) || force)
> diff --git a/include/fdt_support.h b/include/fdt_support.h
> index 424c3c6..ceaadc2 100644
> --- a/include/fdt_support.h
> +++ b/include/fdt_support.h
> @@ -28,7 +28,7 @@
>
> #include <fdt.h>
>
> -int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int  
> force);
> +int fdt_chosen(void *fdt, int force);
> int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int  
> force);
> void do_fixup_by_path(void *fdt, const char *path, const char *prop,
> 		      const void *val, int len, int create);
> diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
> index 348421f..d581493 100644
> --- a/lib_ppc/bootm.c
> +++ b/lib_ppc/bootm.c
> @@ -145,8 +145,9 @@ int do_bootm_linux(int flag, int argc, char  
> *argv[], bootm_headers_t *images)
> 	 * if the user wants it (the logic is in the subroutines).
> 	 */
> 	if (of_size) {
> -		/* pass in dummy initrd info, we'll fix up later */
> -		if (fdt_chosen(of_flat_tree, images->rd_start, images->rd_end, 0)  
> < 0) {
> +		/* we dont have to pass anymore the dummy initrd info!
> +                   we'll add this later, immediately with the right  
> values. */
> +		if (fdt_chosen(of_flat_tree, 0) < 0) {
> 			puts ("ERROR: ");
> 			puts ("/chosen node create failed");
> 			puts (" - must RESET the board to recover.\n");


The reason we had the code before was to try and make sure the size of  
the fdt was as close to its final size as possible before we dealt  
with the ramdisk relocation (boot_ramdisk_high()) that included the  
properties and the memreserve in the fdt.  Step's a)-c) are there to  
make sure the size is correct.

- k



More information about the U-Boot mailing list