handle BOARD_KERNEL_BASE in releasetools

Some devices define a BOARD_KERNEL_BASE argument which must be given
as an argument to mkbootimg when building a bootable image.  Store the
value of this var (if any) in the target-files zip and use it when
building images.
diff --git a/core/Makefile b/core/Makefile
index 4089d4d..df41628 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -820,6 +820,9 @@
 ifdef BOARD_KERNEL_CMDLINE
 	$(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/RECOVERY/cmdline
 endif
+ifdef BOARD_KERNEL_BASE
+	$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/RECOVERY/base
+endif
 	@# Components of the boot image
 	$(hide) mkdir -p $(zip_root)/BOOT
 	$(hide) $(call package_files-copy-root, \
@@ -834,6 +837,9 @@
 ifdef BOARD_KERNEL_CMDLINE
 	$(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
 endif
+ifdef BOARD_KERNEL_BASE
+	$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
+endif
 ifdef INSTALLED_RADIOIMAGE_TARGET
 	@# The radio image
 	$(hide) mkdir -p $(zip_root)/RADIO
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 3463745..a426ebd 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -90,17 +90,22 @@
   assert p1.returncode == 0, "mkbootfs of %s ramdisk failed" % (targetname,)
   assert p2.returncode == 0, "minigzip of %s ramdisk failed" % (targetname,)
 
+  cmd = ["mkbootimg", "--kernel", os.path.join(sourcedir, "kernel")]
+
   fn = os.path.join(sourcedir, "cmdline")
   if os.access(fn, os.F_OK):
-    cmdline = ["--cmdline", open(fn).read().rstrip("\n")]
-  else:
-    cmdline = []
-  p = Run(["mkbootimg",
-           "--kernel", os.path.join(sourcedir, "kernel")] +
-          cmdline +
-          ["--ramdisk", ramdisk_img.name,
-           "--output", img.name],
-          stdout=subprocess.PIPE)
+    cmd.append("--cmdline")
+    cmd.append(open(fn).read().rstrip("\n"))
+
+  fn = os.path.join(sourcedir, "base")
+  if os.access(fn, os.F_OK):
+    cmd.append("--base")
+    cmd.append(open(fn).read().rstrip("\n"))
+
+  cmd.extend(["--ramdisk", ramdisk_img.name,
+              "--output", img.name])
+
+  p = Run(cmd, stdout=subprocess.PIPE)
   p.communicate()
   assert p.returncode == 0, "mkbootimg of %s image failed" % (targetname,)