summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Swetland2009-04-28 18:05:07 -0500
committerBrian Swetland2009-04-28 18:05:07 -0500
commit2a63bb7abf1b27a7a2e8fd5951d77f71a2f290d4 (patch)
tree5e3e2fbff2f0ce4a96bd109f6c3dcaf54a3b80c5 /mkbootimg
parent6181f70bd40fd020661841923e725df75a3a2793 (diff)
downloadplatform-system-core-2a63bb7abf1b27a7a2e8fd5951d77f71a2f290d4.tar.gz
platform-system-core-2a63bb7abf1b27a7a2e8fd5951d77f71a2f290d4.tar.xz
platform-system-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.c28
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)
63 " [ --second <2ndbootloader-filename> ]\n" 63 " [ --second <2ndbootloader-filename> ]\n"
64 " [ --cmdline <kernel-commandline> ]\n" 64 " [ --cmdline <kernel-commandline> ]\n"
65 " [ --board <boardname> ]\n" 65 " [ --board <boardname> ]\n"
66 " [ --base <address> ]\n"
66 " -o|--output <filename>\n" 67 " -o|--output <filename>\n"
67 ); 68 );
68 return 1; 69 return 1;
@@ -104,7 +105,6 @@ int main(int argc, char **argv)
104 char *bootimg = 0; 105 char *bootimg = 0;
105 char *board = ""; 106 char *board = "";
106 unsigned pagesize = 2048; 107 unsigned pagesize = 2048;
107 unsigned saddr = 0;
108 int fd; 108 int fd;
109 SHA_CTX ctx; 109 SHA_CTX ctx;
110 uint8_t* sha; 110 uint8_t* sha;
@@ -114,6 +114,14 @@ int main(int argc, char **argv)
114 114
115 memset(&hdr, 0, sizeof(hdr)); 115 memset(&hdr, 0, sizeof(hdr));
116 116
117 /* default load addresses */
118 hdr.kernel_addr = 0x10008000;
119 hdr.ramdisk_addr = 0x11000000;
120 hdr.second_addr = 0x10F00000;
121 hdr.tags_addr = 0x10000100;
122
123 hdr.page_size = pagesize;
124
117 while(argc > 0){ 125 while(argc > 0){
118 char *arg = argv[0]; 126 char *arg = argv[0];
119 char *val = argv[1]; 127 char *val = argv[1];
@@ -132,8 +140,12 @@ int main(int argc, char **argv)
132 second_fn = val; 140 second_fn = val;
133 } else if(!strcmp(arg, "--cmdline")) { 141 } else if(!strcmp(arg, "--cmdline")) {
134 cmdline = val; 142 cmdline = val;
135 } else if(!strcmp(arg, "--saddr")) { 143 } else if(!strcmp(arg, "--base")) {
136 saddr = strtoul(val, 0, 16); 144 unsigned base = strtoul(val, 0, 16);
145 hdr.kernel_addr = base + 0x00008000;
146 hdr.ramdisk_addr = base + 0x01000000;
147 hdr.second_addr = base + 0x00F00000;
148 hdr.tags_addr = base + 0x00000100;
137 } else if(!strcmp(arg, "--board")) { 149 } else if(!strcmp(arg, "--board")) {
138 board = val; 150 board = val;
139 } else { 151 } else {
@@ -163,16 +175,6 @@ int main(int argc, char **argv)
163 175
164 strcpy(hdr.name, board); 176 strcpy(hdr.name, board);
165 177
166 hdr.kernel_addr = 0x10008000;
167 hdr.ramdisk_addr = 0x11000000;
168 if(saddr) {
169 hdr.second_addr = 0x00300000;
170 } else {
171 hdr.second_addr = 0x10F00000;
172 }
173 hdr.tags_addr = 0x10000100;
174 hdr.page_size = pagesize;
175
176 memcpy(hdr.magic, BOOT_MAGIC, BOOT_MAGIC_SIZE); 178 memcpy(hdr.magic, BOOT_MAGIC, BOOT_MAGIC_SIZE);
177 179
178 if(strlen(cmdline) > (BOOT_ARGS_SIZE - 1)) { 180 if(strlen(cmdline) > (BOOT_ARGS_SIZE - 1)) {