[PATCH 2/15] Automatically lmb_reserve() initrd

Uytterhoeven, Geert Geert.Uytterhoeven at eu.sony.com
Wed Apr 18 21:43:04 EST 2007


On March 5, 2007, David Gibson wrote:
> At present, when an initrd is passed to the kernel used flat device
> tree properties, the memory the initrd occupies must also be reserved
> in the flat tree's reserve map, or the kernel may overwrite it.  That
> makes life more complicated than it could be for the bootwrapper.
> 
> This patch makes the kernel automatically reserve the initrd's space.
> That in turn requires parsing the initrd parameters earlier than they
> are currently, in early_init_dt_scan_chosen() instead of
> check_for_initrd().
> 
> Signed-off-by: David Gibson <dwg at au1.ibm.com>
> ---
> 
>  arch/powerpc/kernel/prom.c         |   23 +++++++++++++++++++++++
>  arch/powerpc/kernel/setup-common.c |   22 ++--------------------
>  2 files changed, 25 insertions(+), 20 deletions(-)
> 
> Index: working-2.6/arch/powerpc/kernel/prom.c
> ===================================================================
> --- working-2.6.orig/arch/powerpc/kernel/prom.c	
> 2007-02-09 15:12:00.000000000 +1100
> +++ working-2.6/arch/powerpc/kernel/prom.c	2007-02-09 
> 15:14:27.000000000 +1100
> @@ -719,6 +719,7 @@ static int __init early_init_dt_scan_cho
>  					    const char *uname, 
> int depth, void *data)
>  {
>  	unsigned long *lprop;
> +	u32 *prop;

This causes a compiler warning if CONFIG_BLK_DEV_INITRD is not set.

>  	unsigned long l;
>  	char *p;
>  
> @@ -760,6 +761,22 @@ static int __init early_init_dt_scan_cho
>                 crashk_res.end = crashk_res.start + *lprop - 1;
>  #endif
>  
> +#ifdef CONFIG_BLK_DEV_INITRD
> +	DBG("Looking for initrd properties... ");
> +	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &l);
> +	if (prop) {
> +		initrd_start = (unsigned long)__va(of_read_ulong(prop, l/4));
> +		prop = of_get_flat_dt_prop(node, "linux,initrd-end", &l);
> +		if (prop) {
> +			initrd_end = (unsigned long)__va(of_read_ulong(prop, l/4));
> +			initrd_below_start_ok = 1;
> +		} else {
> +			initrd_start = 0;
> +		}
> +	}
> +	DBG("initrd_start=0x%lx  initrd_end=0x%lx\n", initrd_start, initrd_end);
> +#endif /* CONFIG_BLK_DEV_INITRD */
> +
>  	/* Retreive command line */
>   	p = of_get_flat_dt_prop(node, "bootargs", &l);
>  	if (p != NULL && l > 0)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- Sony Network and Software Technology Center Europe (NSCE)
Geert.Uytterhoeven at eu.sony.com ------- The Corporate Village, Da Vincilaan 7-D1
Voice +32-2-7008453 Fax +32-2-7008622 ---------------- B-1935 Zaventem, Belgium



More information about the Linuxppc-dev mailing list