forked from openkylin/platform_build
add extra args to mkbootimg
Arrange to take $(BOARD_MKBOOTIMG_ARGS) and pass it to all invocations of mkbootimg from within make, and to store it in the target_files so it can be used by future invocations of img_from_target_files and ota_from_target_files. Bug: 6918260 Change-Id: I7130ac52e96bd51d4d8b80ca036635e1626f01f1
This commit is contained in:
parent
cdbf0292e4
commit
d513160b76
|
@ -403,7 +403,7 @@ else # TARGET_BOOTIMAGE_USE_EXT2 != true
|
|||
|
||||
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
|
||||
$(call pretty,"Target boot image: $@")
|
||||
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) --output $@
|
||||
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
|
||||
$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
|
||||
endif # TARGET_BOOTIMAGE_USE_EXT2
|
||||
|
||||
|
@ -664,7 +664,7 @@ $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
|
|||
cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \
|
||||
> $(TARGET_RECOVERY_ROOT_OUT)/default.prop
|
||||
$(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
|
||||
$(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@
|
||||
$(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
|
||||
@echo ----- Made recovery image -------- $@
|
||||
$(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
|
||||
|
||||
|
@ -1126,6 +1126,7 @@ endif
|
|||
ifdef PRODUCT_EXTRA_RECOVERY_KEYS
|
||||
$(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
|
||||
endif
|
||||
$(hide) echo "mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)" >> $(zip_root)/META/misc_info.txt
|
||||
$(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
|
||||
@# Zip everything up, preserving symlinks
|
||||
$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
|
||||
|
|
|
@ -83,7 +83,7 @@ endif
|
|||
$(INSTALLED_FACTORY_RAMDISK_TARGET) : $(MKBOOTIMG) $(TARGET_RAMDISK_KERNEL) $(INSTALLED_FACTORY_RAMDISK_FS)
|
||||
$(call pretty,"Target factory ram disk img format: $@")
|
||||
$(MKBOOTIMG) --kernel $(TARGET_RAMDISK_KERNEL) --ramdisk $(INSTALLED_FACTORY_RAMDISK_FS) \
|
||||
--base $(BOARD_KERNEL_BASE) $(RAMDISK_CMDLINE) --output $@
|
||||
--base $(BOARD_KERNEL_BASE) $(BOARD_MKBOOTIMG_ARGS) $(RAMDISK_CMDLINE) --output $@
|
||||
|
||||
endif
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ def DumpInfoDict(d):
|
|||
for k, v in sorted(d.items()):
|
||||
print "%-25s = (%s) %s" % (k, type(v).__name__, v)
|
||||
|
||||
def BuildBootableImage(sourcedir, fs_config_file):
|
||||
def BuildBootableImage(sourcedir, fs_config_file, info_dict=None):
|
||||
"""Take a kernel, cmdline, and ramdisk directory from the input (in
|
||||
'sourcedir'), and turn them into a boot image. Return the image
|
||||
data, or None if sourcedir does not appear to contains files for
|
||||
|
@ -206,6 +206,9 @@ def BuildBootableImage(sourcedir, fs_config_file):
|
|||
not os.access(os.path.join(sourcedir, "kernel"), os.F_OK)):
|
||||
return None
|
||||
|
||||
if info_dict is None:
|
||||
info_dict = OPTIONS.info_dict
|
||||
|
||||
ramdisk_img = tempfile.NamedTemporaryFile()
|
||||
img = tempfile.NamedTemporaryFile()
|
||||
|
||||
|
@ -239,6 +242,10 @@ def BuildBootableImage(sourcedir, fs_config_file):
|
|||
cmd.append("--pagesize")
|
||||
cmd.append(open(fn).read().rstrip("\n"))
|
||||
|
||||
args = info_dict.get("mkbootimg_args", None)
|
||||
if args and args.strip():
|
||||
cmd.extend(args.split())
|
||||
|
||||
cmd.extend(["--ramdisk", ramdisk_img.name,
|
||||
"--output", img.name])
|
||||
|
||||
|
@ -256,7 +263,8 @@ def BuildBootableImage(sourcedir, fs_config_file):
|
|||
return data
|
||||
|
||||
|
||||
def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir):
|
||||
def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir,
|
||||
info_dict=None):
|
||||
"""Return a File object (with name 'name') with the desired bootable
|
||||
image. Look for it in 'unpack_dir'/BOOTABLE_IMAGES under the name
|
||||
'prebuilt_name', otherwise construct it from the source files in
|
||||
|
@ -270,7 +278,8 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir):
|
|||
print "building image from target_files %s..." % (tree_subdir,)
|
||||
fs_config = "META/" + tree_subdir.lower() + "_filesystem_config.txt"
|
||||
return File(name, BuildBootableImage(os.path.join(unpack_dir, tree_subdir),
|
||||
os.path.join(unpack_dir, fs_config)))
|
||||
os.path.join(unpack_dir, fs_config),
|
||||
info_dict))
|
||||
|
||||
|
||||
def UnzipTemp(filename, pattern=None):
|
||||
|
|
|
@ -531,13 +531,15 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
|
|||
script.AssertSomeFingerprint(source_fp, target_fp)
|
||||
|
||||
source_boot = common.GetBootableImage(
|
||||
"/tmp/boot.img", "boot.img", OPTIONS.source_tmp, "BOOT")
|
||||
"/tmp/boot.img", "boot.img", OPTIONS.source_tmp, "BOOT",
|
||||
OPTIONS.source_info_dict)
|
||||
target_boot = common.GetBootableImage(
|
||||
"/tmp/boot.img", "boot.img", OPTIONS.target_tmp, "BOOT")
|
||||
updating_boot = (source_boot.data != target_boot.data)
|
||||
|
||||
source_recovery = common.GetBootableImage(
|
||||
"/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY")
|
||||
"/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY",
|
||||
OPTIONS.source_info_dict)
|
||||
target_recovery = common.GetBootableImage(
|
||||
"/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY")
|
||||
updating_recovery = (source_recovery.data != target_recovery.data)
|
||||
|
|
Loading…
Reference in New Issue