1#
2# Copyright 2022 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
17# FIXME: Split up and merge back in with shared/BoardConfig.mk
18
19TARGET_KERNEL_USE ?= 6.1
20TARGET_KERNEL_ARCH ?= $(TARGET_ARCH)
21TARGET_KERNEL_PATH ?= kernel/prebuilts/$(TARGET_KERNEL_USE)/$(TARGET_KERNEL_ARCH)/kernel-$(TARGET_KERNEL_USE)
22KERNEL_MODULES_PATH ?= \
23    kernel/prebuilts/common-modules/virtual-device/$(TARGET_KERNEL_USE)/$(subst _,-,$(TARGET_KERNEL_ARCH))
24PRODUCT_COPY_FILES += $(TARGET_KERNEL_PATH):kernel
25
26# The list of modules strictly/only required either to reach second stage
27# init, OR for recovery. Do not use this list to workaround second stage
28# issues.
29RAMDISK_KERNEL_MODULES := \
30    failover.ko \
31    net_failover.ko \
32    virtio_blk.ko \
33    virtio_console.ko \
34    virtio_net.ko \
35    virtio_pci.ko \
36    virtio_pci_modern_dev.ko \
37    virtio-rng.ko \
38    vmw_vsock_virtio_transport.ko \
39
40BOARD_VENDOR_RAMDISK_KERNEL_MODULES := \
41    $(patsubst %,$(KERNEL_MODULES_PATH)/%,$(RAMDISK_KERNEL_MODULES))
42
43# GKI >5.15 will have and require virtio_pci_legacy_dev.ko
44BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard $(KERNEL_MODULES_PATH)/virtio_pci_legacy_dev.ko)
45# GKI >6.4 will have an required vmw_vsock_virtio_transport_common.ko and vsock.ko
46BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \
47	$(wildcard $(KERNEL_MODULES_PATH)/vmw_vsock_virtio_transport_common.ko) \
48	$(wildcard $(KERNEL_MODULES_PATH)/vsock.ko)
49
50TARGET_NO_RECOVERY := true
51
52BOARD_VENDOR_RAMDISK_KERNEL_MODULES_BLOCKLIST_FILE := \
53    device/google/cuttlefish/shared/modules.blocklist
54
55BOARD_VENDOR_RAMDISK_KERNEL_MODULES_OPTIONS_FILE := \
56    device/google/cuttlefish/shared/config/first_stage_modules.options
57
58TARGET_BOOTLOADER_BOARD_NAME := cutf
59
60BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := ext4
61BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
62
63# Disable sparse on all filesystem images
64# This will prevent sparsing of super.img
65TARGET_USERIMAGES_SPARSE_EROFS_DISABLED ?= true
66TARGET_USERIMAGES_SPARSE_EXT_DISABLED ?= true
67TARGET_USERIMAGES_SPARSE_F2FS_DISABLED ?= true
68
69# FIXME: Not needed for minidroid, but needs fixes to CF assembler
70BOARD_USERDATAIMAGE_PARTITION_SIZE := 67108864
71BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4
72TARGET_USERIMAGES_USE_EXT4 := true
73
74BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864
75BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE := 8388608
76BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 67108864
77
78BOARD_AVB_ENABLE := true
79BOARD_AVB_ALGORITHM := SHA256_RSA4096
80BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
81
82BOARD_AVB_VBMETA_SYSTEM := system
83BOARD_AVB_VBMETA_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
84BOARD_AVB_VBMETA_SYSTEM_ALGORITHM := SHA256_RSA4096
85BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
86BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
87
88BOARD_AVB_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
89BOARD_AVB_BOOT_ALGORITHM := SHA256_RSA4096
90BOARD_AVB_BOOT_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
91BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION := 2
92
93BOARD_AVB_INIT_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
94BOARD_AVB_INIT_BOOT_ALGORITHM := SHA256_RSA4096
95BOARD_AVB_INIT_BOOT_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
96BOARD_AVB_INIT_BOOT_ROLLBACK_INDEX_LOCATION := 3
97
98TARGET_AVB_SYSTEM_HASHTREE_ALGORITHM ?= sha256
99BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --hash_algorithm $(TARGET_AVB_SYSTEM_HASHTREE_ALGORITHM)
100
101BOARD_MALLOC_ALIGNMENT := 16
102
103BOARD_USES_GENERIC_KERNEL_IMAGE := true
104
105PRODUCT_COPY_FILES += \
106    device/google/cuttlefish/dtb.img:dtb.img \
107    device/google/cuttlefish/required_images:required_images \
108
109BOARD_BOOTLOADER_IN_UPDATE_PACKAGE := true
110BOARD_RAMDISK_USE_LZ4 := true
111
112# Default to minidroid, if not set.
113LOCAL_ANDROIDBOOT_HARDWARE ?= minidroid
114# Default to minidroid's primary init .rc, if not set.
115LOCAL_ANDROIDBOOT_INIT_RC ?= /system/etc/init/hw/init.minidroid.rc
116
117BOARD_KERNEL_CMDLINE += printk.devkmsg=on
118BOARD_KERNEL_CMDLINE += audit=1
119BOARD_KERNEL_CMDLINE += panic=-1
120BOARD_KERNEL_CMDLINE += 8250.nr_uarts=1
121BOARD_KERNEL_CMDLINE += cma=0
122BOARD_KERNEL_CMDLINE += firmware_class.path=/vendor/etc/
123BOARD_KERNEL_CMDLINE += loop.max_part=7
124BOARD_KERNEL_CMDLINE += init=/init
125BOARD_BOOTCONFIG += androidboot.hardware=$(LOCAL_ANDROIDBOOT_HARDWARE)
126BOARD_BOOTCONFIG += \
127    androidboot.init_rc=$(LOCAL_ANDROIDBOOT_INIT_RC)
128BOARD_BOOTCONFIG += \
129    kernel.vmw_vsock_virtio_transport_common.virtio_transport_max_vsock_pkt_buf_size=16384
130BOARD_BOOTCONFIG += \
131    androidboot.microdroid.debuggable=1 \
132    androidboot.adb.enabled=1
133
134BOARD_INCLUDE_DTB_IN_BOOTIMG := true
135BOARD_BOOT_HEADER_VERSION := 4
136BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
137BOARD_INIT_BOOT_HEADER_VERSION := 4
138BOARD_MKBOOTIMG_INIT_ARGS += --header_version $(BOARD_INIT_BOOT_HEADER_VERSION)
139
140BOARD_GOOGLE_SYSTEM_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor
141# reserve 256MiB for dynamic partition metadata
142BOARD_GOOGLE_SYSTEM_DYNAMIC_PARTITIONS_SIZE := 268435456
143
144# 1MiB bigger than the dynamic partition to make build happy...
145BOARD_SUPER_PARTITION_SIZE := 269484032
146BOARD_SUPER_PARTITION_GROUPS := google_system_dynamic_partitions
147BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT := true
148BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE := true
149
150TARGET_SKIP_OTA_PACKAGE := true
151TARGET_SKIP_OTATOOLS_PACKAGE := true
152
153BOARD_VENDOR_SEPOLICY_DIRS += device/google/cuttlefish/shared/sepolicy/vendor/seriallogging
154