From 8fd437c80a870bb04d80fe2620b1cf5c7788aef6 Mon Sep 17 00:00:00 2001 From: bohu Date: Mon, 30 Mar 2020 20:16:13 -0700 Subject: [PATCH] emulator: enable vendor boot image BUG: 149826779 Test: Build x86, x86_64, armv7 and arm64 make sure x86/64 boot to home screen; armv7/arm64 can pass disk mounting stage Change-Id: I258b69bd0cdc4fb0a99b1a04567051e8d32c389a --- core/Makefile | 15 +++++++++++++++ core/tasks/sdk-addon.mk | 2 +- target/board/BoardConfigEmuCommon.mk | 7 +++++++ target/board/generic_arm64/BoardConfig.mk | 2 +- target/product/aosp_arm64.mk | 3 ++- target/product/sdk_phone_arm64.mk | 1 - 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/core/Makefile b/core/Makefile index 1e081a52b..c25a8a7ec 100644 --- a/core/Makefile +++ b/core/Makefile @@ -5186,6 +5186,20 @@ $(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_S vendorimage: $(INSTALLED_QEMU_VENDORIMAGE) droidcore: $(INSTALLED_QEMU_VENDORIMAGE) endif + +ifdef INSTALLED_RAMDISK_TARGET +ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET +ifdef INTERNAL_VENDOR_RAMDISK_TARGET +INSTALLED_QEMU_RAMDISKIMAGE := $(PRODUCT_OUT)/ramdisk-qemu.img +$(INSTALLED_QEMU_RAMDISKIMAGE): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_RAMDISK_TARGET) + @echo Create ramdisk-qemu.img + (cat $(INSTALLED_RAMDISK_TARGET) $(INTERNAL_VENDOR_RAMDISK_TARGET) > $(INSTALLED_QEMU_RAMDISKIMAGE)) + +droidcore: $(INSTALLED_QEMU_RAMDISKIMAGE) +endif +endif +endif + ifdef INSTALLED_PRODUCTIMAGE_TARGET INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img $(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) @@ -5323,6 +5337,7 @@ deps := \ $(APPCOMPAT_ZIP) \ $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_QEMU_SYSTEMIMAGE) \ + $(INSTALLED_QEMU_RAMDISKIMAGE) \ $(INSTALLED_QEMU_VENDORIMAGE) \ $(QEMU_VERIFIED_BOOT_PARAMS) \ $(INSTALLED_USERDATAIMAGE_TARGET) \ diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk index 7f777a549..5097f1266 100644 --- a/core/tasks/sdk-addon.mk +++ b/core/tasks/sdk-addon.mk @@ -66,7 +66,7 @@ endif files_to_copy += \ $(addon_dir_img):$(INSTALLED_QEMU_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \ $(addon_dir_img):$(INSTALLED_QEMU_VENDORIMAGE):images/$(TARGET_CPU_ABI)/vendor.img \ - $(addon_dir_img):$(BUILT_RAMDISK_TARGET):images/$(TARGET_CPU_ABI)/ramdisk.img \ + $(addon_dir_img):$(INSTALLED_QEMU_RAMDISKIMAGE):images/$(TARGET_CPU_ABI)/ramdisk.img \ $(addon_dir_img):$(PRODUCT_OUT)/system/build.prop:images/$(TARGET_CPU_ABI)/build.prop \ $(addon_dir_img):device/generic/goldfish/data/etc/userdata.img:images/$(TARGET_CPU_ABI)/userdata.img \ $(addon_dir_img):$(target_notice_file_txt):images/$(TARGET_CPU_ABI)/NOTICE.txt \ diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk index d11f9d2ff..a2e5518d3 100644 --- a/target/board/BoardConfigEmuCommon.mk +++ b/target/board/BoardConfigEmuCommon.mk @@ -74,6 +74,13 @@ else BOARD_VENDORIMAGE_PARTITION_SIZE := 146800640 endif +#vendor boot +TARGET_NO_VENDOR_BOOT := false +BOARD_INCLUDE_DTB_IN_BOOTIMG := false +BOARD_BOOT_HEADER_VERSION := 3 +BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION) +BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 0x06000000 + # Enable chain partition for system. BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048 diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk index a5264e43c..8e28b5fc0 100644 --- a/target/board/generic_arm64/BoardConfig.mk +++ b/target/board/generic_arm64/BoardConfig.mk @@ -56,7 +56,7 @@ include build/make/target/board/BoardConfigGsiCommon.mk include build/make/target/board/BoardConfigEmuCommon.mk TARGET_NO_KERNEL := false -TARGET_NO_VENDOR_BOOT := true +TARGET_NO_VENDOR_BOOT := false BOARD_USES_RECOVERY_AS_BOOT := true BOARD_BOOTIMAGE_PARTITION_SIZE := 0x02000000 diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk index 491397f2d..3f986d396 100644 --- a/target/product/aosp_arm64.mk +++ b/target/product/aosp_arm64.mk @@ -51,8 +51,9 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # -# All components inherited here go to vendor image +# All components inherited here go to vendor or vendor_boot image # +$(call inherit-product-if-exists, device/generic/goldfish/arm64-vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk) diff --git a/target/product/sdk_phone_arm64.mk b/target/product/sdk_phone_arm64.mk index 9024890d2..ad726333a 100644 --- a/target/product/sdk_phone_arm64.mk +++ b/target/product/sdk_phone_arm64.mk @@ -16,7 +16,6 @@ QEMU_USE_SYSTEM_EXT_PARTITIONS := true $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm64.mk) -$(call inherit-product-if-exists, device/generic/goldfish/arm64-vendor.mk) # Define the host tools and libs that are parts of the SDK. $(call inherit-product, sdk/build/product_sdk.mk)