Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 344b3218d40b44df5bfc8c7c4859e7d9ed4d06f2 1 parent 6645e68
Ithamar R. Adema authored November 13, 2012
2  headers/private/kernel/boot/platform/u-boot/platform_stage2_args.h
@@ -12,6 +12,8 @@
12 12
 struct platform_stage2_args {
13 13
 	void *boot_tgz_data;
14 14
 	uint32 boot_tgz_size;
  15
+	void *fdt_data;
  16
+	uint32 fdt_size;
15 17
 };
16 18
 
17 19
 #endif	/* KERNEL_BOOT_PLATFORM_UBOOT_STAGE2_H */
22  src/system/boot/platform/u-boot/start.cpp
@@ -172,11 +172,33 @@ start_raw(int argc, const char **argv)
172 172
 	args.arguments = NULL;
173 173
 	args.platform.boot_tgz_data = NULL;
174 174
 	args.platform.boot_tgz_size = 0;
  175
+	args.platform.fdt_data = NULL;
  176
+	args.platform.fdt_size = 0;
  177
+
  178
+	// if we get passed a uimage, try to find the third blob only if we do not have FDT data yet
  179
+	if (gUImage != NULL
  180
+		&& !gFDT
  181
+		&& image_multi_getimg(gUImage, 2,
  182
+			(uint32*)&args.platform.fdt_data,
  183
+			&args.platform.fdt_size)) {
  184
+		// found a blob, assume it is FDT data, when working on a platform
  185
+		// which does not have an FDT enabled U-Boot
  186
+		gFDT = args.platform.fdt_data;
  187
+	}
175 188
 
176 189
 	serial_init(gFDT);
177 190
 	console_init();
178 191
 	cpu_init();
179 192
 
  193
+	if (args.platform.fdt_data) {
  194
+		dprintf("Found FDT from uimage @ %p, %" B_PRIu32 " bytes\n",
  195
+			args.platform.fdt_data, args.platform.fdt_size);
  196
+	} else if (gFDT) {
  197
+		/* Fixup args so we can pass the gFDT on to the kernel */
  198
+		args.platform.fdt_data = gFDT;
  199
+		args.platform.fdt_size = fdt_totalsize(gFDT);
  200
+	}
  201
+
180 202
 	// if we get passed an FDT, check /chosen for initrd
181 203
 	if (gFDT != NULL) {
182 204
 		int node = fdt_path_offset(gFDT, "/chosen");

0 notes on commit 344b321

Please sign in to comment.
Something went wrong with that request. Please try again.