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>
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index 498b4a6..95e20b5 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -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 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 @@
     }
 
     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 @@
         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];