Commit graph

2954 commits

Author SHA1 Message Date
Yo Chiang
1d1571e543 Merge "Support building recovery as standalone ramdisk in vendor_boot v4" 2021-04-15 04:02:15 +00:00
Yo Chiang
7a8965c1fb Merge "Support installing modules.options file" 2021-04-13 09:20:24 +00:00
Yo Chiang
71c7048593 Merge "Strip whitespace from INTERNAL_VENDOR_RAMDISK_FRAGMENTS" 2021-04-12 03:33:37 +00:00
Yi-Yo Chiang
378b77929f Strip whitespace from INTERNAL_VENDOR_RAMDISK_FRAGMENTS
aosp/1664081 introduces a bug where if BOARD_VENDOR_RAMDISK_FRAGMENTS is
empty, then INTERNAL_VENDOR_RAMDISK_FRAGMENTS would become " " (single
whitespace).
Just unconditionally $(strip ...) the variable to remove any extra
whitespace.

Bug: 183395459
Test: m dist and check *-target_files-*.zip
Change-Id: Ic842756f3a64c073593592d22c980820664e11c1
2021-04-09 12:32:41 +00:00
Yi-Yo Chiang
12f92447a5 Support building recovery as standalone ramdisk in vendor_boot v4
If BOARD_BOOT_HEADER_VERSION >= 4,
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is true and
BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT is true, then build
recovery as a standalone ramdisk fragment in vendor_boot image.

The recovery ramdisk would be a vendor ramdisk fragment packaged in
vendor_boot, whose ramdisk_name is "recovery" and ramdisk_type is
"VENDOR_RAMDISK_TYPE_RECOVERY".

Bootloader can omit loading the recovery ramdisk during normal boot to
optimize the size of the initramfs.

Bug: 183395459
Test: Presubmit
Test: Modify BoardConfig of CF and m dist. Verify the vendor_boot.img
  with unpack_bootimg.
Test: Strip the vendor_boot of the recovery ramdisk, and verify that CF
  can boot to normal boot without the recovery ramdisk.
Change-Id: I6e9a2781ec87aece10d4844fa18bbe9a7b4674e6
2021-04-09 12:47:00 +08:00
Colin Cross
df682c6fe1 Merge "Package jacoco and proguard files out of a PACKAGING directory" 2021-04-08 17:17:53 +00:00
Colin Cross
330b1fef31 Package jacoco and proguard files out of a PACKAGING directory
Package jacoco-report-classes.jar, proguard_usage.zip and
proguard_dictionary out of directories in $OUT/obj/PACKAGING
so that they get cleared by m installclean.  This will make
incremental builds that package these files accurate as long
as installclean was run, which is much faster than a full clean
build.

Bug: 184583915
Test: m TARGET_BUILD_APPS=DeskClock EMMA_INSTRUMENT=true dist
Change-Id: I60c6a0fec1fbce26eab8d5adab25a2231b48e251
2021-04-07 18:52:02 -07:00
Rupert Shuttleworth
90eeff54ea Merge "Mark prop file as writable before writing to it." 2021-04-07 12:40:34 +00:00
Treehugger Robot
d641585484 Merge "Builds boot-test-harness.img, if INSTALLED_BOOTIMAGE_TARGET." 2021-04-07 02:05:36 +00:00
Rupert Shuttleworth
3993af706c Mark prop file as writable before writing to it.
Test: Fixes USE_BAZEL=1 m builds.
Change-Id: I1e0fb448049ff21cd32541af56e856442bc25fa7
2021-04-07 01:22:00 +00:00
Yo Chiang
bebc8a35ef Merge "Refactor vendor_boot v4 build logic and add more checks" 2021-04-06 09:02:14 +00:00
Bowgo Tsai
1ed0fd54dc Builds boot-test-harness.img, if INSTALLED_BOOTIMAGE_TARGET.
Similar to commit Ic887ea93d4c5181eca0f82c3cdf3ce3b72f4c185
for boot-debug.img, we should also only build boot-test-harness.img
if boot.img exists.

Bug: 184365242
Test: tree hugger

