[haiku-commits] BRANCH mmu_man-github.sam460ex - src/system/boot/platform/u-boot

  • From: mmu_man-github.sam460ex <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 25 Aug 2012 00:49:21 +0200 (CEST)

added 1 changeset to branch 'refs/remotes/mmu_man-github/sam460ex'
old head: 60a40e4ff09114e1e53f65e8f3e93f159f2212a0
new head: 80dfcc73119a3c34347db3709819c6a17d9883de

----------------------------------------------------------------------------

80dfcc7: U-Boot: check for /chosen in the FDT for an initrd holding our tgz
  
  * since the FDT linux boot method doesn't pass the uimage, we can't
  use it to pass the kernel+driver tgz in a multi-file uimage.
  * instead we check for the linux initrd properties in the /chosen node.

                                          [ François Revol <revol@xxxxxxx> ]

----------------------------------------------------------------------------

Commit:      80dfcc73119a3c34347db3709819c6a17d9883de

Author:      François Revol <revol@xxxxxxx>
Date:        Fri Aug 24 22:33:24 2012 UTC

----------------------------------------------------------------------------

1 file changed, 30 insertions(+), 1 deletion(-)
src/system/boot/platform/u-boot/start.cpp |   31 ++++++++++++++++++++++++-

----------------------------------------------------------------------------

diff --git a/src/system/boot/platform/u-boot/start.cpp 
b/src/system/boot/platform/u-boot/start.cpp
index c379aa1..81b03bf 100644
--- a/src/system/boot/platform/u-boot/start.cpp
+++ b/src/system/boot/platform/u-boot/start.cpp
@@ -21,6 +21,12 @@
 
 #include <string.h>
 
+extern "C" {
+#include <fdt.h>
+#include <libfdt.h>
+#include <libfdt_env.h>
+};
+
 
 #define HEAP_SIZE (128 * 1024)
 
@@ -171,12 +177,35 @@ start_raw(int argc, const char **argv)
        console_init();
        cpu_init();
 
+       // if we get passed an FDT, check /chosen for initrd
+       if (gFDT != NULL) {
+               int node = fdt_path_offset(gFDT, "/chosen");
+               const void *prop;
+               int len;
+               phys_addr_t initrd_start = 0, initrd_end = 0;
+
+               if (node >= 0) {
+                       prop = fdt_getprop(gFDT, node, "linux,initrd-start", 
&len);
+                       if (prop && len == 4)
+                               initrd_start = fdt32_to_cpu(*(uint32_t *)prop);
+                       prop = fdt_getprop(gFDT, node, "linux,initrd-end", 
&len);
+                       if (prop && len == 4)
+                               initrd_end = fdt32_to_cpu(*(uint32_t *)prop);
+                       if (initrd_end > initrd_start) {
+                               args.platform.boot_tgz_data = (void 
*)initrd_start;
+                               args.platform.boot_tgz_size = initrd_end - 
initrd_start;
+               dprintf("Found boot tgz from FDT @ %p, %" B_PRIu32 " bytes\n",
+                       args.platform.boot_tgz_data, 
args.platform.boot_tgz_size);
+                       }
+               }
+       }
+
        // if we get passed a uimage, try to find the second blob
        if (gUImage != NULL
                && image_multi_getimg(gUImage, 1,
                        (uint32*)&args.platform.boot_tgz_data,
                        &args.platform.boot_tgz_size)) {
-               dprintf("Found boot tgz @ %p, %" B_PRIu32 " bytes\n",
+               dprintf("Found boot tgz from uimage @ %p, %" B_PRIu32 " 
bytes\n",
                        args.platform.boot_tgz_data, 
args.platform.boot_tgz_size);
        }
 


Other related posts: