support multiple boot.img files in release tools
Support for generating multiple boot.img files is required in the release tools to enable GKI distribution/signing. Bug: 151094943 Change-Id: I536a286d3123f35918106a52c49b1148d746370f Merged-In: I536a286d3123f35918106a52c49b1148d746370f
This commit is contained in:
@@ -4127,6 +4127,8 @@ ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
|
|||||||
endif
|
endif
|
||||||
ifeq ($(INSTALLED_BOOTIMAGE_TARGET),)
|
ifeq ($(INSTALLED_BOOTIMAGE_TARGET),)
|
||||||
$(hide) echo "no_boot=true" >> $@
|
$(hide) echo "no_boot=true" >> $@
|
||||||
|
else
|
||||||
|
echo "boot_images=$(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),$(notdir $(b)))" >> $@
|
||||||
endif
|
endif
|
||||||
ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
|
ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
|
||||||
echo "vendor_boot=true" >> $@
|
echo "vendor_boot=true" >> $@
|
||||||
|
@@ -731,16 +731,24 @@ def AddImagesToTargetFiles(filename):
|
|||||||
boot_image = None
|
boot_image = None
|
||||||
if has_boot:
|
if has_boot:
|
||||||
banner("boot")
|
banner("boot")
|
||||||
# common.GetBootableImage() returns the image directly if present.
|
boot_images = OPTIONS.info_dict.get("boot_images")
|
||||||
boot_image = common.GetBootableImage(
|
if boot_images is None:
|
||||||
"IMAGES/boot.img", "boot.img", OPTIONS.input_tmp, "BOOT")
|
boot_images = "boot.img"
|
||||||
# boot.img may be unavailable in some targets (e.g. aosp_arm64).
|
for b in boot_images.split():
|
||||||
if boot_image:
|
# common.GetBootableImage() returns the image directly if present.
|
||||||
partitions['boot'] = os.path.join(OPTIONS.input_tmp, "IMAGES", "boot.img")
|
boot_image = common.GetBootableImage(
|
||||||
if not os.path.exists(partitions['boot']):
|
"IMAGES/" + b, b, OPTIONS.input_tmp, "BOOT")
|
||||||
boot_image.WriteToDir(OPTIONS.input_tmp)
|
# boot.img may be unavailable in some targets (e.g. aosp_arm64).
|
||||||
if output_zip:
|
if boot_image:
|
||||||
boot_image.AddToZip(output_zip)
|
boot_image_path = os.path.join(OPTIONS.input_tmp, "IMAGES", b)
|
||||||
|
# vbmeta does not need to include boot.img with multiple boot.img files,
|
||||||
|
# which is only used for aosp_arm64 for GKI
|
||||||
|
if len(boot_images.split()) == 1:
|
||||||
|
partitions['boot'] = boot_image_path
|
||||||
|
if not os.path.exists(boot_image_path):
|
||||||
|
boot_image.WriteToDir(OPTIONS.input_tmp)
|
||||||
|
if output_zip:
|
||||||
|
boot_image.AddToZip(output_zip)
|
||||||
|
|
||||||
if has_vendor_boot:
|
if has_vendor_boot:
|
||||||
banner("vendor_boot")
|
banner("vendor_boot")
|
||||||
|
@@ -1015,7 +1015,7 @@ def _MakeRamdisk(sourcedir, fs_config_file=None):
|
|||||||
return ramdisk_img
|
return ramdisk_img
|
||||||
|
|
||||||
|
|
||||||
def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
|
def _BuildBootableImage(image_name, sourcedir, fs_config_file, info_dict=None,
|
||||||
has_ramdisk=False, two_step_image=False):
|
has_ramdisk=False, two_step_image=False):
|
||||||
"""Build a bootable image from the specified sourcedir.
|
"""Build a bootable image from the specified sourcedir.
|
||||||
|
|
||||||
@@ -1028,7 +1028,15 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
|
|||||||
for building the requested image.
|
for building the requested image.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not os.access(os.path.join(sourcedir, "kernel"), os.F_OK):
|
# "boot" or "recovery", without extension.
|
||||||
|
partition_name = os.path.basename(sourcedir).lower()
|
||||||
|
|
||||||
|
if partition_name == "recovery":
|
||||||
|
kernel = "kernel"
|
||||||
|
else:
|
||||||
|
kernel = image_name.replace("boot", "kernel")
|
||||||
|
kernel = kernel.replace(".img","")
|
||||||
|
if not os.access(os.path.join(sourcedir, kernel), os.F_OK):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if has_ramdisk and not os.access(os.path.join(sourcedir, "RAMDISK"), os.F_OK):
|
if has_ramdisk and not os.access(os.path.join(sourcedir, "RAMDISK"), os.F_OK):
|
||||||
@@ -1045,7 +1053,7 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
|
|||||||
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
|
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
|
||||||
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
|
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
|
||||||
|
|
||||||
cmd = [mkbootimg, "--kernel", os.path.join(sourcedir, "kernel")]
|
cmd = [mkbootimg, "--kernel", os.path.join(sourcedir, kernel)]
|
||||||
|
|
||||||
fn = os.path.join(sourcedir, "second")
|
fn = os.path.join(sourcedir, "second")
|
||||||
if os.access(fn, os.F_OK):
|
if os.access(fn, os.F_OK):
|
||||||
@@ -1072,9 +1080,6 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
|
|||||||
cmd.append("--pagesize")
|
cmd.append("--pagesize")
|
||||||
cmd.append(open(fn).read().rstrip("\n"))
|
cmd.append(open(fn).read().rstrip("\n"))
|
||||||
|
|
||||||
# "boot" or "recovery", without extension.
|
|
||||||
partition_name = os.path.basename(sourcedir).lower()
|
|
||||||
|
|
||||||
if partition_name == "recovery":
|
if partition_name == "recovery":
|
||||||
args = info_dict.get("recovery_mkbootimg_args")
|
args = info_dict.get("recovery_mkbootimg_args")
|
||||||
else:
|
else:
|
||||||
@@ -1197,7 +1202,7 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir,
|
|||||||
info_dict.get("recovery_as_boot") == "true")
|
info_dict.get("recovery_as_boot") == "true")
|
||||||
|
|
||||||
fs_config = "META/" + tree_subdir.lower() + "_filesystem_config.txt"
|
fs_config = "META/" + tree_subdir.lower() + "_filesystem_config.txt"
|
||||||
data = _BuildBootableImage(os.path.join(unpack_dir, tree_subdir),
|
data = _BuildBootableImage(prebuilt_name, os.path.join(unpack_dir, tree_subdir),
|
||||||
os.path.join(unpack_dir, fs_config),
|
os.path.join(unpack_dir, fs_config),
|
||||||
info_dict, has_ramdisk, two_step_image)
|
info_dict, has_ramdisk, two_step_image)
|
||||||
if data:
|
if data:
|
||||||
|
Reference in New Issue
Block a user