Merge change 685 into donut
* changes: fastboot, mkbootimg: support alternate base addresses
This commit is contained in:
commit
8634c6cf60
|
@ -40,7 +40,7 @@ void bootimg_set_cmdline(boot_img_hdr *h, const char *cmdline)
|
|||
boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size,
|
||||
void *ramdisk, unsigned ramdisk_size,
|
||||
void *second, unsigned second_size,
|
||||
unsigned page_size,
|
||||
unsigned page_size, unsigned base,
|
||||
unsigned *bootimg_size)
|
||||
{
|
||||
unsigned kernel_actual;
|
||||
|
@ -65,15 +65,14 @@ boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size,
|
|||
|
||||
memcpy(hdr->magic, BOOT_MAGIC, BOOT_MAGIC_SIZE);
|
||||
|
||||
hdr->kernel_size = kernel_size;
|
||||
hdr->kernel_addr = 0x10008000;
|
||||
hdr->kernel_size = kernel_size;
|
||||
hdr->ramdisk_size = ramdisk_size;
|
||||
hdr->ramdisk_addr = 0x11000000;
|
||||
hdr->second_size = second_size;
|
||||
hdr->second_addr = 0x10F00000;
|
||||
|
||||
hdr->tags_addr = 0x10000100;
|
||||
hdr->page_size = page_size;
|
||||
hdr->second_size = second_size;
|
||||
hdr->kernel_addr = base + 0x00008000;
|
||||
hdr->ramdisk_addr = base + 0x01000000;
|
||||
hdr->second_addr = base + 0x00F00000;
|
||||
hdr->tags_addr = base + 0x00000100;
|
||||
hdr->page_size = page_size;
|
||||
|
||||
memcpy(hdr->magic + page_size,
|
||||
kernel, kernel_size);
|
||||
|
|
|
@ -42,6 +42,14 @@
|
|||
|
||||
#include "fastboot.h"
|
||||
|
||||
void bootimg_set_cmdline(boot_img_hdr *h, const char *cmdline);
|
||||
|
||||
boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size,
|
||||
void *ramdisk, unsigned ramdisk_size,
|
||||
void *second, unsigned second_size,
|
||||
unsigned page_size, unsigned base,
|
||||
unsigned *bootimg_size);
|
||||
|
||||
static usb_handle *usb = 0;
|
||||
static const char *serial = 0;
|
||||
static const char *product = 0;
|
||||
|
@ -49,6 +57,8 @@ static const char *cmdline = 0;
|
|||
static int wipe_data = 0;
|
||||
static unsigned short vendor_id = 0;
|
||||
|
||||
static unsigned base_addr = 0x10000000;
|
||||
|
||||
void die(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -257,7 +267,7 @@ void *load_bootable_image(const char *kernel, const char *ramdisk,
|
|||
}
|
||||
|
||||
fprintf(stderr,"creating boot image...\n");
|
||||
bdata = mkbootimg(kdata, ksize, rdata, rsize, 0, 0, 2048, &bsize);
|
||||
bdata = mkbootimg(kdata, ksize, rdata, rsize, 0, 0, 2048, base_addr, &bsize);
|
||||
if(bdata == 0) {
|
||||
fprintf(stderr,"failed to create boot.img\n");
|
||||
return 0;
|
||||
|
@ -545,6 +555,10 @@ int main(int argc, char **argv)
|
|||
if(!strcmp(*argv, "-w")) {
|
||||
wants_wipe = 1;
|
||||
skip(1);
|
||||
} else if(!strcmp(*argv, "-b")) {
|
||||
require(2);
|
||||
base_addr = strtoul(argv[1], 0, 16);
|
||||
skip(2);
|
||||
} else if(!strcmp(*argv, "-s")) {
|
||||
require(2);
|
||||
serial = argv[1];
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue