summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Daniels <briandaniels@google.com>2024-04-04 10:52:23 -0400
committerBrian Daniels <briandaniels@google.com>2024-04-04 16:37:32 -0400
commite7a13bd030d3db7b326221125bf044c8f302ac87 (patch)
treed76c58bbd5e285a9ac289c67784bf432d59fc85c
parent28d1218b7980a8284a8db79a6e845fc22fba7da5 (diff)
downloadtrout-e7a13bd030d3db7b326221125bf044c8f302ac87.tar.gz
Prerequisite changes to switch to 6.1 kernel
- Add new partitions "system_dlkm" and "vendor_dlkm" - These are added to the fstab to ensure they're mounted. - These new partitions contain the remainder of the kernel modules that are loaded at second stage init. The initial kernel modules that are required to boot are contained in the vendor ramdisk. - Set mac80211_hwsim.radios=0 kernel module parameter - Cuttlefish uses bootconfig to set kernel parameters at build time. This requires support in the bootloader, but not all hypervisors support bootloaders. In this case we set the kernel module's parameter on the kernel command line. Bug: 315309338 Test: Build and verify functionality manually on a board Change-Id: Ia5c1fb6cc584833ff849f3759f68ea8872cb7033
-rw-r--r--product_files/fstab.trout2
-rw-r--r--trout_arm64/BoardConfig.mk56
2 files changed, 43 insertions, 15 deletions
diff --git a/product_files/fstab.trout b/product_files/fstab.trout
index 82726c8..d7c98c0 100644
--- a/product_files/fstab.trout
+++ b/product_files/fstab.trout
@@ -10,6 +10,8 @@ odm /odm ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,
product /product ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb
system_ext /system_ext ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb=vbmeta_system
vendor /vendor ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb=vbmeta
+vendor_dlkm /vendor_dlkm ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb=vbmeta_dlkm
+system_dlkm /system_dlkm ext4 noatime,ro,errors=panic wait,logical,first_stage_mount,slotselect,avb=vbmeta_system_dlkm
/dev/block/zram0 none swap defaults zramsize=75%
/tmp /sdcard none defaults,bind recoveryonly
/devices/*/block/vdb auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
diff --git a/trout_arm64/BoardConfig.mk b/trout_arm64/BoardConfig.mk
index 3d20522..f99db1a 100644
--- a/trout_arm64/BoardConfig.mk
+++ b/trout_arm64/BoardConfig.mk
@@ -51,32 +51,55 @@ BOARD_BOOT_HEADER_VERSION := 4
# Kernel - prefer version 5.10 by default for trout
TARGET_KERNEL_USE ?= 5.10
+# Select the prebuilt trout kernel if 5.10 or 5.4 is in use
TROUT_KERNEL_DIR ?= $(wildcard device/google/trout-kernel/$(TARGET_KERNEL_USE)-arm64)
-# The trout kernel is provided as source to AOSP,
-# and thus we cannot rely on it existing outside of Google-internal builds. Make sure not to try
-# and include a missing kernel image.
-ifndef TARGET_KERNEL_PATH
-# wildcard is for existence checking,
-# so TROUT_KERNEL_IMAGE is suppose to be a list that contains at most one path.
-# The foreach below is only for extracting the path from the list.
-TROUT_KERNEL_IMAGE := $(wildcard $(TROUT_KERNEL_DIR)/Image)
-$(foreach kernel_img, $(TROUT_KERNEL_IMAGE), $(eval TARGET_KERNEL_PATH := $(kernel_img)))
-endif
-
TARGET_BOARD_PLATFORM := vsoc_arm64
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_VARIANT := cortex-a53
--include device/google/trout/shared/BoardConfig.mk
+ifneq ($(TROUT_KERNEL_DIR),)
+KERNEL_MODULES_PATH ?= $(TROUT_KERNEL_DIR)
+TARGET_KERNEL_PATH ?= $(TROUT_KERNEL_DIR)/Image
-TROUT_KO_DIR ?= $(TROUT_KERNEL_DIR)
-ifneq ($(TROUT_KO_DIR),)
-BOARD_VENDOR_RAMDISK_KERNEL_MODULES := $(wildcard $(TROUT_KO_DIR)/*.ko)
+# For local builds of the android12-5.10 kernel, this directory doesn't exist.
+# The system_dlkm partition won't have any kernel modules in it, which matches
+# how this kernel was originally used.
+#
+# For prebuilts of the android12-5.10 kernel, the result is the same.
+#
+# For local builds of the android14-6.1 kernel and later, this directory should
+# be created by extracting the system_dlkm_staging_archive.tar.gz file in the
+# build directory of the kernel before building the android image.
+#
+# For prebuilts of the android14-6.1 kernel and later, TROUT_KERNEL_DIR should
+# not be specified, in which case it will follow whatever the upstream
+# cuttlefish device specifies.
+SYSTEM_DLKM_SRC ?= $(TROUT_KERNEL_DIR)/flatten/lib/modules
endif
+# The list of modules strictly/only required either to reach second stage
+# init, OR for recovery. Do not use this list to workaround second stage
+# issues.
+RAMDISK_KERNEL_MODULES ?= \
+ failover.ko \
+ nd_virtio.ko \
+ net_failover.ko \
+ virtio_blk.ko \
+ virtio_console.ko \
+ virtio_dma_buf.ko \
+ virtio-gpu.ko \
+ virtio_input.ko \
+ virtio_net.ko \
+ virtio_mmio.ko \
+ virtio_pci.ko \
+ virtio-rng.ko \
+ vmw_vsock_virtio_transport.ko \
+
+-include device/google/trout/shared/BoardConfig.mk
+
AUDIOSERVER_MULTILIB := first
HOST_CROSS_OS := linux_bionic
@@ -110,3 +133,6 @@ BOARD_KERNEL_CMDLINE += androidboot.wifi_mac_prefix=5554
# Add default fstab settings
BOARD_KERNEL_CMDLINE += androidboot.fstab_name=fstab androidboot.fstab_suffix=trout
+
+# Prevent mac80211_hwsim from simulating any radios
+BOARD_KERNEL_CMDLINE += mac80211_hwsim.radios=0