Skip to content

Commit ad2dfe1

Browse files
Treehugger Robotandroid-build-merge-worker-robot
authored andcommitted
Merge "releasetools: system_dlkm: add image to dist zip" am: ef8f442 am: e97ae10 am: 537cb49 am: 0eba8f0
Original change: https://android-review.googlesource.com/c/platform/build/+/1958309 Change-Id: I1e3c9f5e896b87ca48deccc4619a352d133db467
2 parents 7de906b + 0eba8f0 commit ad2dfe1

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tools/releasetools/add_img_to_target_files.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ def AddImagesToTargetFiles(filename):
761761
has_boot = OPTIONS.info_dict.get("no_boot") != "true"
762762
has_init_boot = OPTIONS.info_dict.get("init_boot") == "true"
763763
has_vendor_boot = OPTIONS.info_dict.get("vendor_boot") == "true"
764+
has_system_dlkm = OPTIONS.info_dict.get("system_dlkm") == "true"
764765

765766
# {vendor,odm,product,system_ext,vendor_dlkm,odm_dlkm, system, system_other}.img
766767
# can be built from source, or dropped into target_files.zip as a prebuilt blob.
@@ -831,6 +832,19 @@ def banner(s):
831832
if output_zip:
832833
init_boot_image.AddToZip(output_zip)
833834

835+
if has_system_dlkm:
836+
banner("system_dlkm")
837+
system_dlkm_image = common.GetSystemDlkmImage(
838+
"IMAGES/system_dlkm.img", "system_dlkm.img", OPTIONS.input_tmp, "SYSTEM_DLKM")
839+
if system_dlkm_image:
840+
partitions['system_dlkm'] = os.path.join(OPTIONS.input_tmp, "IMAGES", "system_dlkm.img")
841+
if not os.path.exists(partitions['system_dlkm']):
842+
system_dlkm_image.WriteToDir(OPTIONS.input_tmp)
843+
if output_zip:
844+
system_dlkm_image.AddToZip(output_zip)
845+
else:
846+
logger.error("Couldn't locate system_dlkm.img; skipping...")
847+
834848
if has_vendor_boot:
835849
banner("vendor_boot")
836850
vendor_boot_image = common.GetVendorBootImage(

tools/releasetools/common.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,23 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir,
18351835
return File(name, data)
18361836
return None
18371837

1838+
def GetSystemDlkmImage(name, prebuilt_name, unpack_dir, tree_subdir,
1839+
info_dict=None):
1840+
"""Return a File object with the desired system dlkm image.
1841+
Look for it under 'unpack_dir'/IMAGES or 'unpack_dir'/PREBUILT_IMAGES.
1842+
"""
1843+
1844+
prebuilt_path = os.path.join(unpack_dir, "IMAGES", prebuilt_name)
1845+
if os.path.exists(prebuilt_path):
1846+
logger.info("Using prebuilt %s from IMAGES...", prebuilt_name)
1847+
return File.FromLocalFile(name, prebuilt_path)
1848+
1849+
prebuilt_path = os.path.join(unpack_dir, "PREBUILT_IMAGES", prebuilt_name)
1850+
if os.path.exists(prebuilt_path):
1851+
logger.info("Using prebuilt %s from PREBUILT_IMAGES...", prebuilt_name)
1852+
return File.FromLocalFile(name, prebuilt_path)
1853+
1854+
return None
18381855

18391856
def _BuildVendorBootImage(sourcedir, info_dict=None):
18401857
"""Build a vendor boot image from the specified sourcedir.

0 commit comments

Comments
 (0)