diff options
author | Doug Zongker <dougz@google.com> | 2012-08-02 14:50:24 -0700 |
---|---|---|
committer | Doug Zongker <dougz@google.com> | 2012-08-02 14:52:39 -0700 |
commit | dd7fafb34bf86b8fb41043e568bf0dd1005a49dd (patch) | |
tree | d7c9a676075641ece9f0a1d41aa749e9db236cc5 /mkbootimg | |
parent | 35fc46d8e338181ee3caedc30f3627bad2ffe35e (diff) | |
download | core-dd7fafb34bf86b8fb41043e568bf0dd1005a49dd.tar.gz core-dd7fafb34bf86b8fb41043e568bf0dd1005a49dd.tar.bz2 core-dd7fafb34bf86b8fb41043e568bf0dd1005a49dd.zip |
add command-line arguments to mkbootimg to move kernel, ramdisk, etc.
Bug: 6918260
Change-Id: I5d4af6314fded027952941110a520dc9aa234a14
Diffstat (limited to 'mkbootimg')
-rw-r--r-- | mkbootimg/mkbootimg.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/mkbootimg/mkbootimg.c b/mkbootimg/mkbootimg.c index d72e3176c..2c32ce35b 100644 --- a/mkbootimg/mkbootimg.c +++ b/mkbootimg/mkbootimg.c @@ -109,18 +109,17 @@ int main(int argc, char **argv) int fd; SHA_CTX ctx; uint8_t* sha; + unsigned base = 0x10000000; + unsigned kernel_offset = 0x00008000; + unsigned ramdisk_offset = 0x01000000; + unsigned second_offset = 0x00f00000; + unsigned tags_offset = 0x00000100; argc--; argv++; memset(&hdr, 0, sizeof(hdr)); - /* default load addresses */ - hdr.kernel_addr = 0x10008000; - hdr.ramdisk_addr = 0x11000000; - hdr.second_addr = 0x10F00000; - hdr.tags_addr = 0x10000100; - while(argc > 0){ char *arg = argv[0]; char *val = argv[1]; @@ -140,11 +139,15 @@ int main(int argc, char **argv) } else if(!strcmp(arg, "--cmdline")) { cmdline = val; } else if(!strcmp(arg, "--base")) { - unsigned base = strtoul(val, 0, 16); - hdr.kernel_addr = base + 0x00008000; - hdr.ramdisk_addr = base + 0x01300000; - hdr.second_addr = base + 0x00F00000; - hdr.tags_addr = base + 0x00000100; + base = strtoul(val, 0, 16); + } else if(!strcmp(arg, "--kernel_offset")) { + kernel_offset = strtoul(val, 0, 16); + } else if(!strcmp(arg, "--ramdisk_offset")) { + ramdisk_offset = strtoul(val, 0, 16); + } else if(!strcmp(arg, "--second_offset")) { + second_offset = strtoul(val, 0, 16); + } else if(!strcmp(arg, "--tags_offset")) { + tags_offset = strtoul(val, 0, 16); } else if(!strcmp(arg, "--board")) { board = val; } else if(!strcmp(arg,"--pagesize")) { @@ -159,6 +162,10 @@ int main(int argc, char **argv) } hdr.page_size = pagesize; + hdr.kernel_addr = base + kernel_offset; + hdr.ramdisk_addr = base + ramdisk_offset; + hdr.second_addr = base + second_offset; + hdr.tags_addr = base + tags_offset; if(bootimg == 0) { fprintf(stderr,"error: no output filename specified\n"); |