1# Copyright (C) 2019 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16# The generic product target doesn't have any hardware-specific pieces.
17TARGET_NO_BOOTLOADER := true
18TARGET_NO_KERNEL := true
19TARGET_ARCH := arm64
20TARGET_ARCH_VARIANT := armv8-a
21TARGET_CPU_VARIANT := generic
22TARGET_CPU_ABI := arm64-v8a
23TARGET_CPU_ABI2 :=
24TARGET_BOOTLOADER_BOARD_NAME := trusty_$(TARGET_ARCH)
25
26TARGET_2ND_ARCH := arm
27TARGET_2ND_ARCH_VARIANT := armv8-a
28TARGET_2ND_CPU_ABI := armeabi-v7a
29TARGET_2ND_CPU_ABI2 := armeabi
30TARGET_2ND_CPU_VARIANT := generic
31
32BOARD_SEPOLICY_DIRS += device/generic/trusty/sepolicy
33
34
35# We want goldfish build configuration information, but not the resulting
36# QEMU images. QEMU_CUSTOMIZATIONS turns this on without building the images
37# like BUILD_QEMU_IMAGES would imply.
38QEMU_CUSTOMIZATIONS := true
39
40# Include the ramdisk image into the target files because
41# the prebuilts in the Trusty manifest need it there.
42BOARD_IMG_USE_RAMDISK := true
43BOARD_RAMDISK_USE_LZ4 := true
44BOARD_USES_GENERIC_KERNEL_IMAGE := true
45
46TARGET_KERNEL_USE ?= 6.6
47TARGET_KERNEL_ARCH ?= $(TARGET_ARCH)
48TARGET_KERNEL_PATH ?= kernel/prebuilts/$(TARGET_KERNEL_USE)/$(TARGET_KERNEL_ARCH)/kernel-$(TARGET_KERNEL_USE)
49
50# Copy kernel image for use by emulator
51PRODUCT_COPY_FILES += $(TARGET_KERNEL_PATH):kernel
52
53# Distribute kernel image. Normally the kernel would be in boot.img,
54# but because we do not use a boot.img we need to dist the kernel image itself.
55ifneq ($(filter $(TARGET_PRODUCT), qemu_trusty_arm64),)
56$(call dist-for-goals, dist_files, $(PRODUCT_OUT)/kernel)
57endif
58
59# The list of modules strictly/only required either to reach second stage
60# init, OR for recovery. Do not use this list to workaround second stage
61# issues.
62VIRTUAL_DEVICE_MODULES_PATH ?= \
63    kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/$(subst _,-,$(TARGET_KERNEL_ARCH))
64RAMDISK_VIRTUAL_DEVICE_MODULES := \
65    failover.ko \
66    net_failover.ko \
67    virtio_mmio.ko \
68    virtio_net.ko \
69
70SYSTEM_DLKM_SRC ?= kernel/prebuilts/$(TARGET_KERNEL_USE)/$(TARGET_KERNEL_ARCH)
71RAMDISK_SYSTEM_MODULES := \
72    virtio_blk.ko \
73    virtio_console.ko \
74    virtio_pci.ko \
75
76# TODO(b/301606895): use kernel/prebuilts/common-modules/trusty when we have it
77TRUSTY_MODULES_PATH ?= \
78    kernel/prebuilts/common-modules/trusty/$(TARGET_KERNEL_USE)/$(subst _,-,$(TARGET_KERNEL_ARCH))
79RAMDISK_TRUSTY_MODULES := \
80    system_heap.ko \
81    trusty-core.ko \
82    trusty-ipc.ko \
83    trusty-log.ko \
84    trusty-test.ko \
85    trusty-virtio.ko \
86
87# Trusty modules should come after virtual device modules to preserve virtio
88# device numbering and /dev devices names, which we rely on for the rpmb and
89# test-runner virtio console ports.
90BOARD_VENDOR_RAMDISK_KERNEL_MODULES := \
91    $(wildcard $(patsubst %,$(VIRTUAL_DEVICE_MODULES_PATH)/%,$(RAMDISK_VIRTUAL_DEVICE_MODULES))) \
92    $(wildcard $(patsubst %,$(SYSTEM_DLKM_SRC)/%,$(RAMDISK_SYSTEM_MODULES))) \
93    $(patsubst %,$(TRUSTY_MODULES_PATH)/%,$(RAMDISK_TRUSTY_MODULES)) \
94
95# GKI >5.15 will have and require virtio_pci_legacy_dev.ko
96BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard $(VIRTUAL_DEVICE_MODULES_PATH)/virtio_pci_legacy_dev.ko)
97# GKI >5.10 will have and require virtio_pci_modern_dev.ko
98BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard $(VIRTUAL_DEVICE_MODULES_PATH)/virtio_pci_modern_dev.ko)
99# GKI >6.4 will have an required vmw_vsock_virtio_transport_common.ko and vsock.ko
100BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
101    $(wildcard $(VIRTUAL_DEVICE_MODULES_PATH)/vmw_vsock_virtio_transport_common.ko) \
102    $(wildcard $(VIRTUAL_DEVICE_MODULES_PATH)/vsock.ko)
103
104TARGET_USERIMAGES_USE_EXT4 := true
105BOARD_SYSTEMIMAGE_PARTITION_SIZE := 536870912 # 512M
106BOARD_USERDATAIMAGE_PARTITION_SIZE := 268435456 # 256M
107TARGET_COPY_OUT_VENDOR := vendor
108# ~100 MB vendor image. Please adjust system image / vendor image sizes
109# when finalizing them.
110BOARD_VENDORIMAGE_PARTITION_SIZE := 67108864 # 64M
111BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
112BOARD_FLASH_BLOCK_SIZE := 512
113TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
114
115BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
116BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
117
118# Enable A/B update
119TARGET_NO_RECOVERY := true
120
121# Specify HALs
122DEVICE_MANIFEST_FILE := device/generic/trusty/manifest.xml
123
124# Enable full VNDK support
125BOARD_VNDK_VERSION := current
126