Parameterize GKI version for Cuttlefish
Bug: 181222920
Test: $ lunch aosp_cf_x86_64_phone-userdebug; m
$ launch_cvd -daemon -resume=false -start_vnc_server=true
$ adb shell uname -a
Linux localhost 5.10.17-android12-0-00810-ge146d4c5bd36-ab7166491 #1 SMP PREEMPT Wed Feb 24 00:27:45 UTC 2021 x86_64
$ stop_cvd
$ m installclean; GKI_VER=5.4 m
$ launch_cvd -daemon -resume=false -start_vnc_server=true
$ adb shell uname -a
Linux localhost 5.4.100-android12-0-00412-g7ba24942b70e-ab7166325 #1 SMP PREEMPT Tue Feb 23 19:23:22 UTC 2021 x86_64
$ stop_cvd
#
# For vsoc_arm64
$ lunch aosp_cf_arm64_phone-userdebug; m bootimage
$ diff $OUT/kernel kernel/prebuilts/5.10/arm64/kernel-5.10; echo $?
0
$ GKI_VER=5.4 m bootimage
$ diff $OUT/kernel kernel/prebuilts/5.4/arm64/kernel-5.4; $ echo $?
0
#
# For vsoc_x86_only
$ lunch aosp_cf_x86_only_phone-userdebug; m bootimage
$ diff device/google/cuttlefish_prebuilts/kernel/5.10-i686/kernel-5.10 $OUT/kernel; echo $?
0
$ GKI_VER=5.4 m bootimage
$ diff device/google/cuttlefish_prebuilts/kernel/5.4-i686/kernel-5.4 $OUT/kernel; echo $?
0
Change-Id: Ic30976bef985e0a8aa4b24c3eca0b08c2dd48d88
diff --git a/vsoc_arm64/BoardConfig.mk b/vsoc_arm64/BoardConfig.mk
index 238419b..048d8cd 100644
--- a/vsoc_arm64/BoardConfig.mk
+++ b/vsoc_arm64/BoardConfig.mk
@@ -20,6 +20,9 @@
-include device/google/cuttlefish/shared/BoardConfig.mk
+# GKI_VER is defined in kernel.mk, if not defined in the environment variable.
+BOARD_KERNEL_MODULE_INTERFACE_VERSIONS := $(GKI_VER)-android12-0
+
TARGET_BOARD_PLATFORM := vsoc_arm64
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
@@ -33,7 +36,7 @@
TARGET_TRANSLATE_2ND_ARCH := false
ifeq ($(BOARD_VENDOR_RAMDISK_KERNEL_MODULES),)
- BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard kernel/prebuilts/common-modules/virtual-device/5.10/arm64/*.ko)
+ BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard kernel/prebuilts/common-modules/virtual-device/$(GKI_VER)/arm64/*.ko)
endif
HOST_CROSS_OS := linux_bionic
diff --git a/vsoc_arm64/kernel.mk b/vsoc_arm64/kernel.mk
index d8e2137..bcc15cf 100644
--- a/vsoc_arm64/kernel.mk
+++ b/vsoc_arm64/kernel.mk
@@ -13,4 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-PRODUCT_COPY_FILES += kernel/prebuilts/5.10/arm64/kernel-5.10:kernel
+GKI_VER ?= 5.10
+
+PRODUCT_COPY_FILES += kernel/prebuilts/$(GKI_VER)/arm64/kernel-$(GKI_VER):kernel
diff --git a/vsoc_x86_64/BoardConfig.mk b/vsoc_x86_64/BoardConfig.mk
index b69d6f6..7e3d927 100644
--- a/vsoc_x86_64/BoardConfig.mk
+++ b/vsoc_x86_64/BoardConfig.mk
@@ -20,6 +20,9 @@
-include device/google/cuttlefish/shared/BoardConfig.mk
+# GKI_VER is defined in kernel.mk, if not defined in the environment variable.
+BOARD_KERNEL_MODULE_INTERFACE_VERSIONS := $(GKI_VER)-android12-0
+
TARGET_BOARD_PLATFORM := vsoc_x86_64
TARGET_ARCH := x86_64
TARGET_ARCH_VARIANT := silvermont
@@ -43,5 +46,5 @@
BUILD_BROKEN_DUP_RULES := true
ifeq ($(BOARD_VENDOR_RAMDISK_KERNEL_MODULES),)
- BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard kernel/prebuilts/common-modules/virtual-device/5.10/x86-64/*.ko)
+ BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard kernel/prebuilts/common-modules/virtual-device/$(GKI_VER)/x86-64/*.ko)
endif
diff --git a/vsoc_x86_64/kernel.mk b/vsoc_x86_64/kernel.mk
index ff8f17d..dccbeda 100644
--- a/vsoc_x86_64/kernel.mk
+++ b/vsoc_x86_64/kernel.mk
@@ -13,4 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-PRODUCT_COPY_FILES += kernel/prebuilts/5.10/x86_64/kernel-5.10:kernel
+GKI_VER ?= 5.10
+
+PRODUCT_COPY_FILES += kernel/prebuilts/$(GKI_VER)/x86_64/kernel-$(GKI_VER):kernel
diff --git a/vsoc_x86_only/BoardConfig.mk b/vsoc_x86_only/BoardConfig.mk
index 813403c..ec97f2d 100644
--- a/vsoc_x86_only/BoardConfig.mk
+++ b/vsoc_x86_only/BoardConfig.mk
@@ -20,9 +20,12 @@
-include device/google/cuttlefish/shared/BoardConfig.mk
+# GKI_VER is defined in kernel.mk, if not defined in the environment variable.
+BOARD_KERNEL_MODULE_INTERFACE_VERSIONS := $(GKI_VER)-android12-0
+
TARGET_BOARD_PLATFORM := vsoc_x86
TARGET_ARCH := x86
TARGET_ARCH_VARIANT := x86
TARGET_CPU_ABI := x86
-BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard device/google/cuttlefish_prebuilts/kernel/5.10-i686/*.ko)
+BOARD_VENDOR_RAMDISK_KERNEL_MODULES += $(wildcard device/google/cuttlefish_prebuilts/kernel/$(GKI_VER)-i686/*.ko)
diff --git a/vsoc_x86_only/kernel.mk b/vsoc_x86_only/kernel.mk
index 2bf1838..e6d4924 100644
--- a/vsoc_x86_only/kernel.mk
+++ b/vsoc_x86_only/kernel.mk
@@ -13,4 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-PRODUCT_COPY_FILES += device/google/cuttlefish_prebuilts/kernel/5.10-i686/kernel-5.10:kernel
+GKI_VER ?= 5.10
+
+PRODUCT_COPY_FILES += device/google/cuttlefish_prebuilts/kernel/$(GKI_VER)-i686/kernel-$(GKI_VER):kernel