[RFC 2/2] linux.c32: Add initrd= parameter

Thierry Reding thierry.reding at avionic-design.de
Fri Jun 1 01:41:36 EST 2012


This new parameter can be used to specify a Flattened Device Tree (FDT)
blob to pass to the Linux kernel.

Signed-off-by: Thierry Reding <thierry.reding at avionic-design.de>
---
 com32/modules/linux.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/com32/modules/linux.c b/com32/modules/linux.c
index b902ebc..cc1e6fe 100644
--- a/com32/modules/linux.c
+++ b/com32/modules/linux.c
@@ -112,6 +112,7 @@ int main(int argc, char *argv[])
 {
     const char *kernel_name;
     struct initramfs *initramfs;
+    struct fdt *fdt;
     char *cmdline;
     char *boot_image;
     void *kernel_data;
@@ -207,8 +208,25 @@ int main(int argc, char *argv[])
 	    goto bail;
     }
 
+    fdt = fdt_init();
+    if (!fdt)
+	goto bail;
+
+    if ((arg = find_argument(argp, "fdt="))) {
+	if (!opt_quiet)
+	    printf("Loading %s... ", arg);
+
+	if (fdt_load(fdt, arg)) {
+	    printf("failed!\n");
+	    goto bail;
+	}
+
+	if (!opt_quiet)
+	    printf("ok\n");
+    }
+
     /* This should not return... */
-    syslinux_boot_linux(kernel_data, kernel_len, initramfs, cmdline);
+    syslinux_boot_linux(kernel_data, kernel_len, initramfs, fdt, cmdline);
 
 bail:
     fprintf(stderr, "Kernel load failure (insufficient memory?)\n");
-- 
1.7.10.2



More information about the devicetree-discuss mailing list