MA-12121 [Android] Copy dtb from bootimage for Android

Android Things will load dtb from a single partition like
"oem_bootloader" and we are going to sync normal Android
with Android Things. But just keep loading dtb from bootimage
before everything is ready.

Change-Id: I205528b1485d3e8e9961f19812f380a2b11b991b
Signed-off-by: Luo Ji <ji.luo@nxp.com>
This commit is contained in:
Luo Ji 2018-07-03 16:14:33 +08:00 committed by Ji Luo
parent 620747bfe9
commit cfcbadd83d
2 changed files with 20 additions and 0 deletions

View File

@ -2090,6 +2090,8 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
+ ALIGN(hdr->kernel_size, hdr->page_size), hdr->ramdisk_size); + ALIGN(hdr->kernel_size, hdr->page_size), hdr->ramdisk_size);
#endif #endif
#ifdef CONFIG_OF_LIBFDT #ifdef CONFIG_OF_LIBFDT
/* load the dtb file */
#ifdef CONFIG_LOAD_FDT_FROM_PART
u32 fdt_size = 0; u32 fdt_size = 0;
char oemimage[AT_OEM_BL_PART_SIZE]; char oemimage[AT_OEM_BL_PART_SIZE];
snprintf(oemimage, sizeof(oemimage), "%s%s", snprintf(oemimage, sizeof(oemimage), "%s%s",
@ -2136,6 +2138,13 @@ int do_boota(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
dt_read_done: dt_read_done:
; ;
#else /* CONFIG_LOAD_FDT_FROM_PART */
if (hdr->second_size && hdr->second_addr) {
memcpy((void *)(ulong)hdr->second_addr, (void *)(ulong)hdr + hdr->page_size
+ ALIGN(hdr->kernel_size, hdr->page_size)
+ ALIGN(hdr->ramdisk_size, hdr->page_size), hdr->second_size);
}
#endif /* CONFIG_LOAD_FDT_FROM_PART */
#endif /*CONFIG_OF_LIBFDT*/ #endif /*CONFIG_OF_LIBFDT*/
if (check_image_arm64) { if (check_image_arm64) {
android_image_get_kernel(hdr, 0, NULL, NULL); android_image_get_kernel(hdr, 0, NULL, NULL);
@ -2146,8 +2155,13 @@ dt_read_done:
printf("kernel @ %08x (%d)\n", hdr->kernel_addr, hdr->kernel_size); printf("kernel @ %08x (%d)\n", hdr->kernel_addr, hdr->kernel_size);
printf("ramdisk @ %08x (%d)\n", hdr->ramdisk_addr, hdr->ramdisk_size); printf("ramdisk @ %08x (%d)\n", hdr->ramdisk_addr, hdr->ramdisk_size);
#ifdef CONFIG_OF_LIBFDT #ifdef CONFIG_OF_LIBFDT
#ifdef CONFIG_LOAD_FDT_FROM_PART
if (fdt_size) if (fdt_size)
printf("fdt @ %08x (%d)\n", hdr->second_addr, fdt_size); printf("fdt @ %08x (%d)\n", hdr->second_addr, fdt_size);
#else
if (hdr->second_size)
printf("fdt @ %08x (%d)\n", hdr->second_addr, hdr->second_size);
#endif
#endif /*CONFIG_OF_LIBFDT*/ #endif /*CONFIG_OF_LIBFDT*/
char boot_addr_start[12]; char boot_addr_start[12];

View File

@ -258,6 +258,12 @@ config OF_LIBFDT
particular compatible nodes. The library operates on a flattened particular compatible nodes. The library operates on a flattened
version of the device tree. version of the device tree.
config LOAD_FDT_FROM_PART
bool "Enable load FDT from single partition"
depends on OF_LIBFDT
help
This enables load FDT from a single partition like "oem_bootloader".
config OF_LIBFDT_OVERLAY config OF_LIBFDT_OVERLAY
bool "Enable the FDT library overlay support" bool "Enable the FDT library overlay support"
help help