summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeir Fraser <keirf@google.com>2024-05-10 12:45:21 +0000
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-05-13 18:49:24 +0000
commit98982ebdcf4c5b6af17643c1d9775f3d718054df (patch)
tree3b04e1d9681f7f5b043eafc52ad9d2548de886c1
parentc68e5afe8da2bec3339c3806be667e2042b50afb (diff)
downloadbuild-98982ebdcf4c5b6af17643c1d9775f3d718054df.tar.gz
kleaf: Add support for vendor_ramdisk_dev_nodes to kernel_images
This allows special device nodes to be added at the final stage of vendor ramdisk construction, during repacking. Bug: 328362894 Change-Id: I729941573019cce3d3037a0afd841df0fc53df90 Signed-off-by: Keir Fraser <keirf@google.com>
-rw-r--r--build_utils.sh11
-rw-r--r--kleaf/impl/image/boot_images.bzl9
-rw-r--r--kleaf/impl/image/kernel_images.bzl5
3 files changed, 23 insertions, 2 deletions
diff --git a/build_utils.sh b/build_utils.sh
index 50260e3f..d204ac76 100644
--- a/build_utils.sh
+++ b/build_utils.sh
@@ -637,11 +637,18 @@ function build_boot_images() {
exit 1
fi
+ MKBOOTFS_ARGS=()
+ if [ -n "${VENDOR_RAMDISK_DEV_NODES}" ]; then
+ for vendor_ramdisk_dev_nodes in ${VENDOR_RAMDISK_DEV_NODES}; do
+ MKBOOTFS_ARGS+=("-n" "${vendor_ramdisk_dev_nodes}")
+ done
+ fi
+
if [ -n "${SKIP_UNPACKING_RAMDISK}" ] && [ -e "${VENDOR_RAMDISK_BINARY}" ]; then
cp "${VENDOR_RAMDISK_BINARY}" "${DIST_DIR}/ramdisk.${RAMDISK_EXT}"
- elif [ "${#MKBOOTIMG_RAMDISK_DIRS[@]}" -gt 0 ]; then
+ elif [ "${#MKBOOTIMG_RAMDISK_DIRS[@]}" -gt 0 ] || [ "${#MKBOOTFS_ARGS[@]}" -gt 0 ]; then
MKBOOTIMG_RAMDISK_CPIO="${MKBOOTIMG_STAGING_DIR}/ramdisk.cpio"
- mkbootfs "${MKBOOTIMG_RAMDISK_DIRS[@]}" >"${MKBOOTIMG_RAMDISK_CPIO}"
+ mkbootfs "${MKBOOTIMG_RAMDISK_DIRS[@]}" "${MKBOOTFS_ARGS[@]}" >"${MKBOOTIMG_RAMDISK_CPIO}"
${RAMDISK_COMPRESS} "${MKBOOTIMG_RAMDISK_CPIO}" >"${DIST_DIR}/ramdisk.${RAMDISK_EXT}"
fi
diff --git a/kleaf/impl/image/boot_images.bzl b/kleaf/impl/image/boot_images.bzl
index e297bc11..5ba91528 100644
--- a/kleaf/impl/image/boot_images.bzl
+++ b/kleaf/impl/image/boot_images.bzl
@@ -65,6 +65,7 @@ def _boot_images_impl(ctx):
]
inputs += ctx.files.deps
inputs += ctx.files.vendor_ramdisk_binaries
+ inputs += ctx.files.vendor_ramdisk_dev_nodes
transitive_inputs = [
kernel_build_outs,
@@ -117,6 +118,13 @@ def _boot_images_impl(ctx):
vendor_ramdisk_binaries = " ".join([file.path for file in ctx.files.vendor_ramdisk_binaries]),
)
+ if ctx.files.vendor_ramdisk_dev_nodes:
+ command += """
+ VENDOR_RAMDISK_DEV_NODES="{vendor_ramdisk_dev_nodes}"
+ """.format(
+ vendor_ramdisk_dev_nodes = " ".join([file.path for file in ctx.files.vendor_ramdisk_dev_nodes]),
+ )
+
command += """
# Create and restore DIST_DIR.
# We don't need all of *_for_dist. Copying all declared outputs of kernel_build is
@@ -241,6 +249,7 @@ Execute `build_boot_images` in `build_utils.sh`.""",
* If `None`, skip `vendor_boot`.
""", values = ["vendor_boot", "vendor_kernel_boot"]),
"vendor_ramdisk_binaries": attr.label_list(allow_files = True),
+ "vendor_ramdisk_dev_nodes": attr.label_list(allow_files = True),
"unpack_ramdisk": attr.bool(
doc = """ When false it skips unpacking the vendor ramdisk and copy it as
is, without modifications, into the boot image. Also skip the mkbootfs step.
diff --git a/kleaf/impl/image/kernel_images.bzl b/kleaf/impl/image/kernel_images.bzl
index 88027f67..1de3eff5 100644
--- a/kleaf/impl/image/kernel_images.bzl
+++ b/kleaf/impl/image/kernel_images.bzl
@@ -52,6 +52,7 @@ def kernel_images(
modules_blocklist = None,
modules_options = None,
vendor_ramdisk_binaries = None,
+ vendor_ramdisk_dev_nodes = None,
system_dlkm_fs_type = None,
system_dlkm_fs_types = None,
system_dlkm_modules_list = None,
@@ -289,6 +290,9 @@ def kernel_images(
```
# do not sort
```
+ vendor_ramdisk_dev_nodes: List of dev nodes description files
+ which describes special device files to be added to the vendor
+ ramdisk. File format is as accepted by mkbootfs.
ramdisk_compression: If provided it specfies the format used for any ramdisks generated.
If not provided a fallback value from build.config is used.
Possible values are `lz4`, `gzip`, None.
@@ -467,6 +471,7 @@ def kernel_images(
initramfs = ":{}_initramfs".format(name) if build_initramfs else None,
mkbootimg = mkbootimg,
vendor_ramdisk_binaries = vendor_ramdisk_binaries,
+ vendor_ramdisk_dev_nodes = vendor_ramdisk_dev_nodes,
build_boot = build_boot,
vendor_boot_name = vendor_boot_name,
unpack_ramdisk = unpack_ramdisk,