diff options
author | Dima Zavin <dima@android.com> | 2010-02-12 20:26:33 -0800 |
---|---|---|
committer | Dima Zavin <dima@android.com> | 2010-02-16 09:40:05 -0800 |
commit | 931175a1c5f01f57781c9fcf64beade6ed5148ff (patch) | |
tree | dc18ecbd7649eef66dba0897a1f9aaa6ad2a8215 /fastboot | |
parent | d77caaa94e8cfc1ef09699f88ed0d4bb2853e7f4 (diff) | |
download | system_core-931175a1c5f01f57781c9fcf64beade6ed5148ff.zip system_core-931175a1c5f01f57781c9fcf64beade6ed5148ff.tar.gz system_core-931175a1c5f01f57781c9fcf64beade6ed5148ff.tar.bz2 |
fastboot: add nand page size param, used for boot and flash:raw commands
Change-Id: I07451363f4d4ac8665598722491968e6ee0953ee
Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'fastboot')
-rw-r--r-- | fastboot/fastboot.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c index aedfce1..bed30b2 100644 --- a/fastboot/fastboot.c +++ b/fastboot/fastboot.c @@ -231,11 +231,12 @@ void usage(void) " -c <cmdline> override kernel commandline\n" " -i <vendor id> specify a custom USB vendor id\n" " -b <base_addr> specify a custom kernel base address\n" + " -n <page size> specify the nand page size. default: 2048\n" ); exit(1); } -void *load_bootable_image(const char *kernel, const char *ramdisk, +void *load_bootable_image(unsigned page_size, const char *kernel, const char *ramdisk, unsigned *sz, const char *cmdline) { void *kdata = 0, *rdata = 0; @@ -276,7 +277,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, base_addr, &bsize); + bdata = mkbootimg(kdata, ksize, rdata, rsize, 0, 0, page_size, base_addr, &bsize); if(bdata == 0) { fprintf(stderr,"failed to create boot.img\n"); return 0; @@ -548,6 +549,7 @@ int main(int argc, char **argv) int wants_reboot_bootloader = 0; void *data; unsigned sz; + unsigned page_size = 2048; skip(1); if (argc == 0) { @@ -570,6 +572,11 @@ int main(int argc, char **argv) require(2); base_addr = strtoul(argv[1], 0, 16); skip(2); + } else if(!strcmp(*argv, "-n")) { + require(2); + page_size = (unsigned)strtoul(argv[1], NULL, 0); + if (!page_size) die("invalid page size"); + skip(2); } else if(!strcmp(*argv, "-s")) { require(2); serial = argv[1]; @@ -629,7 +636,7 @@ int main(int argc, char **argv) rname = argv[0]; skip(1); } - data = load_bootable_image(kname, rname, &sz, cmdline); + data = load_bootable_image(page_size, kname, rname, &sz, cmdline); if (data == 0) return 1; fb_queue_download("boot.img", data, sz); fb_queue_command("boot", "booting"); @@ -659,7 +666,7 @@ int main(int argc, char **argv) } else { skip(3); } - data = load_bootable_image(kname, rname, &sz, cmdline); + data = load_bootable_image(page_size, kname, rname, &sz, cmdline); if (data == 0) die("cannot load bootable image"); fb_queue_flash(pname, data, sz); } else if(!strcmp(*argv, "flashall")) { |