1#
2# Copyright 2020 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# Enable sparse on all filesystem images
18TARGET_USERIMAGES_SPARSE_EROFS_DISABLED ?= false
19TARGET_USERIMAGES_SPARSE_EXT_DISABLED ?= false
20TARGET_USERIMAGES_SPARSE_F2FS_DISABLED ?= false
21
22#
23# arm64 target for Trout
24#
25ifndef TARGET_BOOTLOADER_BOARD_NAME
26TARGET_BOOTLOADER_BOARD_NAME := trout
27endif
28
29BOARD_BOOT_HEADER_VERSION := 4
30
31# Kernel - prefer version 6.1 by default for trout
32TARGET_KERNEL_USE ?= 6.1
33
34# Select the prebuilt trout kernel if 5.10 or 5.4 is in use
35TROUT_KERNEL_DIR ?= $(wildcard device/google/trout-kernel/$(TARGET_KERNEL_USE)-arm64)
36
37TARGET_BOARD_PLATFORM := vsoc_arm64
38TARGET_ARCH := arm64
39TARGET_ARCH_VARIANT := armv8-a
40TARGET_CPU_ABI := arm64-v8a
41TARGET_CPU_VARIANT := cortex-a53
42
43ifneq ($(TROUT_KERNEL_DIR),)
44KERNEL_MODULES_PATH ?= $(TROUT_KERNEL_DIR)
45TARGET_KERNEL_PATH ?= $(TROUT_KERNEL_DIR)/Image
46
47# For local builds of the android12-5.10 kernel, this directory doesn't exist.
48# The system_dlkm partition won't have any kernel modules in it, which matches
49# how this kernel was originally used.
50#
51# For prebuilts of the android12-5.10 kernel, the result is the same.
52#
53# For local builds of the android14-6.1 kernel and later, this directory should
54# be created by extracting the system_dlkm_staging_archive.tar.gz file in the
55# build directory of the kernel before building the android image.
56#
57# For prebuilts of the android14-6.1 kernel and later, TROUT_KERNEL_DIR should
58# not be specified, in which case it will follow whatever the upstream
59# cuttlefish device specifies.
60SYSTEM_DLKM_SRC ?= $(TROUT_KERNEL_DIR)/flatten/lib/modules
61endif
62
63# The list of modules strictly/only required either to reach second stage
64# init, OR for recovery. Do not use this list to workaround second stage
65# issues.
66RAMDISK_KERNEL_MODULES ?= \
67    failover.ko \
68    nd_virtio.ko \
69    net_failover.ko \
70    virtio_blk.ko \
71    virtio_console.ko \
72    virtio_dma_buf.ko \
73    virtio-gpu.ko \
74    virtio_input.ko \
75    virtio_net.ko \
76    virtio_mmio.ko \
77    virtio_pci.ko \
78    virtio-rng.ko \
79    vmw_vsock_virtio_transport.ko \
80
81-include device/google/trout/shared/BoardConfig.mk
82
83AUDIOSERVER_MULTILIB := first
84
85HOST_CROSS_OS := linux_bionic
86HOST_CROSS_ARCH := arm64
87HOST_CROSS_2ND_ARCH :=
88
89# Android Bluetooth stack configuration
90LOCAL_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR ?= device/google/trout/product_files/bluetooth
91BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(LOCAL_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)
92
93# Turn off AVB so that trout can boot
94BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2
95BOARD_KERNEL_CMDLINE += androidboot.verifiedbootstate=orange
96
97# Set SELinux to permissive mode for trout
98BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
99BOARD_KERNEL_CMDLINE += enforcing=0
100
101# Declare trout as a Cuttlefish HW
102BOARD_KERNEL_CMDLINE += androidboot.hardware=cutf_cvm
103BOARD_KERNEL_CMDLINE += androidboot.serialno=CUTTLEFISHCVD01
104BOARD_KERNEL_CMDLINE += androidboot.cf_devcfg=1
105
106# Set GPU properties
107BOARD_KERNEL_CMDLINE += androidboot.cpuvulkan.version=0
108BOARD_KERNEL_CMDLINE += androidboot.hardware.gralloc=minigbm
109BOARD_KERNEL_CMDLINE += androidboot.hardware.hwcomposer=ranchu
110BOARD_KERNEL_CMDLINE += androidboot.hardware.egl=mesa
111BOARD_KERNEL_CMDLINE += androidboot.hardware.hwcomposer.mode=client
112BOARD_KERNEL_CMDLINE += androidboot.hardware.hwcomposer.display_finder_mode=drm
113BOARD_KERNEL_CMDLINE += androidboot.lcd_density=160
114
115# Add WiFi configuration for VirtWifi network
116BOARD_KERNEL_CMDLINE += androidboot.wifi_mac_prefix=5554
117
118# Add default fstab settings
119BOARD_KERNEL_CMDLINE += androidboot.fstab_name=fstab androidboot.fstab_suffix=trout
120
121# Prevent mac80211_hwsim from simulating any radios
122BOARD_KERNEL_CMDLINE += mac80211_hwsim.radios=0
123