aboutsummaryrefslogtreecommitdiff
path: root/gki_common.mk
diff options
context:
space:
mode:
authorSzuWei Lin <szuweilin@google.com>2021-12-30 18:40:38 +0800
committerSzuWei Lin <szuweilin@google.com>2022-01-10 17:53:54 +0800
commitf346c9a7479e5400dc1cec281d6a31e79f064cad (patch)
tree19bac579c2c2da16d7996ba13f331b0fb2620462 /gki_common.mk
parent3d8ca6c8ed1eed76443bc7432b0f0280b0b9ffc9 (diff)
downloadcommon-f346c9a7479e5400dc1cec281d6a31e79f064cad.tar.gz
Add targets for building boot.img with GKI
The patch adds 2 targets gki_arm64 and gki_x86_64 for building all boot.img with GKI. The new targets also output init_boot.img. The patch initials the new targets by including minimum modules as possible. With the patch, it is no need to build GKI from GSI targets, and will remove outputting GKI from GSI targets, such as gsi_$arch and aosp_$arch. Bug: 212486689 Test: lunch gki_arm64-userdebug; make dist Test: lunch gki_x86_64-userdebug; make bootimage dist Change-Id: I90ecfddbc080086b549545415506867633133a45
Diffstat (limited to 'gki_common.mk')
-rw-r--r--gki_common.mk111
1 files changed, 111 insertions, 0 deletions
diff --git a/gki_common.mk b/gki_common.mk
new file mode 100644
index 0000000..b2b717d
--- /dev/null
+++ b/gki_common.mk
@@ -0,0 +1,111 @@
+#
+# Copyright (C) 2022 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# The files will be copy from the source folder to the dist folder
+_output-kernel-info-files := \
+ prebuilt-info.txt \
+ manifest.xml \
+
+
+# Copy the files from the source folder to the dist folder
+#
+# Skip if the file is not existing.
+#
+# $(1): file list
+# $(2): the source folder
+# $(3): the dist folder
+define _output_kernel_files
+$(foreach f,$(1), \
+ $(if $(wildcard $(2)/$(f)), \
+ $(call dist-for-goals,dist_files,$(2)/$(f):$(3)/$(f))))
+endef
+
+
+# Output the release kernel prebuilt files to dist folder
+#
+# $(1): the source folder contains the kernel prebuilt files
+# $(2): the dist folder
+#
+# Notes:
+# For mainline kernel, it outputs -allsyms kernel as release kernel.
+#
+define _output-kernel-user
+$(if $(findstring mainline,$(1)), \
+ $(eval PRODUCT_COPY_FILES += \
+ $(foreach f,$(wildcard $(1)/kernel-*-allsyms), \
+ $(f):$(subst -allsyms,,$(notdir $(f))))), \
+ $(eval PRODUCT_COPY_FILES += \
+ $(call copy-files,$(filter-out *-allsyms,$(wildcard $(1)/kernel-*)),.)))
+endef
+
+
+# Output the debug kernel prebuilt files to dist folder
+#
+# $(1): the source folder contains the kernel prebuilt files
+# $(2): the dist folder
+#
+# Note:
+# For mainline kernel, it outputs -allsyms kernel as release kernel,
+# so there is no need to output -allsyms again.
+#
+define _output-kernel-debug
+$(if $(findstring mainline,$(1)),, \
+ $(eval PRODUCT_COPY_FILES += \
+ $(call copy-files,$(wildcard $(1)/kernel-*-allsyms),.)))
+endef
+
+
+# Output the kernel prebuilt files to dist folder
+#
+# $(1): the source folder contains the kernel prebuilt files
+# $(2): the dist folder
+#
+# Example:
+# $(call output-kernel,kernel/prebuilts/5.10/arm64,kernel/5.10)
+#
+define output-kernel
+$(call _output-kernel-user,$(1),$(2))
+$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)), \
+ $(call _output-kernel-debug,$(1),$(2)))
+$(call _output_kernel_files,$(_output-kernel-info-files),$(1),$(2))
+endef
+
+#
+# Output boot.img and init-boot.img
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/generic_ramdisk.mk)
+PRODUCT_BUILD_BOOT_IMAGE := true
+PRODUCT_BUILD_INIT_BOOT_IMAGE := true
+
+PRODUCT_BUILD_CACHE_IMAGE := false
+PRODUCT_BUILD_ODM_IMAGE := false
+PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false
+PRODUCT_BUILD_ODM_DLKM_IMAGE := false
+PRODUCT_BUILD_PRODUCT_IMAGE := false
+PRODUCT_BUILD_RAMDISK_IMAGE := true
+PRODUCT_BUILD_SYSTEM_IMAGE := false
+PRODUCT_BUILD_SYSTEM_EXT_IMAGE := false
+PRODUCT_BUILD_SYSTEM_OTHER_IMAGE := false
+PRODUCT_BUILD_USERDATA_IMAGE := false
+PRODUCT_BUILD_VENDOR_IMAGE := false
+PRODUCT_BUILD_VENDOR_BOOT_IMAGE := false
+PRODUCT_BUILD_RECOVERY_IMAGE := false
+PRODUCT_BUILD_VBMETA_IMAGE := false
+PRODUCT_BUILD_DEBUG_BOOT_IMAGE := false
+PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE := false
+
+MODULE_BUILD_FROM_SOURCE := true
+PRODUCT_EXPORT_BOOT_IMAGE_TO_DIST := true