From 38a649f873da8d4df7df14619cbd967570d2de9b Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 17 Jun 2009 09:07:09 -0700 Subject: [PATCH] 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. --- core/Makefile | 6 ++++++ tools/releasetools/common.py | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/core/Makefile b/core/Makefile index 4089d4d85e..df41628531 100644 --- a/core/Makefile +++ b/core/Makefile @@ -819,6 +819,9 @@ ifdef INSTALLED_2NDBOOTLOADER_TARGET endif 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 @@ -834,6 +837,9 @@ endif 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 3463745c45..a426ebdad1 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -90,17 +90,22 @@ def BuildBootableImage(sourcedir): 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,)