diff options
author | Brian Swetland <swetland@google.com> | 2009-04-28 16:05:07 -0700 |
---|---|---|
committer | Brian Swetland <swetland@google.com> | 2009-04-28 16:05:07 -0700 |
commit | 2a63bb7abf1b27a7a2e8fd5951d77f71a2f290d4 (patch) | |
tree | 5e3e2fbff2f0ce4a96bd109f6c3dcaf54a3b80c5 /mkbootimg | |
parent | 6181f70bd40fd020661841923e725df75a3a2793 (diff) | |
download | core-2a63bb7abf1b27a7a2e8fd5951d77f71a2f290d4.tar.gz core-2a63bb7abf1b27a7a2e8fd5951d77f71a2f290d4.tar.bz2 core-2a63bb7abf1b27a7a2e8fd5951d77f71a2f290d4.zip |
fastboot, mkbootimg: support alternate base addresses
Add the --base flag to mkbootimg and -b flag to fastboot, to allow
the default kernel base address (0x10000000) to be changed.
Signed-off-by: Brian Swetland <swetland@google.com>
Diffstat (limited to 'mkbootimg')
-rw-r--r-- | mkbootimg/mkbootimg.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/mkbootimg/mkbootimg.c b/mkbootimg/mkbootimg.c index d803cf66d..364264711 100644 --- a/mkbootimg/mkbootimg.c +++ b/mkbootimg/mkbootimg.c @@ -63,6 +63,7 @@ int usage(void) " [ --second <2ndbootloader-filename> ]\n" " [ --cmdline <kernel-commandline> ]\n" " [ --board <boardname> ]\n" + " [ --base <address> ]\n" " -o|--output <filename>\n" ); return 1; @@ -104,7 +105,6 @@ int main(int argc, char **argv) char *bootimg = 0; char *board = ""; unsigned pagesize = 2048; - unsigned saddr = 0; int fd; SHA_CTX ctx; uint8_t* sha; @@ -114,6 +114,14 @@ int main(int argc, char **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; + + hdr.page_size = pagesize; + while(argc > 0){ char *arg = argv[0]; char *val = argv[1]; @@ -132,8 +140,12 @@ int main(int argc, char **argv) second_fn = val; } else if(!strcmp(arg, "--cmdline")) { cmdline = val; - } else if(!strcmp(arg, "--saddr")) { - saddr = strtoul(val, 0, 16); + } else if(!strcmp(arg, "--base")) { + unsigned base = strtoul(val, 0, 16); + hdr.kernel_addr = base + 0x00008000; + hdr.ramdisk_addr = base + 0x01000000; + hdr.second_addr = base + 0x00F00000; + hdr.tags_addr = base + 0x00000100; } else if(!strcmp(arg, "--board")) { board = val; } else { @@ -163,16 +175,6 @@ int main(int argc, char **argv) strcpy(hdr.name, board); - hdr.kernel_addr = 0x10008000; - hdr.ramdisk_addr = 0x11000000; - if(saddr) { - hdr.second_addr = 0x00300000; - } else { - hdr.second_addr = 0x10F00000; - } - hdr.tags_addr = 0x10000100; - hdr.page_size = pagesize; - memcpy(hdr.magic, BOOT_MAGIC, BOOT_MAGIC_SIZE); if(strlen(cmdline) > (BOOT_ARGS_SIZE - 1)) { |