Commit graph

2890 commits

Author SHA1 Message Date
Yo Chiang
68ab626aac Specify --ramdisk_name for vendor ramdisks for vendor_boot v4
When building vendor_boot v4 with multiple vendor ramdisks, pass the
name of each ramdisk to mkbootimg.

Bug: 177882072
Test: Modify a device BoardConfig and verify the built vendor_boot.img
  with unpack_bootimg
Change-Id: I679d277aa88f1e10678d2f74b579e4140536e267
2021-01-19 18:58:43 +08:00
Yo Chiang
d21e7dc833 Add support for packing multiple vendor ramdisks in vendor_boot
Add support for partitioning the vendor_boot kernel modules into
multiple vendor ramdisk fragments. The partition granularity is kernel
module directory. This mechanism builds upon the existing
BOARD_KERNEL_MODULE_DIRS mechanism. For example, say we have three
kernel module directories:

BOARD_KERNEL_MODULE_DIRS := foo bar baz

We can then define a vendor ramdisk fragment:

BOARD_MKBOOTIMG_ARGS += --header_version 4
BOARD_VENDOR_RAMDISK_FRAGMENTS := dlkm_foobar

And let said ramdisk to contain the DLKM directories "foo" and "bar":

BOARD_VENDOR_RAMDISK_FRAGMENT.dlkm_foobar.KERNEL_MODULE_DIRS := foo bar
BOARD_VENDOR_RAMDISK_FRAGMENT.dlkm_foobar.MKBOOTIMG_ARGS := <mkbootimg args>

The built vendor_boot image would contain two ramdisks.
The first one being the "default" ramdisk, which contains DLKM directory
"baz" and the rest of the files that get's installed to
$(TARGET_VENDOR_RAMDISK_OUT).
The second one is the "dlkm_foobar" ramdisk, which contains the two DLKM
directories.

Design doc: go/vendor-boot-v4

Bug: 162864255
Test: Modify BoardConfig.mk to have a product build v4 vendor_boot
Test: Use unpack_bootimg to verify the vendor_boot image
Test: Teach a bootloader how to handle v4 boot image, flash boot &
  vendor_boot and boot device
Change-Id: Ibb1bbd7ebe36430c55ec6c4818c1d3888a319089
2020-12-17 11:07:04 +08:00
Jaegeuk Kim
863a120b51 Merge "Enable system partition compression" am: 74e57f6482
Original change: https://android-review.googlesource.com/c/platform/build/+/1520098

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7b50510b61129704f71ab4d9c474d74f4739aef0
2020-12-10 00:58:46 +00:00
Jaegeuk Kim
74e57f6482 Merge "Enable system partition compression" 2020-12-10 00:41:04 +00:00
Anton Hansson
314a943bd3 Merge "Move rule for certificate_violation_modules.txt" am: 63722db3db
Original change: https://android-review.googlesource.com/c/platform/build/+/1517923

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If863889189d69fd26c327480c7d8943ec77afebb
2020-12-09 12:34:08 +00:00
Robin Hsu
3e51f4234c Enable system partition compression
* Prerequisites: external/f2fs-tools: sload compression support
* Must work with corresponding changes in system/extras repository
* If Board config does not change, it falls back to old behavior,
  i.e. no compression for the system partition
* Kernel f2fs compression support is a prerequisite if the Board config
  enables the compression (see below)
* Necessary board config change
 (e.g. device/<vendor>/<product>/BoardConfig-common.mk)

BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := f2fs
BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 200000000
BOARD_SYSTEMIMAGE_FILE_SYSTEM_COMPRESS := true
BOARD_SYSTEMIMAGE_F2FS_SLOAD_COMPRESS_FLAGS := <sload compress sub-options>

Setting BOARD_SYSTEMIMAGE_FILE_SYSTEM_COMPRESS to true enables both the
compression support when the initial empty file system be made (mkfs.f2fs)
and the compression flag (-c) when the system image files be side-loaded
by sload.

