From 5fa16e31c58975e2d1730cb9cb184496c6499db3 Mon Sep 17 00:00:00 2001 From: Seth Shelnutt Date: Sat, 9 Nov 2013 14:21:49 -0500 Subject: [PATCH] unpackbootimg: Add support for device trees Change-Id: I340eed99d2274a2f4cbaf5a9f27726ff3a9302e5 --- mkbootimg/unpackbootimg.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mkbootimg/unpackbootimg.c b/mkbootimg/unpackbootimg.c index 14721a99..8be04054 100644 --- a/mkbootimg/unpackbootimg.c +++ b/mkbootimg/unpackbootimg.c @@ -99,6 +99,7 @@ int main(int argc, char** argv) printf("BOARD_KERNEL_CMDLINE %s\n", header.cmdline); printf("BOARD_KERNEL_BASE %08x\n", header.kernel_addr - 0x00008000); printf("BOARD_PAGE_SIZE %d\n", header.page_size); + printf("BOARD_DT_SIZE %d\n", header.dt_size); if (pagesize == 0) { pagesize = header.page_size; @@ -149,9 +150,21 @@ int main(int argc, char** argv) total_read += header.ramdisk_size; fwrite(ramdisk, header.ramdisk_size, 1, r); fclose(r); + + total_read += read_padding(f, header.ramdisk_size, pagesize); + + sprintf(tmp, "%s/%s", directory, basename(filename)); + strcat(tmp, "-dt.img"); + FILE *d = fopen(tmp, "wb"); + byte* dt = (byte*)malloc(header.dt_size); + //printf("Reading dt...\n"); + fread(dt, header.dt_size, 1, f); + total_read += header.dt_size; + fwrite(dt, header.dt_size, 1, r); + fclose(d); fclose(f); //printf("Total Read: %d\n", total_read); return 0; -} \ No newline at end of file +}