Change-Id: Ie0d9e460905d488e418cf4ee1bd44e6e7c58470d
2021-04-06 08:20:15 +00:00
Yo Chiang
b5bff9a4d3 Merge "Fix Makefile formatting" 2021-04-06 07:27:44 +00:00
Yi-Yo Chiang
9c461365de Fix Makefile formatting
Add indent to if-block so my text editor stop complaining.

Test: Presubmit
Change-Id: Ie3f4dbd114d894453bf46a91b47d5d0450e5e1e7
2021-04-05 12:49:17 +08:00
Yi-Yo Chiang
6c7e02e74e Support installing modules.options file
Usage:
```
BOARD_(VENDOR|VENDOR_RAMDISK)_KERNEL_MODULES_OPTIONS_FILE(_ver) := \
  $(wildcard <path of modules.options in source tree>)
```

Then the modules.options would be installed as
(vendor_dlkm|vendor_ramdisk)/lib/modules/(ver/)modules.options.

Also fix bug where the kernel version subdir is missing when generating
modules.blocklists file.

Bug: 182417593
Bug: 184238876
Test: Create a options file with incorrect syntax, verify build fails
Test: Verify the new macro indeed installs the options file
Change-Id: I7ba56e9dd8d73055bc276446c385a8d79080c2a6
2021-04-04 14:25:47 +00:00
Yi-Yo Chiang
1519d4351e Refactor vendor_boot v4 build logic and add more checks
Add more checks around BOARD_BOOT_HEADER_VERSION in board_config.mk.

Refactor generation logic of vendor_boot ramdisk fragments.
Consolidate initialization and validation check to its own section.
Adjust some variable names and initialization sequence so the follow-up
change can land more cleanly.
Rename variable name "dir" so that it don't collide with the Makefile
function "$(dir ...)".

Bug: 183395459
Test: Presubmit; Change should be no-op with respect to build artifacts.
Test: Modify BoardConfig of CF and m dist. Verify the vendor_boot.img
  with unpack_bootimg.
Change-Id: I8785c40dd9f87f3797a56ada93e65939d27d0e9b
2021-04-04 20:40:17 +08:00
Yifan Hong
3e061bd1c8 Fix builds with enforce_vintf_kernel + !kernel
If a build has PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
set (which is set for P+ builds) but no kernel is built,
the original code emits a warning, but it won't be able
to build target files package because it depends on
kernel_configs.txt and kernel_version.txt without any rules.

Properly clear BUILT_KERNEL_CONFIGS_FILE and BUILT_KERNEL_VERSION_FILE
so that it won't be depended on in this case.

Bug: 184128489
Test: TH + forrest

Change-Id: I4b8fbd117f114555cf606e3c3b48eb564dbe786b
2021-04-02 16:19:01 -07:00
Yo Chiang
e86bab474b Revert^2 "Add option to allow product makefiles to skip building s..."
This reverts commit ccfea17fb7.

Reason for revert: Original bug was resolved by updating branch config

Change-Id: I2327092261a2147fa8f2be3d878db04228e65511
2021-03-25 10:12:28 +00:00
Tianjie Xu
ccfea17fb7 Revert "Add option to allow product makefiles to skip building s..."
Revert submission 1644988-nextgen-release-img-zip-cleanup

Reason for revert: b/183654818
Reverted Changes:
I2474e5fd6:Nextgen release: Don't build super_empty.img
I549439528:Add option to allow product makefiles to skip buil...

Change-Id: I711d1c288eed17686b048144d8d41c0fdd5cd8e1
2021-03-25 05:00:12 +00:00
Yi-Yo Chiang
ba959a5ff1 Add option to allow product makefiles to skip building super_empty.img
This change doesn't change the condition for building super_empty.img,
it just add a toggle PRODUCT_BUILD_SUPER_EMPTY_IMAGE that product
makefiles can use to skip building super_empty.img.
Products that don't use super_empty at all, for example GSI, can set
this option to ensure the super_empty.img is not built.

Bug: 183068624
Test: "m dist" on GSI and check the build artifacts under OUT and DIST
  directories, and check the contents of *-img-*.zip