Sload compress sub-options (i.e. options other than -c) will be provided
by BOARD_SYSTEMIMAGE_F2FS_SLOAD_COMPRESS_FLAGS.   If it is not given, or
is empty, the default sub-options will be used

Please refer to the sload.f2fs manual page.

Setting BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE to f2fs is trivially necessary.

* File system table (fstab), notably the file 'fstab.hardware', should
  also changed:
  - The file type must be changed to f2fs
  - Perhaps also other f2fs-specific options

Bug: 170918499
Test: Pixel4a userdebug build (from build id 6918751)
Signed-off-by: Robin Hsu <robinhsu@google.com>
Change-Id: Id9d67b5cb35dc806e06ff1320e89114abc996a28
2020-12-09 07:24:55 +08:00
Anton Hansson
cd8fa36cbb Move rule for certificate_violation_modules.txt
It was in the middle of some other logic in main.mk

Put it in Makefile instead next to the other "information" dist txt
files.

Test: make and diff certificate_violation_modules.txt
Change-Id: I5b73a0f89ccf3de69e7608a0568d2b4b6f37e98c
2020-12-08 21:12:36 +00:00
Treehugger Robot
e1365ce0b1 Merge "Add option include a pvmfw partition" am: d7bf548967
Original change: https://android-review.googlesource.com/c/platform/build/+/1513771

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibd4f75d386f47e5a88d56d7b8039d5eb8c2018d3
2020-12-07 22:48:16 +00:00
Andrew Scull
9b103e49e9 Add option include a pvmfw partition
Protected KVM relies on protected VM firmware (pvmfw) to bootstrap the
trust in protected VMs. This firmware is AVB protected and stored in the
pvmfw partition.

Test: build a target with BOARD_PREBUILT_PVMFWIMAGE set, saw the image
      included in the product files and used avbtool to check the footer
      and vbmeta.img details.
Bug: 171280178
Change-Id: I4d6a1819f307c77ca60c0dd3dff39ee28cece4f6
2020-12-07 12:31:23 +00:00
Yo Chiang
b179ae612d Merge "Add phony target to check all PCF ELF prebuilts" am: ad4dae71cf
Original change: https://android-review.googlesource.com/c/platform/build/+/1311493

Change-Id: I9b97245b1b1a894cd87b396bd0ef4bd1aab46290
2020-12-04 04:11:48 +00:00
Yo Chiang
ad4dae71cf Merge "Add phony target to check all PCF ELF prebuilts" 2020-12-04 02:49:33 +00:00
Treehugger Robot
ae2bf41268 Merge "Make installed-files-recovery.txt depend on rsync timestamp" am: ed41c73db5
Original change: https://android-review.googlesource.com/c/platform/build/+/1515806

Change-Id: I9f2a5e377c7a46ad5efeb7acaa42ef21b58b5cbd
2020-12-03 17:06:29 +00:00
Treehugger Robot
ed41c73db5 Merge "Make installed-files-recovery.txt depend on rsync timestamp" 2020-12-03 16:42:25 +00:00
Treehugger Robot
2875f607e3 Merge "Adds host_init_verifier to otatools.zip" am: d955bc1288
Original change: https://android-review.googlesource.com/c/platform/build/+/1515821

Change-Id: Ia662cc0bb2dba840247de7d69229d2fb5ad20345
2020-12-03 08:22:53 +00:00
Treehugger Robot
d955bc1288 Merge "Adds host_init_verifier to otatools.zip" 2020-12-03 07:10:21 +00:00
Daniel Norman
ee33b4ea51 Adds host_init_verifier to otatools.zip
This is needed after
commit 21c34f78e8
which starts calling host_init_verifier in merge_target_files,
a binary in releasetools.

