Commit graph

2999 commits

Author SHA1 Message Date
Pierre-Clément Tosi
d8248af3c8 Add pvmfw.img to IMAGES for BUILT_TARGET_FILES_PKG
Package the image even if it was built (previously, only the pre-built
version was being included).

Bug: 199717422
Test: m ${ANDROID_PRODUCT_OUT}/pvmfw.img
Change-Id: Ifb68ad571be78434f815307a5e4939222a28e7b7
2021-10-07 12:18:17 +02:00
Dan Willemsen
616e7fd9b6 Stop disting monolithic SDK for Mac SDK builds
The Mac SDK build is being reduced to just the build-tools and
platform-tools packages. I'm still working on refactoring those builds
not to require the monolithic SDK to be built first, but we can at least
stop distributing it (and other related files) now.

Most of these checks can likely go away once the build refactor is
complete, since we'll be able to move away from the `sdk` target to
something more specific. Right now there's a lot of logic around sdk
being in MAKECMDGOALS that I don't want to unravel with the current
build logic.

Bug: 187222815
Change-Id: I1f711ce063170e41078ad4a125bcd77340a1746c
2021-09-16 14:54:38 -07:00
Treehugger Robot
a83a19d41e Merge "Skip building boot-(test-harness|debug).img if not needed" 2021-09-14 09:09:56 +00:00
Bowgo Tsai
4bb4d1fb91 Skip building boot-(test-harness|debug).img if not needed
boot-(test-harness|debug).img is not needed for devices with
a /vendor_boot partition. They can use vendor_boot-(test-harness|debug).img
instead.

