Skip to content

Commit

Permalink
unpackbootimg: Add support for device trees
Browse files Browse the repository at this point in the history
Change-Id: I340eed99d2274a2f4cbaf5a9f27726ff3a9302e5
  • Loading branch information
Shelnutt2 authored and broodplank committed Nov 11, 2013
1 parent 0b37987 commit 5fa16e3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mkbootimg/unpackbootimg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 5fa16e3

Please sign in to comment.