summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Zongker2012-08-02 16:50:24 -0500
committerDoug Zongker2012-08-02 16:52:39 -0500
commitdd7fafb34bf86b8fb41043e568bf0dd1005a49dd (patch)
treed7c9a676075641ece9f0a1d41aa749e9db236cc5 /mkbootimg
parent35fc46d8e338181ee3caedc30f3627bad2ffe35e (diff)
downloadplatform-system-core-dd7fafb34bf86b8fb41043e568bf0dd1005a49dd.tar.gz
platform-system-core-dd7fafb34bf86b8fb41043e568bf0dd1005a49dd.tar.xz
platform-system-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.c29
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)
109 int fd; 109 int fd;
110 SHA_CTX ctx; 110 SHA_CTX ctx;
111 uint8_t* sha; 111 uint8_t* sha;
112 unsigned base = 0x10000000;
113 unsigned kernel_offset = 0x00008000;
114 unsigned ramdisk_offset = 0x01000000;
115 unsigned second_offset = 0x00f00000;
116 unsigned tags_offset = 0x00000100;
112 117
113 argc--; 118 argc--;
114 argv++; 119 argv++;
115 120
116 memset(&hdr, 0, sizeof(hdr)); 121 memset(&hdr, 0, sizeof(hdr));
117 122
118 /* default load addresses */
119 hdr.kernel_addr = 0x10008000;
120 hdr.ramdisk_addr = 0x11000000;
121 hdr.second_addr = 0x10F00000;
122 hdr.tags_addr = 0x10000100;
123
124 while(argc > 0){ 123 while(argc > 0){
125 char *arg = argv[0]; 124 char *arg = argv[0];
126 char *val = argv[1]; 125 char *val = argv[1];
@@ -140,11 +139,15 @@ int main(int argc, char **argv)
140 } else if(!strcmp(arg, "--cmdline")) { 139 } else if(!strcmp(arg, "--cmdline")) {
141 cmdline = val; 140 cmdline = val;
142 } else if(!strcmp(arg, "--base")) { 141 } else if(!strcmp(arg, "--base")) {
143 unsigned base = strtoul(val, 0, 16); 142 base = strtoul(val, 0, 16);
144 hdr.kernel_addr = base + 0x00008000; 143 } else if(!strcmp(arg, "--kernel_offset")) {
145 hdr.ramdisk_addr = base + 0x01300000; 144 kernel_offset = strtoul(val, 0, 16);
146 hdr.second_addr = base + 0x00F00000; 145 } else if(!strcmp(arg, "--ramdisk_offset")) {
147 hdr.tags_addr = base + 0x00000100; 146 ramdisk_offset = strtoul(val, 0, 16);
147 } else if(!strcmp(arg, "--second_offset")) {
148 second_offset = strtoul(val, 0, 16);
149 } else if(!strcmp(arg, "--tags_offset")) {
150 tags_offset = strtoul(val, 0, 16);
148 } else if(!strcmp(arg, "--board")) { 151 } else if(!strcmp(arg, "--board")) {
149 board = val; 152 board = val;
150 } else if(!strcmp(arg,"--pagesize")) { 153 } else if(!strcmp(arg,"--pagesize")) {
@@ -159,6 +162,10 @@ int main(int argc, char **argv)
159 } 162 }
160 hdr.page_size = pagesize; 163 hdr.page_size = pagesize;
161 164
165 hdr.kernel_addr = base + kernel_offset;
166 hdr.ramdisk_addr = base + ramdisk_offset;
167 hdr.second_addr = base + second_offset;
168 hdr.tags_addr = base + tags_offset;
162 169
163 if(bootimg == 0) { 170 if(bootimg == 0) {
164 fprintf(stderr,"error: no output filename specified\n"); 171 fprintf(stderr,"error: no output filename specified\n");