Permalink
Browse files

ARM/u-boot: Add support for FDTs passed in the uImage

Since we're using multi-part uImage format, we can add the FDT as
a seperate "blob" in the uImage, if the used U-Boot version is not
"FDT enabled".

This is used for example for our Verdex target. Currently I've got
a local hack in the platform/u-boot/Jamfile, looking into pulling
in the FDT files and a proper Jam setup to do that properly...
  • Loading branch information...
1 parent 6645e68 commit 344b3218d40b44df5bfc8c7c4859e7d9ed4d06f2 @Ithamar Ithamar committed Nov 13, 2012
View
2 headers/private/kernel/boot/platform/u-boot/platform_stage2_args.h
@@ -12,6 +12,8 @@
struct platform_stage2_args {
void *boot_tgz_data;
uint32 boot_tgz_size;
+ void *fdt_data;
+ uint32 fdt_size;
};
#endif /* KERNEL_BOOT_PLATFORM_UBOOT_STAGE2_H */
View
22 src/system/boot/platform/u-boot/start.cpp
@@ -172,11 +172,33 @@ start_raw(int argc, const char **argv)
args.arguments = NULL;
args.platform.boot_tgz_data = NULL;
args.platform.boot_tgz_size = 0;
+ args.platform.fdt_data = NULL;
+ args.platform.fdt_size = 0;
+
+ // if we get passed a uimage, try to find the third blob only if we do not have FDT data yet
+ if (gUImage != NULL
+ && !gFDT
+ && image_multi_getimg(gUImage, 2,
+ (uint32*)&args.platform.fdt_data,
+ &args.platform.fdt_size)) {
+ // found a blob, assume it is FDT data, when working on a platform
+ // which does not have an FDT enabled U-Boot
+ gFDT = args.platform.fdt_data;
+ }
serial_init(gFDT);
console_init();
cpu_init();
+ if (args.platform.fdt_data) {
+ dprintf("Found FDT from uimage @ %p, %" B_PRIu32 " bytes\n",
+ args.platform.fdt_data, args.platform.fdt_size);
+ } else if (gFDT) {
+ /* Fixup args so we can pass the gFDT on to the kernel */
+ args.platform.fdt_data = gFDT;
+ args.platform.fdt_size = fdt_totalsize(gFDT);
+ }
+
// if we get passed an FDT, check /chosen for initrd
if (gFDT != NULL) {
int node = fdt_path_offset(gFDT, "/chosen");

0 comments on commit 344b321

Please sign in to comment.