From b5d05037589087503b1d6c811bd783162e955e6d Mon Sep 17 00:00:00 2001 From: bohu Date: Fri, 28 Jul 2017 11:07:13 -0700 Subject: [PATCH] emulator: create qemu images for system,vendor For raw system.img and vendor.img do not have partition table and init refuses to mount them in first stage mounting. For emulator build: create partitioned system-qemu.img for system.img; create partitioned vendor-qemu.img for vendor.img if applicable. Change-Id: I64fdcdafc303cf2f74a1e96653e7afe259f0af98 --- core/Makefile | 20 ++++++++++++++++++++ core/tasks/sdk-addon.mk | 2 +- target/board/generic/BoardConfig.mk | 1 + target/board/generic_arm64/BoardConfig.mk | 1 + target/board/generic_mips/BoardConfig.mk | 1 + target/board/generic_mips64/BoardConfig.mk | 1 + target/board/generic_x86/BoardConfig.mk | 4 ++++ target/board/generic_x86_64/BoardConfig.mk | 1 + 8 files changed, 30 insertions(+), 1 deletion(-) diff --git a/core/Makefile b/core/Makefile index 82d68a35b1..051b3403b2 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2647,6 +2647,26 @@ endif # TARGET_BUILD_APPS .PHONY: dalvikfiles dalvikfiles: $(INTERNAL_DALVIK_MODULES) +ifeq ($(BUILD_QEMU_IMAGES),true) +INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img +MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh +SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk +$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) + @echo Create system-qemu.img + (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/system.img) + +systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE) +droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE) +ifeq ($(BOARD_USES_VENDORIMAGE),true) +INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img +$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) + @echo Create vendor-qemu.img + (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/vendor.img) + +vendorimage: $(INSTALLED_QEMU_VENDORIMAGE) +droidcore: $(INSTALLED_QEMU_VENDORIMAGE) +endif +endif # ----------------------------------------------------------------- # The emulator package ifeq ($(BUILD_EMULATOR),true) diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk index 610e0ce621..e3bd47d13e 100644 --- a/core/tasks/sdk-addon.mk +++ b/core/tasks/sdk-addon.mk @@ -63,7 +63,7 @@ endif # Files copied in the system-image directory files_to_copy += \ - $(addon_dir_img):$(BUILT_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \ + $(addon_dir_img):$(INSTALLED_QEMU_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \ $(addon_dir_img):$(BUILT_USERDATAIMAGE_TARGET):images/$(TARGET_CPU_ABI)/userdata.img \ $(addon_dir_img):$(BUILT_RAMDISK_TARGET):images/$(TARGET_CPU_ABI)/ramdisk.img \ $(addon_dir_img):$(PRODUCT_OUT)/system/build.prop:images/$(TARGET_CPU_ABI)/build.prop \ diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk index ed259dbeed..8bef7abf6f 100644 --- a/target/board/generic/BoardConfig.mk +++ b/target/board/generic/BoardConfig.mk @@ -41,6 +41,7 @@ endif # Build OpenGLES emulation guest and host libraries BUILD_EMULATOR_OPENGL := true +BUILD_QEMU_IMAGES := true # Build and enable the OpenGL ES View renderer. When running on the emulator, # the GLES renderer disables itself if host GL acceleration isn't available. diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk index 34fffed4e5..ea4b05ba14 100644 --- a/target/board/generic_arm64/BoardConfig.mk +++ b/target/board/generic_arm64/BoardConfig.mk @@ -71,6 +71,7 @@ endif # Build OpenGLES emulation host and guest libraries BUILD_EMULATOR_OPENGL := true +BUILD_QEMU_IMAGES := true # Build and enable the OpenGL ES View renderer. When running on the emulator, # the GLES renderer disables itself if host GL acceleration isn't available. diff --git a/target/board/generic_mips/BoardConfig.mk b/target/board/generic_mips/BoardConfig.mk index b68d88b7d0..9ce8fce894 100644 --- a/target/board/generic_mips/BoardConfig.mk +++ b/target/board/generic_mips/BoardConfig.mk @@ -48,6 +48,7 @@ endif # Build OpenGLES emulation guest and host libraries BUILD_EMULATOR_OPENGL := true +BUILD_QEMU_IMAGES := true # Build and enable the OpenGL ES View renderer. When running on the emulator, # the GLES renderer disables itself if host GL acceleration isn't available. diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk index 44e6287f1f..0d15fe9a55 100644 --- a/target/board/generic_mips64/BoardConfig.mk +++ b/target/board/generic_mips64/BoardConfig.mk @@ -63,6 +63,7 @@ endif # Build OpenGLES emulation guest and host libraries BUILD_EMULATOR_OPENGL := true +BUILD_QEMU_IMAGES := true # Build and enable the OpenGL ES View renderer. When running on the emulator, # the GLES renderer disables itself if host GL acceleration isn't available. diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk index f8ac496c79..34f955b440 100644 --- a/target/board/generic_x86/BoardConfig.mk +++ b/target/board/generic_x86/BoardConfig.mk @@ -28,6 +28,10 @@ endif # Build OpenGLES emulation host and guest libraries BUILD_EMULATOR_OPENGL := true +# Build partitioned system.img and vendor.img (if applicable) +# for qemu, otherwise, init cannot find PART_NAME +BUILD_QEMU_IMAGES := true + # Build and enable the OpenGL ES View renderer. When running on the emulator, # the GLES renderer disables itself if host GL acceleration isn't available. USE_OPENGL_RENDERER := true diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk index bd2f9879e8..046cac97bb 100755 --- a/target/board/generic_x86_64/BoardConfig.mk +++ b/target/board/generic_x86_64/BoardConfig.mk @@ -33,6 +33,7 @@ endif # Build OpenGLES emulation host and guest libraries BUILD_EMULATOR_OPENGL := true +BUILD_QEMU_IMAGES := true # Build and enable the OpenGL ES View renderer. When running on the emulator, # the GLES renderer disables itself if host GL acceleration isn't available.