Test: m otatools
Change-Id: Iee762de9fd6f890b5cc26ee5507da2f3f284fc14
2020-12-02 16:18:25 -08:00
Colin Cross
359f421d3b Make installed-files-recovery.txt depend on rsync timestamp
Files are copied into the recovery installation directory by a rule
that runs rsync.  The previous logic tried to avoid racing with the
rsync rule by depending on the final packaged recovery image, but
if BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is set then
INSTALLED_RECOVERYIMAGE_TARGET is left empty and no dependency was
added.  Depend on the timestamp file used as the output of the rule
that runs rsync instead.

Test: query dependencies of installed-files-recovery.txt
Fixes: 173772240
Change-Id: I5ec77a6933e3a83fe4e4819e0e246017d824d8a5
2020-12-02 23:19:29 +00:00
Xin Li
4bc4ff3c11 Merge rvc-qpr-dev-plus-aosp-without-vendor@6881855
Bug: 172690556
Merged-In: I880b5dfb7bfea4b6abef9fcb603abcb383d84f42
Change-Id: I3c3385a1c58004f1ee6124de0c86dfff614a3bf6
2020-12-02 00:03:31 -08:00
Kiyoung Kim
36481e0b34 Generate system stub library list at build time
List of stub libraries from system (and bionic APEX) is currently
managed in static file. This change generates the list at build time and
adds to the system config so linkerconfig can use it.

Bug: 172889962
Test: Build cuttlefish and confirmed list is generated in
/system/etc/linker.config.pb

Change-Id: Idd5a93442f398dd8e88c767c694ddae64d1bb713
2020-12-01 15:33:09 +09:00
Petri Gynther
6ff5201ce9 Add installed-files-vendor-ramdisk.txt
Add installed-files-vendor-ramdisk.txt build artifact, so that it is
easy to see what files landed on the vendor ramdisk.

Test: clean build, inspect installed-files-vendor-ramdisk.txt
Change-Id: Ie84d06dc968ad972ab2bfa79db4d1839ba09e09f
2020-11-20 16:59:57 -08:00
Treehugger Robot
a39ec91fbe Merge "Revert "Mount generic ramdisk as readwrite."" 2020-11-17 01:11:36 +00:00
Yifan Hong
187e975927 Merge changes from topic "gki_vintf_level"
* changes:
  Pass kernel release file to check_vintf.
  Pass kernel version file to check_vintf.
2020-11-16 23:48:47 +00:00
Treehugger Robot
d320cbc6d0 Merge "Dump BOARD_PARTIAL_OTA_UPDATE_PARTITIONS_LIST into misc_info.txt" 2020-11-16 17:43:57 +00:00
Treehugger Robot
fc65231af1 Merge "Support PRODUCT_BUILD_VBMETA_IMAGE for target files" 2020-11-16 13:59:41 +00:00
Yifan Hong
b95d02eac9 Pass kernel release file to check_vintf.
check_vintf now accepts a file that contains the full kernel
release string as the first half of --kernel. Use it.

With this patch, BOARD_KERNEL_VERSION can be a full kernel release
string like 5.4.42-something, or 5.4.42-android12-0-something.

The content of target_files/META/kernel_version.txt also contains the
full kernel release, not just the kernel version.

Bug: 161317193
Test: m check-vintf-all
Change-Id: I3b52639f557532077894d9356c745c16b41dd91c
2020-11-13 18:45:03 -08:00
Yifan Hong
72e78f21b2 Pass kernel version file to check_vintf.
check_vintf now accept a path to a file that contains the kernel
version string. Use it.

Test: m check-vintf-all and manual inspect
Bug: 161317193
Change-Id: I4812c93f352686d73c5832d59e43a297d93e67a2
2020-11-13 18:45:03 -08:00
Bowgo Tsai
8218225794 Support PRODUCT_BUILD_VBMETA_IMAGE for target files
Currently we support skip building vbmeta.img when
PRODUCT_BUILD_VBMETA_IMAGE is set to false, which is used
when generating a system-only or vendor-only build artifacts.

However, when using `make dist` to build target files,
vbmeta.img is still generated. This change fixes this by
passing the related info to misc_info.txt for the release
tool to skip building vbmeta.img when necessary.

To make this happen, a device config should:
 1. Set PRODUCT_BUILD_VBMETA_IMAGE := false
 2. Remove 'vbmeta' from AB_OTA_PARTITIONS:
     AB_OTA_PARTITIONS += \
	 boot \
	 system \
    -    vbmeta \
	 dtbo \
	 product \
	 system_ext \
         vbmeta_system

Bug: 161659370
Test: `make dist` and checks the target file does not include vbmeta.img
Change-Id: Iddca9fe0b171a50a80e5a88aa462e118f18a7e6f
2020-11-13 11:28:17 +08:00
Yifan Hong
bc685f920c Revert "Mount generic ramdisk as readwrite."
This reverts commit 78b55b2244.

Reason for revert: Replaced by Ib99aca13d4d:
ANDROID: GKI: build in a kernel command line of "rw"

Prebuilt is checked in at Ie34b5b017:
Update kernel to builds 6964541

Fixes: 171512004
Test: TH

Change-Id: I2aec88cc22483a6b3a671fc664d465624a14e5b0
2020-11-12 20:06:54 +00:00
Kelvin Zhang
5a65f69ae6 Dump BOARD_PARTIAL_OTA_UPDATE_PARTITIONS_LIST into misc_info.txt
Cuttlefish doesn't support updating the vendor partition. So we change
ota_from_target_files to only generate updates for partitions in
BOARD_PARTIAL_OTA_UPDATE_PARTITIONS_LIST. This CL puts the prop in
misc_info.txt, which will be read by ota scrips

Bug: 171999375
Test: mm -j
Change-Id: I4d9c97c717cb73806f95684b3bc81ef285ccbb8b
2020-11-11 14:23:00 -05:00
Yifan Hong
49968aa137 aosp_arm64 Copy boot image from $OUT to target files
If BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES is defined,
in target files, instead of rebuilding the boot image, copy the boot
image already built in $OUT to target files package directly so that
they are the same package.

Define BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES for aosp_arm64.

The GKI APEX is built using the boot image in $OUT. If the boot image in
$OUT is different from the boot image in target files, aka the generic
boot image we release, the GKI APEX we built is invalid.

If another device needs to copy $OUT/boot.img to target files, it can
define BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES.

Fixes: 172682114
Test: lunch aosp_arm64 &&
Change-Id: I10fc7a5aa36e976dbeaf25434239687455bba061
2020-11-10 12:55:40 -08:00
Yifan Hong
0674a6e04d Extract boot image from prebuilt apex
Test: m bootimage && file $OUT/boot.img
Bug: 169361394
Change-Id: Id88fd452be8bea82805bde81e407cf6b991120d0
2020-11-09 18:45:42 -08:00
Yo Chiang
336883a64f Add phony target to check all PCF ELF prebuilts
Add phony target check-elf-prebuilt-product-copy-files that asserts
PRODUCT_COPY_FILES doesn't have ELF prebuilts.
This helps triage PCF ELF errors by providing a convenient target to
check / list all errors.

Bug: 140560012
Bug: 156534160
Test: lunch aosp_cf_x86_phone
Test: m USE_NDK_TRANSLATION_BINARY=true \
  check-elf-prebuilt-product-copy-files -k
Change-Id: Ic7fa43c10b0c30b3b1d9b7c2fae75cc6ea4a3513
2020-10-31 06:46:31 +00:00
Yifan Hong
d2ae9989cd Merge changes I7bd61f74,Ia84e604a,I75e13b92,I0db2af20,I4feac435
* changes:
  Mount generic ramdisk as readwrite.
  Do not put GENERIC_KERNEL_CMDLINE in recovery image.
  Move common code out of the conditional.
  Remove device-specific bits if recovery_as_boot
  Do not assume GKI just with vendor_boot.
2020-10-30 16:52:28 +00:00
Alistair Delva
38d49ca61a Merge "Allow flashing erofs system imgs" 2020-10-30 06:41:25 +00:00
Yifan Hong
78b55b2244 Mount generic ramdisk as readwrite.
With this change, first stage init can prepare and move
resources to accomodate devices with and without a dedicated
recovery partition.

Test: build with and without recovery partition, and manually inspect
Bug: 171512004

Change-Id: I7bd61f74c16ee77f3f05dc208e0f3cfe81e302b0
2020-10-28 17:05:18 -07:00
Yifan Hong
78860164d0 Do not put GENERIC_KERNEL_CMDLINE in recovery image.
The GENERIC_KERNEL_CMDLINE should only be in the generic boot image.
If device uses recovery-as-boot, it never uses generic boot image
because on devices with generic boot image, recovery resources are
moved to vendor_boot instead.

Bug: 171512004
Test: builds

Change-Id: Ia84e604a8ded28af39c7f1861ff5d3b3af55849f
2020-10-28 17:05:18 -07:00
Yifan Hong
c56931c173 Move common code out of the conditional.
Test: builds
Change-Id: I75e13b929dbdb31785a59898579ed14bcc3eef60
2020-10-28 17:05:18 -07:00
Yifan Hong
3941a876de Remove device-specific bits if recovery_as_boot
On legacy devices (launched with R and below), if device:
- has a vendor_boot partition, and
- uses recovery_as_boot

Then, when building the recovery/boot partition, the
device-specific bits, including dtb/kernel base/pagesize should
be moved to vendor_boot.

Previously, it is incorrectly assumed that A/B => recovery_as_boot.
In reality, we do have A/B devices with a dedicated recovery partition.

Note that for devices that uses GKI (BOARD_USES_GENERIC_KERNEL_IMAGE),
recovery_as_boot is never set to true. Instead, recovery resources
are moved to vendor_boot. On these devices, the conditional
'vendor_boot && recovery-as-boot' is always false. Hence:

- If the device has a dedicated recovery partition, it should use V3 header,
  and dtb/base/pagesize won't be in recovery header.
- If device does not have a dedicated recovery partition, the recovery
  image won't be built.

Test: builds
Change-Id: I0db2af20470cbe8a21044a984cccf264590aaccf
2020-10-28 17:05:18 -07:00
Yifan Hong
46aff099d2 Do not assume GKI just with vendor_boot.
This change ensures changes to GENERIC_KERNEL_CMDLINE only affects
devices that explicitly says it uses GKI/generic boot image.

In details, if the device has vendor_boot, but does not explicitly
specify that it uses GKI/generic boot image, do not include
GENERIC_KERNEL_CMDLINE in boot. boot cmdline is left empty
in this case.

The old logic:
- If device uses GKI *OR* has vendor_boot:
  boot uses GENERIC_KERNEL_CMDLINE, and do not include kernel base
  and pagesize.
  - If device has vendor_boot, INTERNAL_KERNEL_CMDLINE, kernel base
    and pagesize goes in vendor_boot.
- If device does not use GKI nor have vendor_boot:
  boot uses INTERNAL_KERNEL_CMDLINE, and includes kernel base and
  pagesize.

The new logic:
- If using GKI, boot uses GENERIC_KERNEL_CMDLINE. Remove kernel base
   and pagesize because they are device-specific.
- If not using GKI:
  - If building vendor_boot, INTERNAL_KERNEL_CMDLINE, base and
    pagesize goes in vendor_boot; boot does not have cmdline, base or
    pagesize.
  - Otherwise, put them in boot

Comparison of the code before and after:
- If device uses GKI,
  - For boot partition:
    - cmdline continues to be GENERIC_KERNEL_CMDLINE
    - kernel base and pagesize continues to be excluded
  - For vendor_boot partition:
    - cmdline continues to be INTERNAL_KERNEL_CMDLINE
    - kernel base and pagesize continues to be included
- If device does not use GKI:
  - If device has a vendor_boot partition:
    - For boot partition:
      * cmdline changes from GENERIC_KERNEL_CMDLINE to empty
      - kernel base and pagesize continues to be excluded
    - For vendor_boot partition:
      - cmdline continues to be INTERNAL_KERNEL_CMDLINE
      - kernel base and pagesize continues to be included
  - If device does not have a vendor_boot partition:
    - For boot partition:
      - cmdline continues to be INTERNAL_KERNEL_CMDLINE
      - kernel base and pagesize continues to be included

Test: builds
Bug: 171512004

Change-Id: I4feac435698f43ac299b430bff66147057865a62
2020-10-28 17:05:18 -07:00
Gao Xiang
961041ac80 Allow flashing erofs system imgs
Bug: 158339527
Test: build & boot
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Change-Id: Ie74db8ebcd7214ffbec49d42b305b2f3ac2e8c9d
2020-10-28 01:24:39 +08:00
Jaewoong Jung
7b634d345d Remove duplicate quotation marks in apkcerts list.
Fixes: 160845661
Test: Modify dialer cert string && m apkcerts-list
Change-Id: I9da8dd70185057b2e13793dd14387223dc29b052
2020-10-23 14:02:16 -07:00
Tianjie Xu
f692346758 Merge "Generate partial ota update package if the board defines it" 2020-10-21 20:19:10 +00:00
Yifan Hong
ffb2a7f9da Merge "Build boot image if BOARD_KERNEL*_BOOTIMAGE_PARTITION_SIZE" 2020-10-21 18:34:31 +00:00
Jingwen Chen
7d7f94547a symlink_outputs: Add .KATI_SYMLINK_OUTPUTS to build/make/core
Test: m
Bug: 160568334

Change-Id: Ie6fb4f16bb77845787d277857e17e6aac0a8c11a
2020-10-21 08:55:10 +00:00
Yifan Hong
ebe65f8c0a Build boot image if BOARD_KERNEL*_BOOTIMAGE_PARTITION_SIZE
Also gets the correct partition size and checks correctly.

Test: build aosp_arm64

Change-Id: I004e4b04d225d72db1904b983a6d03a916406085
2020-10-20 15:53:12 -07:00
Yifan Hong
9873891bd0 Merge "Do not build recovery-resource.dat if move_recovery_res_to_vendor_boot" 2020-10-20 22:26:15 +00:00
Tianjie
6bd3b1a7f1 Generate partial ota update package if the board defines it
Many partners have asked for platform support of system-only update.
So we config cuttlefish as an example to support the partial ota
updates. Also make such package available on the build server.
This allows continuous test to ensure the e2e update flow is working.

Bug: 170921953
Test: generate & apply a partial update, check output in presubmit
Change-Id: I79d0abeb1b2be18e6ff88f0455b6de6540a37794
2020-10-20 15:17:33 -07:00
Yifan Hong
3dd40ccebe Merge "Reland "Check system manifest against frozen data."" 2020-10-20 20:25:21 +00:00
Yifan Hong
ef7a971ded Do not build recovery-resource.dat if move_recovery_res_to_vendor_boot
If recovery resources are moved to vendor_boot, it also means
there's no recovery image to install. Don't build
recovery-resource.dat in this case.

Test: builds with cuttlefish with GKI
Bug: 156098440
Change-Id: I86db08d2dede6af644afadac54ff8beb853f4933
2020-10-20 13:18:04 -07:00
Yifan Hong
7a157b0319 Reland "Check system manifest against frozen data."
This reverts commit 8197702d73.

Test: lunch cf_x86_auto && m check-vintf-all 

Reason for revert: auto targets fixed in the same topic

Change-Id: I193416a4d0718e5790eb54e5c0674edc2d975632
2020-10-20 17:08:11 +00:00