1# 2# Copyright 2019 The Android Open-Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17ifneq ($(filter generic_% generic, $(TARGET_DEVICE)),) 18LOCAL_PATH:= $(call my-dir) 19 20include $(CLEAR_VARS) 21EMU_EXTRA_FILES := \ 22 $(PRODUCT_OUT)/system-qemu-config.txt \ 23 $(PRODUCT_OUT)/ramdisk-qemu.img \ 24 $(PRODUCT_OUT)/misc_info.txt \ 25 $(PRODUCT_OUT)/vbmeta.img \ 26 $(PRODUCT_OUT)/VerifiedBootParams.textproto \ 27 $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST),$(PRODUCT_OUT)/$(p).img) 28 29ifeq ($(filter sdk_gphone_%, $(TARGET_PRODUCT)),) 30ifeq ($(TARGET_BUILD_VARIANT),user) 31EMU_EXTRA_FILES += device/generic/goldfish/data/etc/user/advancedFeatures.ini 32else 33EMU_EXTRA_FILES += device/generic/goldfish/data/etc/advancedFeatures.ini 34endif 35else 36ifeq ($(TARGET_BUILD_VARIANT),user) 37EMU_EXTRA_FILES += device/generic/goldfish/data/etc/google/user/advancedFeatures.ini 38else 39EMU_EXTRA_FILES += device/generic/goldfish/data/etc/google/userdebug/advancedFeatures.ini 40endif 41endif 42 43EMU_EXTRA_FILES += device/generic/goldfish/data/etc/config.ini 44EMU_EXTRA_FILES += device/generic/goldfish/data/etc/encryptionkey.img 45EMU_EXTRA_FILES += device/generic/goldfish/data/etc/userdata.img 46 47name := emu-extra-linux-system-images-$(FILE_NAME_TAG) 48 49EMU_EXTRA_TARGET := $(PRODUCT_OUT)/$(name).zip 50 51EMULATOR_KERNEL_ARCH := $(TARGET_ARCH) 52EMULATOR_KERNEL_DIST_NAME := kernel-ranchu 53# Below should be the same as PRODUCT_KERNEL_VERSION set in 54# device/generic/goldfish/(arm|x86)*-vendor.mk 55EMULATOR_KERNEL_VERSION := 5.4 56 57# Use 64-bit kernel even for 32-bit Android 58ifeq ($(TARGET_ARCH), x86) 59EMULATOR_KERNEL_ARCH := x86_64 60EMULATOR_KERNEL_DIST_NAME := kernel-ranchu-64 61endif 62ifeq ($(TARGET_ARCH), arm) 63EMULATOR_KERNEL_ARCH := arm64 64EMULATOR_KERNEL_DIST_NAME := kernel-ranchu-64 65endif 66 67EMULATOR_KERNEL_FILE := prebuilts/qemu-kernel/$(EMULATOR_KERNEL_ARCH)/$(EMULATOR_KERNEL_VERSION)/kernel-qemu2 68 69$(EMU_EXTRA_TARGET): PRIVATE_PACKAGE_SRC := \ 70 $(call intermediates-dir-for, PACKAGING, emu_extra_target) 71 72$(EMU_EXTRA_TARGET): $(EMU_EXTRA_FILES) $(EMULATOR_KERNEL_FILE) $(SOONG_ZIP) 73 @echo "Package: $@" 74 rm -rf $@ $(PRIVATE_PACKAGE_SRC) 75 mkdir -p $(PRIVATE_PACKAGE_SRC)/$(TARGET_ARCH)/prebuilts/qemu-kernel/$(TARGET_ARCH) 76 touch $(PRIVATE_PACKAGE_SRC)/$(TARGET_ARCH)/prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu 77 $(foreach f,$(EMU_EXTRA_FILES), cp $(f) $(PRIVATE_PACKAGE_SRC)/$(TARGET_ARCH)/$(notdir $(f)) &&) true 78 cp $(EMULATOR_KERNEL_FILE) $(PRIVATE_PACKAGE_SRC)/$(TARGET_ARCH)/${EMULATOR_KERNEL_DIST_NAME} 79 cp -r $(PRODUCT_OUT)/data $(PRIVATE_PACKAGE_SRC)/$(TARGET_ARCH) 80 mkdir -p $(PRIVATE_PACKAGE_SRC)/$(TARGET_ARCH)/system 81 cp $(PRODUCT_OUT)/system/build.prop $(PRIVATE_PACKAGE_SRC)/$(TARGET_ARCH)/system 82 $(SOONG_ZIP) -o $@ -C $(PRIVATE_PACKAGE_SRC) -D $(PRIVATE_PACKAGE_SRC)/$(TARGET_ARCH) 83 84.PHONY: emu_extra_imgs 85emu_extra_imgs: $(EMU_EXTRA_TARGET) 86 87$(call dist-for-goals, emu_extra_imgs, $(EMU_EXTRA_TARGET)) 88 89include $(call all-makefiles-under,$(LOCAL_PATH)) 90endif 91