Change-Id: I54943952873d2d297fd9d18cbe14742bc12ae9c6
2021-03-24 05:35:10 +00:00
Treehugger Robot
30f09a1a2e Merge "Support GKI boot.img v4 signing" 2021-03-23 00:24:33 +00:00
Yifan Hong
93ccefb210 Merge "Extracting kernel should not depend on system/vendor build." 2021-03-19 22:00:15 +00:00
Yifan Hong
c0f904e069 Extracting kernel should not depend on system/vendor build.
If system and vendor are built separately, none of the two
builds contained kernel information. The process of extracting
kernel information shouldn't depend on system and vendor
builds, but on the existance of the kernel image.

With this change, one of system or vendor build may have
INSTALLED_KERNEL_IMAGE defined and the other has
PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS defined. The one
with INSTALLED_KERNEL_IMAGE defined will contain kernel information
in target files.

After target files are merged, check_target_files_vintf will kick
in to do the checks properly.

Test: forrest
Bug: 180475190
Change-Id: I8d887dd94e1171ab277f02f25534caf098e3faae
2021-03-19 12:50:38 -07:00
Bowgo Tsai
27c39b0af2 Support GKI boot.img v4 signing
Commit I9967d06bde0e18a12b84b5b0b568db09765fe305 supports adding a
generic boot_signature into boot.img v4. This change allows replacing
the boot_signture signing key with a release key during the release
process.

The default GKI signing key can be specified in a BoardConfig.mk via:

  BOARD_GKI_SIGNING_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
  BOARD_GKI_SIGNING_ALGORITHM := SHA256_RSA2048
  BOARD_GKI_SIGNING_SIGNATURE_ARGS := --prop foo:bar

The release signing key/algorithm can be specified by the following options
when invoking sign_target_files_apks:

  --gki_signing_key=external/avb/test/data/testkey_rsa4096.pem
  --gki_signing_algorithm=SHA256_RSA4096

Additional arguments for generating the GKI signature can be
specified as below:

  --gki_signing_extra_args="--prop gki:prop1 --prop gki:prop2"

