Fw: [PATCH 2/15] Automatically lmb_reserve() initrd

Stephen Winiecki stevewin at us.ibm.com
Tue Mar 13 07:21:43 EST 2007


+#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 */
+

Also from Patch 7:
Index: working-2.6/arch/powerpc/boot/main.c
===================================================================
--- working-2.6.orig/arch/powerpc/boot/main.c            2007-02-19 
14:01:15.000000000 +1100
+++ working-2.6/arch/powerpc/boot/main.c                 2007-02-19 
14:01:38.000000000 +1100

+                /* Tell the kernel initrd address via device tree */
+                devp = finddevice("/chosen");
+                if (! devp) {
+                                printf("Device tree has no chosen 
node!\n\r");
+                                exit();
+                }
+
+                initrd_start = (u32)initrd_addr;
+                initrd_end = (u32)initrd_addr + initrd_size;
+
+                setprop(devp, "linux,initrd-start", &initrd_start,
+                                sizeof(initrd_start));
+                setprop(devp, "linux,initrd-end", &initrd_end, 
sizeof(initrd_end));
 
-                flush_cache((void *)vmlinux.addr, vmlinux.size);
+                return (struct addr_range){(void *)initrd_addr, 
initrd_size};

It might be helpful if some kind of message was surfaced if the 
initrd-start/end properties didn't exist in the dt, esp. since it may not 
be well known initially as a dts definition requirement/option (voice of 
experience :)).  In general I think surfacing messages for any properties 
which are detected as not existing and which might be normally expected 
would be a good thing as people get familiar with defining dts files and 
specifying properties for their platforms. 




More information about the Linuxppc-dev mailing list