[syslinux:master] linux.c32: add support for a device tree blob ( dtb)

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Fri Jun 29 15:27:02 PDT 2012


Commit-ID:  6366a25a6b6243b0819056a74653e92ef918c89a
Gitweb:     http://www.syslinux.org/commit/6366a25a6b6243b0819056a74653e92ef918c89a
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Fri, 29 Jun 2012 15:24:02 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Fri, 29 Jun 2012 15:24:02 -0700

linux.c32: add support for a device tree blob (dtb)

Based on a patch by Thierry Reding, add support for loading a device
tree blob using the generic setup_data framework.

I used the name dtb= instead of fdt= since it looks like dtb= is the
common acronym for the filenames and what is used in the kernel.

Originally-by: Thierry Reding <thierry.reding at avionic-design.de>
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>

---
 com32/modules/linux.c |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/com32/modules/linux.c b/com32/modules/linux.c
index 102e877..1099875 100644
--- a/com32/modules/linux.c
+++ b/com32/modules/linux.c
@@ -1,7 +1,7 @@
 /* ----------------------------------------------------------------------- *
  *
  *   Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
- *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ *   Copyright 2009-2012 Intel Corporation; author: H. Peter Anvin
  *
  *   Permission is hereby granted, free of charge, to any person
  *   obtaining a copy of this software and associated documentation
@@ -113,6 +113,7 @@ int main(int argc, char *argv[])
 {
     const char *kernel_name;
     struct initramfs *initramfs;
+    struct setup_data *setup_data;
     char *cmdline;
     char *boot_image;
     void *kernel_data;
@@ -222,9 +223,31 @@ int main(int argc, char *argv[])
 	}
     }
 
+    /* Handle dtb and eventually other setup data */
+    setup_data = setup_data_init();
+    if (!setup_data)
+	goto bail;
+
+    if ((arg = find_argument(argp, "dtb="))) {
+	if (!opt_quiet) {
+	    printf("Loading %s... ", arg);
+
+	    if (setup_data_load(setup_data, SETUP_DTB, arg)) {
+		if (opt_quiet)
+		    printf("Loading %s ", arg);
+		printf("failed\n");
+		goto bail;
+	    }
+	    
+	    if (!opt_quiet)
+		printf("ok\n");
+	}
+    }
+
     /* This should not return... */
     errno = 0;
-    syslinux_boot_linux(kernel_data, kernel_len, initramfs, NULL, cmdline);
+    syslinux_boot_linux(kernel_data, kernel_len, initramfs,
+			setup_data, cmdline);
     fprintf(stderr, "syslinux_boot_linux() failed: ");
 
 bail:


More information about the Syslinux-commits mailing list