diff options
author | Isaac J. Manjarres <isaacmanjarres@google.com> | 2024-02-07 22:49:45 -0800 |
---|---|---|
committer | Android Build Cherrypicker Worker <android-build-cherrypicker-worker@google.com> | 2024-02-22 02:06:36 +0000 |
commit | f6c0c2b7da5ccca93ffc0f34540c14e65520a184 (patch) | |
tree | c26c1ef9875a80509358f381030703c4d163ced7 | |
parent | ab54ee86d308bbe6f704a7acbf97b84f34b53b6e (diff) | |
download | build-f6c0c2b7da5ccca93ffc0f34540c14e65520a184.tar.gz |
kleaf: Fix generation of modules.load.[recovery|charger]
Commit d08605f4c795 ("kleaf: Add support for specifying modules for
recovery/charger") accidentally made it so that
modules.load.[recovery|charger] are only generated if the vendor_boot
or vendor_kernel_boot images are made. Similar to modules.load, it is
possible to want to generate modules.load.[recovery|charger] without
a vendor_boot or vendor_kernel_boot image, so decouple the two.
Bug: 324356826
Fixes: d08605f4c795 ("kleaf: Add support for specifying modules for recovery/charger")
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:7de44ada9d71869e582c42d5d2f62c714d496a5c)
Merged-In: Idf9db5954e8c1bae01915f104c704302dbfd81ae
Change-Id: Idf9db5954e8c1bae01915f104c704302dbfd81ae
-rw-r--r-- | kleaf/impl/image/initramfs.bzl | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/kleaf/impl/image/initramfs.bzl b/kleaf/impl/image/initramfs.bzl index 783f942..85023d9 100644 --- a/kleaf/impl/image/initramfs.bzl +++ b/kleaf/impl/image/initramfs.bzl @@ -31,26 +31,12 @@ def _initramfs_impl(ctx): initramfs_img = ctx.actions.declare_file("{}/initramfs.img".format(ctx.label.name)) modules_load = ctx.actions.declare_file("{}/modules.load".format(ctx.label.name)) vendor_boot_modules_load = ctx.outputs.vendor_boot_modules_load - vendor_boot_modules_load_recovery = ctx.outputs.vendor_boot_modules_load_recovery - vendor_boot_modules_load_charger = ctx.outputs.vendor_boot_modules_load_charger initramfs_staging_archive = ctx.actions.declare_file("{}/initramfs_staging_archive.tar.gz".format(ctx.label.name)) outputs = [ initramfs_img, modules_load, ] - if vendor_boot_modules_load: - outputs.append(vendor_boot_modules_load) - - if vendor_boot_modules_load_recovery: - outputs.append(vendor_boot_modules_load_recovery) - - if vendor_boot_modules_load_charger: - outputs.append(vendor_boot_modules_load_charger) - - modules_staging_dir = initramfs_img.dirname + "/staging" - initramfs_staging_dir = modules_staging_dir + "/initramfs_staging" - cp_vendor_boot_modules_load_cmd = "" if vendor_boot_modules_load: cp_vendor_boot_modules_load_cmd = """ @@ -58,30 +44,50 @@ def _initramfs_impl(ctx): """.format( vendor_boot_modules_load = vendor_boot_modules_load.path, ) + outputs.append(vendor_boot_modules_load) - cp_vendor_boot_modules_load_recovery_cmd = "" - if vendor_boot_modules_load_recovery: + cp_modules_load_recovery_cmd = "" + if ctx.attr.modules_recovery_list: modules_load_recovery = ctx.actions.declare_file("{}/modules.load.recovery".format(ctx.label.name)) + cp_modules_load_recovery_cmd = """ + cp ${{modules_root_dir}}/modules.load.recovery {modules_load_recovery} + """.format( + modules_load_recovery = modules_load_recovery.path, + ) outputs.append(modules_load_recovery) + + cp_vendor_boot_modules_load_recovery_cmd = "" + vendor_boot_modules_load_recovery = ctx.outputs.vendor_boot_modules_load_recovery + if vendor_boot_modules_load_recovery: cp_vendor_boot_modules_load_recovery_cmd = """ - cp ${{modules_root_dir}}/modules.load.recovery {modules_load_recovery} cp ${{modules_root_dir}}/modules.load.recovery {vendor_boot_modules_load_recovery} """.format( - modules_load_recovery = modules_load_recovery.path, vendor_boot_modules_load_recovery = vendor_boot_modules_load_recovery.path, ) + outputs.append(vendor_boot_modules_load_recovery) - cp_vendor_boot_modules_load_charger_cmd = "" - if vendor_boot_modules_load_charger: + cp_modules_load_charger_cmd = "" + if ctx.attr.modules_charger_list: modules_load_charger = ctx.actions.declare_file("{}/modules.load.charger".format(ctx.label.name)) + cp_modules_load_charger_cmd = """ + cp ${{modules_root_dir}}/modules.load.charger {modules_load_charger} + """.format( + modules_load_charger = modules_load_charger.path, + ) outputs.append(modules_load_charger) + + cp_vendor_boot_modules_load_charger_cmd = "" + vendor_boot_modules_load_charger = ctx.outputs.vendor_boot_modules_load_charger + if vendor_boot_modules_load_charger: cp_vendor_boot_modules_load_charger_cmd = """ - cp ${{modules_root_dir}}/modules.load.charger {modules_load_charger} cp ${{modules_root_dir}}/modules.load.charger {vendor_boot_modules_load_charger} """.format( - modules_load_charger = modules_load_charger.path, vendor_boot_modules_load_charger = vendor_boot_modules_load_charger.path, ) + outputs.append(vendor_boot_modules_load_charger) + + modules_staging_dir = initramfs_img.dirname + "/staging" + initramfs_staging_dir = modules_staging_dir + "/initramfs_staging" additional_inputs = [] if ctx.file.modules_options: @@ -112,7 +118,9 @@ def _initramfs_impl(ctx): modules_root_dir=$(readlink -e {initramfs_staging_dir}/lib/modules/*) || exit 1 cp ${{modules_root_dir}}/modules.load {modules_load} {cp_vendor_boot_modules_load_cmd} + {cp_modules_load_recovery_cmd} {cp_vendor_boot_modules_load_recovery_cmd} + {cp_modules_load_charger_cmd} {cp_vendor_boot_modules_load_charger_cmd} {cp_modules_options_cmd} mkbootfs "{initramfs_staging_dir}" >"{modules_staging_dir}/initramfs.cpio" @@ -129,7 +137,9 @@ def _initramfs_impl(ctx): initramfs_img = initramfs_img.path, initramfs_staging_archive = initramfs_staging_archive.path, cp_vendor_boot_modules_load_cmd = cp_vendor_boot_modules_load_cmd, + cp_modules_load_recovery_cmd = cp_modules_load_recovery_cmd, cp_vendor_boot_modules_load_recovery_cmd = cp_vendor_boot_modules_load_recovery_cmd, + cp_modules_load_charger_cmd = cp_modules_load_charger_cmd, cp_vendor_boot_modules_load_charger_cmd = cp_vendor_boot_modules_load_charger_cmd, cp_modules_options_cmd = cp_modules_options_cmd, ) |