ANDROID: build: avb_boot_img: Make boot img size configurable

Some targets require different boot image sizes, so allow that to be
configurable instead of hard-coded.

Change-Id: Iaac716f5baf91e99e0e91e71ab7da73edbbb46b7
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
This commit is contained in:
Guru Das Srinagesh 2023-05-31 10:07:20 -07:00
parent 6b46d61497
commit 17717e1c51
3 changed files with 12 additions and 1 deletions

View File

@ -19,7 +19,7 @@ def sign_boot_img(ctx):
command = """
cp {boot_img} {boot_dir}/{boot_name}
{tool} add_hash_footer --image {boot_dir}/{boot_name} --algorithm SHA256_RSA4096 \
--key {key} --partition_size 100663296 --partition_name boot \
--key {key} --partition_size {boot_partition_size} --partition_name boot \
{proplist}
""".format(
boot_img = boot_img.path,
@ -27,6 +27,7 @@ def sign_boot_img(ctx):
key = ctx.file.key.path,
boot_dir = outputs.dirname,
boot_name = outputs.basename,
boot_partition_size = ctx.attr.boot_partition_size,
proplist = proplist,
)
@ -60,6 +61,11 @@ avb_sign_boot_image = rule(
mandatory = True,
allow_single_file = True,
),
"boot_partition_size": attr.int(
mandatory = False,
default = 0x6000000, # bytes, = 98304 kb
doc = "Final size of boot.img desired",
),
"props": attr.string_list(
mandatory = True,
allow_empty = False,

View File

@ -3,6 +3,7 @@ def boot_image_opts(
base_address = 0x80000000,
page_size = 4096,
super_image_size = 0x10000000,
boot_partition_size = 0x6000000,
lz4_ramdisk = True,
earlycon_addr = "0x00a9C000",
kernel_vendor_cmdline_extras = ["bootconfig"]):
@ -11,6 +12,7 @@ def boot_image_opts(
base_address = base_address,
page_size = page_size,
super_image_size = super_image_size,
boot_partition_size = boot_partition_size,
lz4_ramdisk = lz4_ramdisk,
earlycon_addr = earlycon_addr,
kernel_vendor_cmdline_extras = kernel_vendor_cmdline_extras,

View File

@ -194,6 +194,7 @@ def _define_image_build(
build_vendor_kernel_boot = False,
build_vendor_dlkm = True,
build_system_dlkm = False,
boot_image_opts = boot_image_opts(),
boot_image_outs = None,
dtbo_list = [],
vendor_ramdisk_binaries = None,
@ -272,6 +273,7 @@ def _define_image_build(
"com.android.build.boot.os_version:13",
"com.android.build.boot.security_patch:2023-05-05",
],
boot_partition_size = int(boot_image_opts.boot_partition_size),
)
# Defined separately because `super.img` is not generated by upstream kleaf
@ -454,6 +456,7 @@ def define_msm_la(
dtbo_list = dtbo_list,
vendor_ramdisk_binaries = vendor_ramdisk_binaries,
gki_ramdisk_prebuilt_binary = gki_ramdisk_prebuilt_binary,
boot_image_opts = boot_image_opts,
boot_image_outs = None if dtb_list else ["boot.img", "init_boot.img"],
in_tree_module_list = in_tree_module_list,
)