aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Song <denniscy@google.com>2024-02-29 13:00:28 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-02-29 13:00:28 +0000
commitf5341adc0cd71d1cb2a8ccb5a9fae0a102ea6180 (patch)
tree31974cd656c38c89060b3baea66bba2c8db529c5
parent707563d47980d0751ae072fa90d8b1762f182025 (diff)
parentfa55c6d3a6319fef503d1d26af4b9657d0dfa2c8 (diff)
downloadtreble-f5341adc0cd71d1cb2a8ccb5a9fae0a102ea6180.tar.gz
Generate vendor_boot-chd_debug.img while building CHD am: fa55c6d3a6
Original change: https://android-review.googlesource.com/c/platform/tools/treble/+/2969433 Change-Id: I59e697dfbac9a6a01bf864ef7725c76e00da5fdd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--cuttlefish/Android.bp23
-rw-r--r--cuttlefish/build_cf_hybrid_device.py32
2 files changed, 38 insertions, 17 deletions
diff --git a/cuttlefish/Android.bp b/cuttlefish/Android.bp
index 1427963..49a8ad9 100644
--- a/cuttlefish/Android.bp
+++ b/cuttlefish/Android.bp
@@ -17,18 +17,19 @@ package {
}
python_library_host {
- name: "build_chd_lib",
- srcs: [
- "build_chd_utils.py",
- ],
+ name: "build_chd_lib",
+ srcs: [
+ "build_chd_debug_ramdisk.py",
+ "build_chd_utils.py",
+ ],
}
python_binary_host {
- name: "build_cf_hybrid_device",
- srcs: [
- "build_cf_hybrid_device.py",
- ],
- libs: [
- "build_chd_lib",
- ],
+ name: "build_cf_hybrid_device",
+ srcs: [
+ "build_cf_hybrid_device.py",
+ ],
+ libs: [
+ "build_chd_lib",
+ ],
}
diff --git a/cuttlefish/build_cf_hybrid_device.py b/cuttlefish/build_cf_hybrid_device.py
index 3fb98fd..0207dc3 100644
--- a/cuttlefish/build_cf_hybrid_device.py
+++ b/cuttlefish/build_cf_hybrid_device.py
@@ -20,9 +20,8 @@ import os
import subprocess
import tempfile
-from build_chd_utils import copy_files
-from build_chd_utils import merge_chd_sepolicy
-from build_chd_utils import unzip_otatools
+from build_chd_debug_ramdisk import add_debug_ramdisk_files
+from build_chd_utils import copy_files, merge_chd_sepolicy, unzip_otatools
"""Test command:
@@ -107,15 +106,36 @@ def run(temp_dir):
# merge CHD debug sepolicy
# TODO (b/315474132): remove this when the CHD sepolicy issue is resolved.
+ chd_sepolicy = None
try:
- merge_chd_sepolicy(framework_target_files, vendor_target_files, otatools,
- args.output_dir)
+ chd_sepolicy = merge_chd_sepolicy(
+ framework_target_files, vendor_target_files, otatools, args.output_dir)
except Exception as error:
- print(f'Warning cannot generate chd_merged_sepolicy: {error}')
+ print(f'Warning - cannot generate chd_merged_sepolicy: {error}')
# copy files
copy_files(args.copy_file, args.output_dir)
+ # build the CHD vendor boot debug image by adding chd_sepolicy and
+ # chd_debug_prop (if present) into the Cuttlefish's vendor_boot-debug.img.
+ files_to_add = []
+ if chd_sepolicy and os.path.exists(chd_sepolicy):
+ files_to_add.append(f'{chd_sepolicy}:precompiled_sepolicy')
+ chd_debug_prop = os.path.join(args.output_dir, 'chd_debug.prop')
+ if os.path.exists(chd_debug_prop):
+ # rename the debug prop file as `adb_debug.prop` because this is the
+ # file name that property init expects.
+ files_to_add.append(f'{chd_debug_prop}:adb_debug.prop')
+
+ cf_debug_img = os.path.join(args.output_dir, 'vendor_boot-debug.img')
+ if files_to_add and os.path.exists(cf_debug_img):
+ chd_debug_img = os.path.join(args.output_dir, 'vendor_boot-chd_debug.img')
+ try:
+ add_debug_ramdisk_files(
+ cf_debug_img, files_to_add, otatools, temp_dir, chd_debug_img)
+ except Exception as error:
+ print(f'Warning - cannot build {chd_debug_img}: {error}')
+
if __name__ == '__main__':
with tempfile.TemporaryDirectory() as temp_dir: