From 1457b3fcbf4126eb24f874113ce2000aa7f92b79 Mon Sep 17 00:00:00 2001 From: SzuWei Lin Date: Thu, 3 Jan 2019 12:49:55 +0800 Subject: [PATCH] Refactor GSI BoardConfig.mk The patch modifies the Legacy GSI to use BoardConfigGsiCommon.mk instead of board config treble-common*.mk, and delete these treble-common*.mk files. After the patch, the GSI common board configs are in single file BoardConfigGsiCommon.mk The patch also includes: - Moving `TARGET_COPY_OUT_VENDOR := vendor` to BoardConfigGsiCommon.mk, because GSI always contains no vendor contents. - Configure the binder interface bitness explicitly. - Unify the structure of each BoardConfig.mk. Bug: 122282239 Test: compare the out folder between with and without the patch Test: output files are all the same Change-Id: Ie5901446920dda317dea848e6d5a7bbcf10a32cf --- target/board/BoardConfigEmuCommon.mk | 2 - target/board/BoardConfigGsiCommon.mk | 11 +++ target/board/generic_arm64_a/BoardConfig.mk | 2 +- target/board/generic_arm64_ab/BoardConfig.mk | 4 +- target/board/generic_arm_a/BoardConfig.mk | 5 +- target/board/generic_arm_ab/BoardConfig.mk | 7 +- target/board/generic_x86_64_a/BoardConfig.mk | 2 +- target/board/generic_x86_64_ab/BoardConfig.mk | 10 +-- target/board/generic_x86_a/BoardConfig.mk | 5 +- target/board/generic_x86_ab/BoardConfig.mk | 13 ++-- target/board/treble_common.mk | 69 ------------------- target/board/treble_common_32.mk | 20 ------ target/board/treble_common_64.mk | 20 ------ target/board/treble_system.prop | 8 --- target/product/aosp_arm64_a.mk | 2 +- target/product/aosp_arm64_ab.mk | 2 +- target/product/aosp_arm_a.mk | 2 +- target/product/aosp_arm_ab.mk | 2 +- target/product/aosp_x86_64_a.mk | 2 +- target/product/aosp_x86_64_ab.mk | 2 +- target/product/aosp_x86_a.mk | 2 +- target/product/aosp_x86_ab.mk | 2 +- 22 files changed, 49 insertions(+), 145 deletions(-) delete mode 100644 target/board/treble_common.mk delete mode 100644 target/board/treble_common_32.mk delete mode 100644 target/board/treble_common_64.mk delete mode 100644 target/board/treble_system.prop diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk index 38f79fdcd8..55cd546e1d 100644 --- a/target/board/BoardConfigEmuCommon.mk +++ b/target/board/BoardConfigEmuCommon.mk @@ -20,8 +20,6 @@ BUILD_QEMU_IMAGES := true # the GLES renderer disables itself if host GL acceleration isn't available. USE_OPENGL_RENDERER := true -TARGET_COPY_OUT_VENDOR := vendor - # ~100 MB vendor image. Please adjust system image / vendor image sizes # when finalizing them. The partition size needs to be a multiple of image # block size: 4096. diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk index 73af0201af..a853b3c69a 100644 --- a/target/board/BoardConfigGsiCommon.mk +++ b/target/board/BoardConfigGsiCommon.mk @@ -6,6 +6,9 @@ include build/make/target/board/BoardConfigMainlineCommon.mk +# Enable system property split for Treble +BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true + # This flag is set by mainline but isn't desired for GSI. BOARD_USES_SYSTEM_OTHER_ODEX := @@ -14,9 +17,17 @@ BOARD_USES_SYSTEM_OTHER_ODEX := # we explicit specify this need below (even though it's the current default). TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false +# system.img is always ext4 with sparse option +# GSI also includes make_f2fs to support userdata parition in f2fs +# for some devices +TARGET_USERIMAGES_USE_F2FS := true + # Enable dynamic system image size and reserved 64MB in it. BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864 +# Generic AOSP image always requires separate vendor.img +TARGET_COPY_OUT_VENDOR := vendor + # Android Verified Boot (AVB): # Set AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED (--flag 2) in # vbmeta.img to disable AVB verification. diff --git a/target/board/generic_arm64_a/BoardConfig.mk b/target/board/generic_arm64_a/BoardConfig.mk index 34a8ac0012..f77dbe5f8f 100644 --- a/target/board/generic_arm64_a/BoardConfig.mk +++ b/target/board/generic_arm64_a/BoardConfig.mk @@ -14,7 +14,7 @@ # limitations under the License. # -include build/make/target/board/treble_common_64.mk +include build/make/target/board/BoardConfigGsiCommon.mk TARGET_ARCH := arm64 TARGET_ARCH_VARIANT := armv8-a diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk index 88b90a8fbf..073eccb9d6 100644 --- a/target/board/generic_arm64_ab/BoardConfig.mk +++ b/target/board/generic_arm64_ab/BoardConfig.mk @@ -14,7 +14,7 @@ # limitations under the License. # -include build/make/target/board/treble_common_64.mk +include build/make/target/board/BoardConfigGsiCommon.mk TARGET_ARCH := arm64 TARGET_ARCH_VARIANT := armv8-a @@ -28,7 +28,7 @@ TARGET_2ND_CPU_ABI := armeabi-v7a TARGET_2ND_CPU_ABI2 := armeabi TARGET_2ND_CPU_VARIANT := generic -# Enable A/B update +# Enable System-as-Root TARGET_NO_RECOVERY := true BOARD_BUILD_SYSTEM_ROOT_IMAGE := true diff --git a/target/board/generic_arm_a/BoardConfig.mk b/target/board/generic_arm_a/BoardConfig.mk index 57a5196a96..cba222a733 100644 --- a/target/board/generic_arm_a/BoardConfig.mk +++ b/target/board/generic_arm_a/BoardConfig.mk @@ -14,10 +14,13 @@ # limitations under the License. # -include build/make/target/board/treble_common_32.mk +include build/make/target/board/BoardConfigGsiCommon.mk TARGET_ARCH := arm TARGET_ARCH_VARIANT := armv7-a-neon TARGET_CPU_ABI := armeabi-v7a TARGET_CPU_ABI2 := armeabi TARGET_CPU_VARIANT := generic + +# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch +TARGET_USES_64_BIT_BINDER := false diff --git a/target/board/generic_arm_ab/BoardConfig.mk b/target/board/generic_arm_ab/BoardConfig.mk index 3d14842901..087543e92b 100644 --- a/target/board/generic_arm_ab/BoardConfig.mk +++ b/target/board/generic_arm_ab/BoardConfig.mk @@ -14,7 +14,7 @@ # limitations under the License. # -include build/make/target/board/treble_common_32.mk +include build/make/target/board/BoardConfigGsiCommon.mk TARGET_ARCH := arm TARGET_ARCH_VARIANT := armv7-a-neon @@ -22,7 +22,10 @@ TARGET_CPU_ABI := armeabi-v7a TARGET_CPU_ABI2 := armeabi TARGET_CPU_VARIANT := generic -# Enable A/B update +# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch +TARGET_USES_64_BIT_BINDER := false + +# Enable System-as-Root TARGET_NO_RECOVERY := true BOARD_BUILD_SYSTEM_ROOT_IMAGE := true diff --git a/target/board/generic_x86_64_a/BoardConfig.mk b/target/board/generic_x86_64_a/BoardConfig.mk index 2c0260439c..1dd5e4898d 100644 --- a/target/board/generic_x86_64_a/BoardConfig.mk +++ b/target/board/generic_x86_64_a/BoardConfig.mk @@ -14,7 +14,7 @@ # limitations under the License. # -include build/make/target/board/treble_common_64.mk +include build/make/target/board/BoardConfigGsiCommon.mk TARGET_CPU_ABI := x86_64 TARGET_ARCH := x86_64 diff --git a/target/board/generic_x86_64_ab/BoardConfig.mk b/target/board/generic_x86_64_ab/BoardConfig.mk index a098dfe2a3..09ce95d67f 100644 --- a/target/board/generic_x86_64_ab/BoardConfig.mk +++ b/target/board/generic_x86_64_ab/BoardConfig.mk @@ -14,7 +14,7 @@ # limitations under the License. # -include build/make/target/board/treble_common_64.mk +include build/make/target/board/BoardConfigGsiCommon.mk TARGET_CPU_ABI := x86_64 TARGET_ARCH := x86_64 @@ -24,11 +24,11 @@ TARGET_2ND_CPU_ABI := x86 TARGET_2ND_ARCH := x86 TARGET_2ND_ARCH_VARIANT := x86_64 +# Enable System-as-Root +TARGET_NO_RECOVERY := true +BOARD_BUILD_SYSTEM_ROOT_IMAGE := true + # Set this to create /cache mount point for non-A/B devices that mounts /cache. # The partition size doesn't matter, just to make build pass. BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216 - -# Enable A/B update -TARGET_NO_RECOVERY := true -BOARD_BUILD_SYSTEM_ROOT_IMAGE := true diff --git a/target/board/generic_x86_a/BoardConfig.mk b/target/board/generic_x86_a/BoardConfig.mk index 67cb07d7f9..53acffd239 100644 --- a/target/board/generic_x86_a/BoardConfig.mk +++ b/target/board/generic_x86_a/BoardConfig.mk @@ -14,8 +14,11 @@ # limitations under the License. # -include build/make/target/board/treble_common_32.mk +include build/make/target/board/BoardConfigGsiCommon.mk TARGET_CPU_ABI := x86 TARGET_ARCH := x86 TARGET_ARCH_VARIANT := x86 + +# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch +TARGET_USES_64_BIT_BINDER := false diff --git a/target/board/generic_x86_ab/BoardConfig.mk b/target/board/generic_x86_ab/BoardConfig.mk index db4dacd968..cc8ab70ce7 100644 --- a/target/board/generic_x86_ab/BoardConfig.mk +++ b/target/board/generic_x86_ab/BoardConfig.mk @@ -14,17 +14,20 @@ # limitations under the License. # -include build/make/target/board/treble_common_32.mk +include build/make/target/board/BoardConfigGsiCommon.mk TARGET_CPU_ABI := x86 TARGET_ARCH := x86 TARGET_ARCH_VARIANT := x86 +# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch +TARGET_USES_64_BIT_BINDER := false + +# Enable System-as-Root +TARGET_NO_RECOVERY := true +BOARD_BUILD_SYSTEM_ROOT_IMAGE := true + # Set this to create /cache mount point for non-A/B devices that mounts /cache. # The partition size doesn't matter, just to make build pass. BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216 - -# Enable A/B update -TARGET_NO_RECOVERY := true -BOARD_BUILD_SYSTEM_ROOT_IMAGE := true diff --git a/target/board/treble_common.mk b/target/board/treble_common.mk deleted file mode 100644 index eda5b37701..0000000000 --- a/target/board/treble_common.mk +++ /dev/null @@ -1,69 +0,0 @@ -# -# Copyright (C) 2017 The Android Open-Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Common boardconfig settings for generic AOSP products targetting mobile -# (phone/table) devices. - -# VNDK -BOARD_VNDK_VERSION := current - -# Properties -TARGET_SYSTEM_PROP := build/make/target/board/treble_system.prop -BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true - -# Bootloader, kernel and recovery are not part of generic AOSP image -TARGET_NO_BOOTLOADER := true -TARGET_NO_KERNEL := true - -# system.img is always ext4 with sparse option -# GSI also includes make_f2fs to support userdata parition in f2fs -# for some devices -TARGET_USERIMAGES_USE_EXT4 := true -TARGET_USERIMAGES_USE_F2FS := true -TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false - -# Enable dynamic system image size and reserved 64MB in it. -BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864 - -# Generic AOSP image always requires separate vendor.img -TARGET_COPY_OUT_VENDOR := vendor - -# Android generic system image always create metadata partition -BOARD_USES_METADATA_PARTITION := true - -# Set emulator framebuffer display device buffer count to 3 -NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3 - -# Audio -USE_XML_AUDIO_POLICY_CONF := 1 - -# Android Verified Boot (AVB): -# 1) Sets BOARD_AVB_ENABLE to sign the GSI image. -# 2) Sets AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED (--flag 2) in -# vbmeta.img to disable AVB verification. -# -# To disable AVB for GSI, use the vbmeta.img and the GSI together. -# To enable AVB for GSI, include the GSI public key into the device-specific -# vbmeta.img. -BOARD_AVB_ENABLE := true -BOARD_AVB_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP) -BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2 - -# Enable chain partition for system. -BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem -BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048 -BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP) -BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1 diff --git a/target/board/treble_common_32.mk b/target/board/treble_common_32.mk deleted file mode 100644 index e8bad087b8..0000000000 --- a/target/board/treble_common_32.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (C) 2017 The Android Open-Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include build/make/target/board/treble_common.mk - -# Legacy GSI keeps 32 bits binder for 32 bits CPU Arch -TARGET_USES_64_BIT_BINDER := false diff --git a/target/board/treble_common_64.mk b/target/board/treble_common_64.mk deleted file mode 100644 index 8980dfde1d..0000000000 --- a/target/board/treble_common_64.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (C) 2017 The Android Open-Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -include build/make/target/board/treble_common.mk - -# Enable 64-bits binder -TARGET_USES_64_BIT_BINDER := true diff --git a/target/board/treble_system.prop b/target/board/treble_system.prop deleted file mode 100644 index 0c04a9529f..0000000000 --- a/target/board/treble_system.prop +++ /dev/null @@ -1,8 +0,0 @@ -# GSI always generate dex pre-opt in system image -ro.cp_system_other_odex=0 - -# GSI always disables adb authentication -ro.adb.secure=0 - -# TODO(b/78105955): disable privapp_permissions checking before the bug solved -ro.control_privapp_permissions=disable diff --git a/target/product/aosp_arm64_a.mk b/target/product/aosp_arm64_a.mk index 3c7af334d9..b1c4b7dba2 100644 --- a/target/product/aosp_arm64_a.mk +++ b/target/product/aosp_arm64_a.mk @@ -17,7 +17,7 @@ # PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at # /vendor/[build|default].prop when build split is on. In order to have sysprops # on the generic system image, place them in build/make/target/board/ -# treble_system.prop. +# gsi_system.prop. include build/make/target/product/treble_common_64.mk diff --git a/target/product/aosp_arm64_ab.mk b/target/product/aosp_arm64_ab.mk index d389c74d0f..92f50553a3 100644 --- a/target/product/aosp_arm64_ab.mk +++ b/target/product/aosp_arm64_ab.mk @@ -17,7 +17,7 @@ # PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at # /vendor/[build|default].prop when build split is on. In order to have sysprops # on the generic system image, place them in build/make/target/board/ -# treble_system.prop. +# gsi_system.prop. # aosp_arm64_ab-userdebug is a Legacy GSI for the devices with: # - ARM 64 bits user space diff --git a/target/product/aosp_arm_a.mk b/target/product/aosp_arm_a.mk index 3060fa920a..d89a326c96 100644 --- a/target/product/aosp_arm_a.mk +++ b/target/product/aosp_arm_a.mk @@ -17,7 +17,7 @@ # PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at # /vendor/[build|default].prop when build split is on. In order to have sysprops # on the generic system image, place them in build/make/target/board/ -# treble_system.prop. +# gsi_system.prop. include build/make/target/product/treble_common_32.mk diff --git a/target/product/aosp_arm_ab.mk b/target/product/aosp_arm_ab.mk index 5845d3ba87..b35e517759 100644 --- a/target/product/aosp_arm_ab.mk +++ b/target/product/aosp_arm_ab.mk @@ -17,7 +17,7 @@ # PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at # /vendor/[build|default].prop when build split is on. In order to have sysprops # on the generic system image, place them in build/make/target/board/ -# treble_system.prop. +# gsi_system.prop. # aosp_arm_ab-userdebug is a Legacy GSI for the devices with: # - ARM 32 bits user space diff --git a/target/product/aosp_x86_64_a.mk b/target/product/aosp_x86_64_a.mk index a7fb740974..6b6785a492 100644 --- a/target/product/aosp_x86_64_a.mk +++ b/target/product/aosp_x86_64_a.mk @@ -17,7 +17,7 @@ # PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at # /vendor/[build|default].prop when build split is on. In order to have sysprops # on the generic system image, place them in build/make/target/board/ -# treble_system.prop. +# gsi_system.prop. include build/make/target/product/treble_common_64.mk diff --git a/target/product/aosp_x86_64_ab.mk b/target/product/aosp_x86_64_ab.mk index d9163d76b2..35bf61a1fa 100644 --- a/target/product/aosp_x86_64_ab.mk +++ b/target/product/aosp_x86_64_ab.mk @@ -17,7 +17,7 @@ # PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at # /vendor/[build|default].prop when build split is on. In order to have sysprops # on the generic system image, place them in build/make/target/board/ -# treble_system.prop. +# gsi_system.prop. # aosp_x86_64_ab-userdebug is a Legacy GSI for the devices with: # - x86 64 bits user space diff --git a/target/product/aosp_x86_a.mk b/target/product/aosp_x86_a.mk index 9ed29955e4..99ed7e441e 100644 --- a/target/product/aosp_x86_a.mk +++ b/target/product/aosp_x86_a.mk @@ -17,7 +17,7 @@ # PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at # /vendor/[build|default].prop when build split is on. In order to have sysprops # on the generic system image, place them in build/make/target/board/ -# treble_system.prop. +# gsi_system.prop. include build/make/target/product/treble_common_32.mk diff --git a/target/product/aosp_x86_ab.mk b/target/product/aosp_x86_ab.mk index 4fff3d155b..185e2f0a34 100644 --- a/target/product/aosp_x86_ab.mk +++ b/target/product/aosp_x86_ab.mk @@ -17,7 +17,7 @@ # PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at # /vendor/[build|default].prop when build split is on. In order to have sysprops # on the generic system image, place them in build/make/target/board/ -# treble_system.prop. +# gsi_system.prop. # aosp_x86_ab-userdebug is a Legacy GSI for the devices with: # - x86 32 bits user space