Revert "Revert "emulator: create qemu images for system,vendor""
This reverts commit 9b99ddc8a58fc54c04a74b4a158bc06b90420f02.
and add syste-qemu.img to the dependency list of sdk target
BUG: 64235252
Test: build sdk target successfully
(cherry picked from commit f0d50bbef0521f28c6ae2dc87bc6fe27dfe7ed2c)
Change-Id: I813233c7c3f06eb1eca18aad5ea890a55814eb1b
diff --git a/core/Makefile b/core/Makefile
index af3c4cb..c6c9ebf 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2740,6 +2740,26 @@
.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)
@@ -2835,6 +2855,7 @@
$(SYMBOLS_ZIP) \
$(COVERAGE_ZIP) \
$(INSTALLED_SYSTEMIMAGE) \
+ $(INSTALLED_QEMU_SYSTEMIMAGE) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_SDK_BUILD_PROP_TARGET) \
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index 610e0ce..e3bd47d 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -63,7 +63,7 @@
# 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 946e480..609cf25 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -43,6 +43,7 @@
# 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 5917425..56a86b8 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -74,6 +74,7 @@
# 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 c36cc4a..cd29f35 100644
--- a/target/board/generic_mips/BoardConfig.mk
+++ b/target/board/generic_mips/BoardConfig.mk
@@ -51,6 +51,7 @@
# 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 4798e3f..17aae27 100644
--- a/target/board/generic_mips64/BoardConfig.mk
+++ b/target/board/generic_mips64/BoardConfig.mk
@@ -66,6 +66,7 @@
# 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 26b2944..08bd6d1 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -31,6 +31,10 @@
# 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 9b8e5c8..2499199 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -36,6 +36,7 @@
# 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.