Bug: 196001476
Test: make then checks $OUT/*.img
Change-Id: If76df0329c96f718ebf0a0ac138cde3ae859a6c6
2021-09-09 19:04:55 +08:00
David Anderson
9e95a02a87 Don't sparse right-sized ext4 and erofs images.
When we introduced Dynamic Partitions, we stopped giving readonly
partitions fixed sizes. In addition we introduced deduplication for
ext4. These two factors greatly reduce the impact of sparse images,
since there aren't many fill blocks to optimize.

This patch disables sparsing for images that are rightsized and do not
explicitly specify extra reserved space. This makes the images a little
easier to work with from an engineering perspective. They no longer have
to be unsparsed to interact with any tooling. It also eases a potential
source of bugs, as b/184225422 is not reproducible with sparsing off.

On Pixel, the difference between the sparsed partitions and unsparsed is
12M (out of roughly 4G).

Bug: 198001223
Test: make, treehugger, make target-files-package
      dynamic partitions are no longer sparse images
Change-Id: I74459f8abe74a15a24ba5a40cf701e6af2db8179
2021-09-01 13:12:39 -07:00
David Anderson
d4bea32530 Merge "Fix generate-userimage-prop-dictionary getting called unnecessarily." 2021-08-30 23:17:16 +00:00
David Anderson
17063cfcb0 Fix generate-userimage-prop-dictionary getting called unnecessarily.
odm, odm_dlkm, vendor_dlkm call generate-userimage-prop-dictionary. This
appears to be inadvertent as it pulls in props from all the other
partitions. Instead, call generate-image-prop-dictionary which is
specific to one partition.

Bug: 198001223
Test: builds, treehugger green
Change-Id: Ib177c740068f1c087d517b363649551092038760
2021-08-27 16:50:30 -07:00
Saravana Kannan
d6dc4a1d3b Merge "Strip recovery kernel modules by default" 2021-08-27 19:30:15 +00:00
Mark-PK Tsai
8c54396580 Strip recovery kernel modules by default
Strip recovery kernel modules by default which make
recovery.img smaller.
Also, add BOARD_DO_NOT_STRIP_RECOVERY_MODULES to make
it configurable like vendor modules did.

Change-Id: Id4e8c88b91dad38afc1fec5eae83fcb29c825be3
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
2021-08-23 18:04:05 +08:00
Kelvin Zhang
b673bbfbb2 Add zucchini to otatools.zip
Zucchini is a new diffing algorithm we plan to add to Android OTA, add
it to otatools.zip first.

Bug: 194237829
Test: th
Change-Id: I9561101decc2d13afb0a8d4329c3ecc044c96c9d
2021-08-20 10:09:20 -07:00
Bowgo Tsai
23ae3dcbe1 Merge "Adding vendor_boot-test-harness.img" 2021-08-03 06:07:13 +00:00
Bowgo Tsai
87f60017b9 Adding vendor_boot-test-harness.img
boot-test-harness.img is used to allow adb root on user build
images. It also sets properties: ro.audio.silent=1 & ro.test_harness=1.

GKI 2.0 devices will use BOARD_PREBUILT_BOOTIMAGE so
boot-test-harness.img will not be generated.

Therefore, we have to introduce the vendor_boot-test-harness.img
as an alternative for boot-test-harness.img.

In the future, we'll simplify the flow as:
  + If a device has a /vendor_boot partition, builds
    vendor_boot-(test-harness|debug).img.
  + Otherwise, builds boot-(test-harness|debug).img.

boot-(test-harness|debug).img needs to be kept for some clients
to gracefully transit to using vendor_boot-(test-harness|debug).img.

Bug: 194654549
Test: make then `unpack_bootimg --boot_img $OUT/vendor_boot-test-harness.img`
Test: Check the ramdisk content in ./out/vendor_ramdisk

Change-Id: If3a1393b4ff3e69bb9b62f3b843b7858437d47bf
2021-07-30 00:54:47 +00:00
Sasha Smundak
0e4a5ad24b Trim spaces in the rule actions
When rule action contains something like
  cp $(FOO) ...
and FOO is set with
FOO := a \
 b \

the generated Ninja file constains extra spaces, making it
difficult to compare it to the same file generated by the
Starlark-based product configuration.

Bug: 181797530
Test: manual
Change-Id: I278bd8edf0f017a31c5b5115b2a38f4f663c55fc
2021-07-29 10:57:06 -07:00
Jose Galmes
9c8f6eb7e1 Support for dexopt postprocessing in merge_target_files.
When using the VSDK, dexopt is not applied during the vendor build.
To avoid a first-boot time regression, dexopt is applied during the
merge stage, by running dexopt on the vendor apps and rebuilding
the vendor image.

Bug: 188179859
Test: Tested in keystone with VSDK target
Change-Id: Ie8e2d0a82850a2901fa6f250433bcbb43f0a97f2
2021-07-22 13:39:10 -07:00
Yifan Hong
ecef6fa224 Merge changes from topic "ota-package-nonab"
* changes:
  Only build OTA package for non-A/B with recovery
  Reland "Build OTA when boot image exists even without kernel or recovery fstab"
2021-07-20 02:59:47 +00:00
Yifan Hong
f32f65c5a4 Only build OTA package for non-A/B with recovery
Change Id397ad097539 alone would break hikey build, which
is a non-A/B device with a boot image, but without recovery.

Do not build OTA in this case.

Test: lunch hikey && m dist
Fixes: 194018054
Bug: 193588301
Change-Id: I8d09ad5c62d44699eb910ff62d32044bd97e8e44
2021-07-19 10:38:25 -07:00
Yifan Hong
8c1e526fdd Reland "Build OTA when boot image exists even without kernel or recovery fstab"
This reverts commit bf77787cc9.

Reason for revert: relanding change

Test: see next CL
Bug: 193925883
Bug: 193588301

Change-Id: Id397ad0975390617bd277573f2cdba9a2677842d
2021-07-19 10:38:25 -07:00
Yifan Hong
fa26e5b8db Merge "Revert "Build OTA when boot image exists even without kernel or recovery fstab"" 2021-07-19 16:33:26 +00:00
Yifan Hong
bf77787cc9 Revert "Build OTA when boot image exists even without kernel or recovery fstab"
This reverts commit ff2e24d6f9.

Reason for revert: breaks build

Bug: 194018054
Change-Id: Ia7f0436d21dc07143f7fae6f90a73bb4f730e98d
2021-07-19 16:28:49 +00:00
Yifan Hong
ff2e24d6f9 Build OTA when boot image exists even without kernel or recovery fstab
On devices with a prebuilt boot image, TARGET_NO_KERNEL
may be set to enable signing, etc. In this case we still
want to build the OTA package.

Test: m otapackage on a device with generic boot image
      (where TARGET_NO_KERNEL is set)
Bug: 193588301
Change-Id: I4e5adc3f42a516ac0e2f66c313dbe34a469ebe05
2021-07-15 12:57:47 -07:00
Yifan Hong
b1627779fb Also extract kernel configs from boot image.
On devices with prebuilt generic boot image:
  TARGET_NO_KERNEL := true
  BOARD_PREBUILT_BOOTIMAGE is set
In this case, the process for extracting the kernel
config and version must also try extracting from the
prebuilt boot image.

Test: build on device with prebuilt boot image
Fixes: 193588301
Change-Id: I43dd8e206bcd1c9f3f5f51869f126791c50af01a
2021-07-15 12:57:47 -07:00
Jeongik Cha
b26bf58e12 dexpreopt.config should be created even though unbundled image is built
Bug: 188179858
Test: compare dexpreopt_config.zip files from
 1. TARGET_BUILD_UNBUNDLED_IMAGE=true m dexpreopt_config_zip
 2. m dexpreopt_config_zip
(note that m clean should run between steps)

Change-Id: I92623b59e4fcac397c7fed3d7ab1070fe5281027
2021-07-14 18:52:01 +09:00
Jan Monsch
e147d481fe Removing AFTL integration from release tools.
Bug: 158639560
Test: Treehugger
Change-Id: I6949385e3448ad539099966c41ce99f156e3fdc4
2021-06-29 12:38:59 +00:00
Devin Moore
c92ebe14f2 Merge "Revert "Throw an error if androidboot.hardware is used for bootconfig"" 2021-06-21 18:22:31 +00:00
Devin Moore
5fe993f0cf Revert "Throw an error if androidboot.hardware is used for bootconfig"
This reverts commit 2e43e34d53.

The kernel bootconfig feature has been updated to handle mixed subkeys
and values, so androidboot.hardware is ok to use now.

Test: build and boot cuttlefish with 'hardware=cutf_vm'
Test: build and boot cuttlefish with 'androidboot.hardware=cutf_vm'
Bug: 191502832
Change-Id: I7c3f330a73abe6cf1fb7d14aaaa6cbc3e874a4aa
2021-06-18 13:42:48 -07:00
Inseob Kim
389d81d13e Merge changes from topic "init_first_stage_soong"
* changes:
  Add BUILD_USES_RECOVERY_AS_BOOT to soong config
  Directly create ramdisk dirs in ramdisk image rule
  Add BOARD_BUILD_SYSTEM_ROOT_IMAGE to config vars
2021-06-18 17:12:23 +00:00
Bill Peckham
d07e1c0077 Fix typo in droidcore-unbundled.
Test: manual inspection.
Bug: 191304308
Merged-In: Ie63d08acff0b9accfafd906a43bd18cbef5471a3
Change-Id: Ie63d08acff0b9accfafd906a43bd18cbef5471a3
2021-06-16 20:54:39 -07:00
Bill Peckham
16da01fe20 Introduce droidcore-unbundled target
The droidcore-unbundled target replaces the droidcore
target when TARGET_BUILD_UNBUNDLED_IMAGE=true. This
target is similar to droidcore in terms of dependencies,
but it has a smaller set of dist files. The intention is
to use TARGET_BUILD_UNBUNDLED_IMAGE=true with a
VSDK-using vendor build to supply Java dependencies from
prebuilts to avoid building (or needing) Java framework
sources.

Test: build with and without TARGET_BUILD_UNBUNDLED_IMAGE=true
Test: m nothing dist (before patch)
Test: m nothing dist (after patch)
Test: m nothing dist TARGET_BUILD_UNBUNDLED_IMAGE=true (after patch)
Test: examine ninja build graph for previous 3 tests
Bug: 188176942
Bug: 187064252
Merged-In: Ia7f8200c1bb1aaaa57c177d1698a114efe26bec7
Change-Id: Ia7f8200c1bb1aaaa57c177d1698a114efe26bec7
2021-06-16 09:10:07 -07:00
Inseob Kim
adcdb2fbda Directly create ramdisk dirs in ramdisk image rule
These directories have been created with post install cmds of
init_first_stage. To migrate init_first_stage to Soong, the directory
rules are now written directly in ramdisk image rule.

Bug: 187196593
Test: "m installclean; m" and see ramdisk output
Change-Id: Ic76c325ce102347f20b282572e3edbb5b4359aaf
2021-06-16 20:58:59 +09:00
Devin Moore
55af5065dc Add vendor-bootconfig.img to target-files-package
INTERNAL_VENDOR_BOOTCONFIG_TARGET is a required dependency of
target-files-package so it can be built from a clean build.

Test: rm -rf out/target/product && m target-files-package
Bug: 190329824
Change-Id: I9873aee3c9fb303d2ad245b5433d13eb76ab55f9
2021-06-09 13:19:13 -07:00
Jaegeuk Kim
1f50a36c62 Missing required packages for f2fs when building ota package
Bug: 171942852
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ib2ecc0cf88d71f358bd04e6c4ac129607fe4054c
2021-06-08 19:12:15 -07:00
Jaegeuk Kim
d56fb727ba Merge changes from topic "f2fs-system"
* changes:
  Enable f2fs compression for other partitions
  Enable --readonly for system compression
2021-05-27 18:42:28 +00:00
Tianjie Xu
f4ca0567dd Merge "Check super size for factory OTA at build time" 2021-05-26 21:33:14 +00:00
Jaegeuk Kim
1369654d8d Enable f2fs compression for other partitions
Bug: 171942852
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I231f7a2b808cc792fd582cd444825e4a47722984
2021-05-25 14:54:45 -07:00
Bowgo Tsai
cf9ead8972 Support AVB signing for BOARD_PREBUILT_BOOTIMAGE
Devices using GKI architecture will use a prebuilt boot.img.
However, we should still sign this prebuilt boot.img with
device-specific AVB keys.

Steps to test the CL.
1. In a device BoardConfig.mk:

   # Uses a prebuilt boot.img
   TARGET_NO_KERNEL := true
   BOARD_PREBUILT_BOOTIMAGE := device/google/redbull/boot.img

   # Enable chained vbmeta for the boot image.
   # The following can be absent, where the hash descriptor of the
   # 'boot' partition will be stored then signed in vbmeta.img instead.
   BOARD_AVB_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
   BOARD_AVB_BOOT_ALGORITHM := SHA256_RSA4096
   BOARD_AVB_BOOT_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
   BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION := 2

2. `make bootimage`, then `avbtool info_image --image $OUT/boot.img`,
    checks the image is re-signed with a device-specific key

3. `make dist` to generate out/dist/TF.zip

4. `unzip out/dist/TF.zip IMAGES/boot.img`

5. `avbtool info_image --image out/dist/IMAGES/boot.img`,
    checks the image is re-signed with a device-specific key

6. `sign_target_files_apks \
      --avb_boot_key=external/avb/test/data/testkey_rsa8192.pem \
      --avb_boot_algorithm=SHA256_RSA8192 \
      --avb_boot_extra_args="--prop test:sign" \
      ./out/dist/*-target_files-eng.*.zip signed.zip`, resign the TF.zip

7. `unzip signed.zip IMAGES/boot.img`, then use `avbtool info_image` to
   check the boot.img is re-signed with the --avb_boot_key in step 6.

Bug: 188485657
Test: above steps
Change-Id: I7ee8b3ffe6a86aaca34bbb7a8898a97b3f8bd801
2021-05-21 08:44:37 +00:00
Bowgo Tsai
640544bd96 BOARD_PREBUILT_BOOTIMAGE: removes the restriction of non system-as-root
Starting from Android 10, the system.img layout consists of
$TARGET_SYSTEM_OUT and $TARGET_ROOT_OUT, and is mounted by the
init as root. That is, system.img is always created as if
BOARD_BUILD_SYSTEM_ROOT_IMAGE was set.

  https://source.android.com/devices/bootloader/partitions/system-as-root

The previous concern is that there might be compatibility issues between
the ramdisk contained in boot.img with a newer system.img. But this is
no longer an issue after we always mount the system.img as root.

Bug: 187157581
Test: Tree Hugger
Change-Id: I4537e6ce6fb39b4b86caac82a13716abf515ffd6
2021-05-14 17:55:32 +08:00
Tianjie
294ec7d9e5 Check super size for factory OTA at build time
For VAB launched device, factory OTA will write system_other
partition to the super image. So we want to check that
sum(dynamic partitions) + system_other + overhead <= super at
build time.

Since we don't know the overhead at build time, we might instead
check sum(all partitions) < super.

Bug: 185809374
Test: m check-all-partition-sizes, unittests
Change-Id: Ia7ba5999d23924a1927e9a9463856a4d0ea90c20
2021-05-13 17:41:52 -07:00
Jeongik Cha
62519def7b Don't make dexpreopt_tools.zip when dex2oat isn't avilable
Test: m
Bug: 158843648
Change-Id: Iae90ea60fc73f1a6202499528277fce7c950d9d3
2021-05-13 13:29:39 +09:00
Jeongik Cha
2522c36b4c Target for tools to dexpreopt
Bug: 158843648
Test: m droidcore
Change-Id: I580e2b3285cc524234859998a0e4e072ecaef072
2021-05-12 23:28:49 +09:00
hamzeh
5dfe7a214b Add new target for building rust fuzzers for haiku
Test: make haiku-rust
Change-Id: I0badb5c0ae4138abdbd3f9a404e8883f70ceb503
2021-04-29 13:28:04 -07:00
Treehugger Robot
2c806a7c94 Merge "Moving debug ramdisk resources under / of the ramdisk" 2021-04-28 16:27:34 +00:00
Bowgo Tsai
610286a88f Moving debug ramdisk resources under / of the ramdisk
Currently the debug ramdisk resources might be under / or
/first_stage_ramdisk of the ramdisk, and is determined by
some BOARD variables, e.g., BOARD_USES_RECOVERY_AS_BOOT,
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT, etc.

To make a generic boot-debug.img that can work on both devices,
let's move the debug resources always under / of the ramdisk.

Bug: 186082603
Test: boot a device with boot-debug.img
Test: boot a device with vendor_boot-debug.img
Change-Id: I55dc8ff322f6b97e2d6dc1a4ee5935e863f2f835
2021-04-24 08:55:02 +08:00
Jeongik Cha
35bf6b0219 Copy dexpreopt.config only if it exists
Bug: 158843648
Test: m dist when global dexpreopt.config doesn't exist
Change-Id: Iaa8ec04624e16cecceed3f2065945a180a867b1c
2021-04-23 20:15:26 +09:00
Treehugger Robot
6edaa353b1 Merge "Store dexpreopt.config files to dexpreopt_config.zip" 2021-04-23 06:47:57 +00:00
Jeongik Cha
a8056d6cb9 Store dexpreopt.config files to dexpreopt_config.zip
To dexpreopt in post processing, store config files for dexpreopt

Bug: 158843648
Test: m dist and check dexpreopt_config.zip
Change-Id: I5c63a5ffc10023994b14e3a63f50defb9194739f
2021-04-23 01:01:31 +00:00
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