Bug: 177862434
Test: make dist
Test: sign_target_files_apks \
        --gki_signing_key=external/avb/test/data/testkey_rsa4096.pem \
        --gki_signing_algorithm=SHA256_RSA4096 \
        --gki_signing_extra_args="--prop gki:prop1 --prop gki:prop2" \
        ./out/dist/*-target_files-eng.*.zip signed.zip
Test: Checks GKI boot_signature is expected after signing:
      `unzip signed.zip IMAGES/boot.img`
      `unpack_bootimg --boot_img IMAGES/boot.img --out unpack`
      `avbtool info_image --image unpack/boot_signature`
Test: unit test: releasetools_test and releasetools_py3_test

Change-Id: I61dadbc242360e4cab3dc70295931b4a5b9422a9
2021-03-19 17:11:04 +08:00
Yifan Hong
2b4d131e15 Merge "Add PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS to check_vintf_compatible_log" 2021-03-17 18:30:48 +00:00
Treehugger Robot
c2643ead16 Merge "check_all_partition_sizes_log -> .log" 2021-03-12 06:57:08 +00:00
Yifan Hong
d11953c3b7 check_all_partition_sizes_log -> .log
So that it can be viewed directly in the web browser.
Test: pass

Change-Id: Ic90a5d1511153a74726f1bdee5d9a058756f2d19
2021-03-11 14:47:59 -08:00
Petri Gynther
3296b3136e Merge changes I899810c7,If73b15d7
* changes:
  Add vendor_dlkm, odm, odm_dlkm to dynamic partition filter
  Fix typo: DLKIMMAGE
2021-03-11 20:00:25 +00:00
Petri Gynther
345294f459 Merge changes Ibac6424f,Ief572e30
* changes:
  Copy vendor_ramdisk[-debug].img to out/dist
  Add support for building vendor_ramdisk-debug.img
2021-03-11 19:55:02 +00:00
Petri Gynther
09865a4911 Add vendor_dlkm, odm, odm_dlkm to dynamic partition filter
When building images in -without-vendor clients, we need to filter out:
vendor, vendor_dlkm, odm, odm_dlkm

from the dynamic partitions list for the OTA image build to succeed.

Bug: 173653839
Bug: 182319837
Test: add vendor_dlkm, odm, odm_dlkm to dynamic partitions + make dist
Change-Id: I899810c7f46e40730280d89b94047779705b6e2f
2021-03-10 21:34:07 -08:00
Petri Gynther
689e11a7ce Fix typo: DLKIMMAGE
Fix two typos in Makefile.

It turns out that BOARD_ODM_VENDOR_DLKMIMAGE is not correct.
Need to replace it with BOARD_PREBUILT_ODM_DLKMIMAGE.

Test: use grep to check usage
Change-Id: If73b15d7abb7504aa313d616f6cef2d80d76705d
2021-03-10 21:07:41 -08:00
Yifan Hong
80ab21490b Add PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS to check_vintf_compatible_log
If kernel checks are missing, this can tell
us explicitly that the flag was disabled.

Test: pass
Change-Id: If5de88edbf352c163bc725c3e02a8cd29312e7f5
2021-03-10 18:10:13 -08:00
Treehugger Robot
3eca99ee7a Merge "VINTF logs ends in .log suffix." 2021-03-11 02:07:23 +00:00
Petri Gynther
d7946d13f0 Add support for building vendor_ramdisk-debug.img
Existing BoardConfig.mk variable:
BOARD_BUILD_VENDOR_RAMDISK_IMAGE := true

generates:
out/target/product/<name>/vendor_ramdisk.img

Extend the above to additionally generate:
out/target/product/<name>/vendor_ramdisk-debug.img

as the two ramdisks should be built together.

Test: make
Change-Id: Ief572e30c9225d0f5569e9ff89096c69accafc7f
2021-03-10 13:22:29 -08:00
Devin Moore
2e43e34d53 Throw an error if androidboot.hardware is used for bootconfig
Bootconfig does not allow the keys to have values and subkeys at the
same time.
"androidboot.hardware" and "androidboot.hardware.*" subkeys have existed as
kernel cmdline parameters. We want to throw an error at build time when
"androidboot.hardware" is use in bootconfig because it may be a common
occurence while migrating to bootconfig.
"hardware" should be used instead, without the "androidboot" prefix.

Test: build with and without "androidboot.hardware=test" in
BOARD_BOOTCONFIG
Bug: 173815685

Change-Id: Ic62a86cb23c9d79dbdbacd18eed3449210566ce7
2021-03-09 16:59:33 -08:00
Yifan Hong
fd150d3dcc VINTF logs ends in .log suffix.
This is so that it can be viewed in the web
browser directly.

Test: pass
Change-Id: Ib35a93ab6beac550a593ec46814100ff851f32a5
2021-03-09 12:19:33 -08:00
Petri Gynther
728e0bd468 Cleanup: fileslist target commands
Remove unnecessary @ and $(hide) from fileslist target commands.
Keep @echo to print that line with a progress bar [ x% x/y ].

Test: make
Change-Id: I65c0c3c9c045cc7ca2c2801ee6b3b0c996be59a9
2021-03-08 14:12:35 -08:00
Petri Gynther
4c063e33c8 Cleanup: ram disk -> ramdisk
Test: make
Change-Id: I61740a309c6637c10b935806f7b379cfaf3ae855
2021-03-07 00:52:46 -08:00
Petri Gynther
6a6d6217d7 Cleanup: internal vendor ramdisk targets
Test: make
Change-Id: I356e82ab9b32164ff734567f489faf31021dfc4b
2021-03-07 00:51:40 -08:00
Petri Gynther
828828ba07 Add support for building vendor_ramdisk.img
Allow BoardConfig.mk to set:
BOARD_BUILD_VENDOR_RAMDISK_IMAGE := true

to build:
out/target/product/<name>/vendor_ramdisk.img

This is done to support GKI device kernel development.

Kernel developers build vmlinux + DTB + GKI kernel modules locally
and then use kernel build tools to output:

* vmlinux + ramdisk.img => boot.img
* GKI kernel modules + DTB + vendor_ramdisk.img => vendor_boot.img

In other words, kernel developers use ramdisk.img and vendor_ramdisk.img
as prebuilts for building flashable boot.img and vendor_boot.img
directly from the kernel development environment.

Test: make vendorramdisk with BOARD_BUILD_VENDOR_RAMDISK_IMAGE := true
Test: make vendorramdisk with BOARD_BUILD_VENDOR_RAMDISK_IMAGE omitted
Change-Id: Id67839887b6bf608f4a5f13384c551c12ee9fdbd
2021-03-05 17:45:03 -08:00
Treehugger Robot
5d8217afb7 Merge "Fix m bootimage_test_harness failure" 2021-03-05 15:03:39 +00:00
Bowgo Tsai
f85e68f554 Fix m bootimage_test_harness failure
Commit I66b57de91042bfd56ba54a3659843d8cf7873955 added the support
for different boot partition sizes but didn't consider the case of
building boot-test-harness.img. This CL fixes this by allowing
'boot-test-harness.img' as a boot image variant.

Bug: 181618515
Test: `m bootimage_test_harness` pass
Change-Id: I190d3bf26725ac54999758efbca66a94c5cd5c86
2021-03-04 14:41:16 +08:00
Petri Gynther
dc24d88aa9 Rename vendor-ramdisk to vendor_ramdisk
Rename to get consistent ramdisk directory naming in
out/target/product/<name>:
  debug_ramdisk
  ramdisk
  vendor_debug_ramdisk
  vendor_ramdisk

Test: build and inspect out/target/product/<name>
Change-Id: I81d8f2cafe5e1b9024196cd74772b78d4a4aec58
2021-03-03 13:56:48 -08:00
Treehugger Robot
0e0307b0a2 Merge "Add dependency from target-files.zip to rsync'd recovery ramdisk files" 2021-02-25 06:03:01 +00:00
Colin Cross
e643120c75 Add dependency from target-files.zip to rsync'd recovery ramdisk files
target-files.zip may indirectly depend on the rsync'd recovery ramdisk
files when BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is true.

Bug: 181095653
Test: manual
Change-Id: I673bb48b1fbb7a54455cda411f9444f05ddaa24f
2021-02-24 11:44:55 -08:00
Devin Moore
fd4f3c4c63 Merge "Support vendor bootconfig creation" 2021-02-24 15:56:48 +00:00
Daniel Norman
48603ff158 Creates a combined split-sepolicy file in merge_target_files.py.
This follows the same steps as OpenSplitPolicy() in
system/core/init/selinux.cpp on the device.

Bug: 178864050
Test: merge_target_files for R+S and S+S devices
Test: test_merge_target_files
Change-Id: Ia41a436bfda8e2cb65706122f0ff3805b99d16e1
2021-02-23 11:41:29 -08:00
Devin Moore
50509015bf Support vendor bootconfig creation
Gather all BOARD_BOOTCONFIG parameters.
Create vendor-bootconfig.img with parameters seperated by newlines. Pass
that file to mkbootimg as --vendor_bootconfig to add it to the
vendor_boot.img.

Test: Add BOARD_BOOTCONFIG parameters in cuttlefish .mk file
      Check vendor-bootconfig.img for expected output
      Verify expected vendor_boot.img format with:
      unpack_bootimg --boot_image vendor_boot.img
Test: Update Cuttlefish bootloader to handle the new vendor_boot.img and
      check /proc/bootconfig for the expexted parameters.
Bug: 173815685
Change-Id: Iaa9b71b4bc64375777a5353396e83bb2beb25c47
2021-02-23 07:42:05 -08:00
Yo Chiang
b84604198c Merge "Kernel modules: add modules.blocklist build support" 2021-02-15 06:45:57 +00:00
Treehugger Robot
bff5273dd0 Merge "Adding repack_bootimg into otatools.zip" 2021-02-06 08:00:55 +00:00