diff --git a/core/Makefile b/core/Makefile index 3aa6ae23e8..df5c6b2ba4 100644 --- a/core/Makefile +++ b/core/Makefile @@ -711,6 +711,10 @@ else BUILT_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img endif +# kernel cmdline for GKI +GENERIC_KERNEL_CMDLINE := rw +.KATI_READONLY := GENERIC_KERNEL_CMDLINE + # $1: boot image target # returns the kernel used to make the bootimage define bootimage-to-kernel @@ -754,30 +758,27 @@ endif INTERNAL_KERNEL_CMDLINE := $(strip $(INTERNAL_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID)) -boot_uses_generic_kernel_image := -ifdef BUILDING_VENDOR_BOOT_IMAGE - # building vendor boot image, dtb/base/pagesize go there - boot_uses_generic_kernel_image := true -else ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE)) - boot_uses_generic_kernel_image := true -endif - -ifeq (true,$(boot_uses_generic_kernel_image)) +# kernel cmdline/base/pagesize in boot. +# - If using GKI, use GENERIC_KERNEL_CMDLINE. Remove kernel base and pagesize because they are +# device-specific. +# - If not using GKI: +# - If building vendor_boot, INTERNAL_KERNEL_CMDLINE, base and pagesize goes in vendor_boot. +# - Otherwise, put them in boot. +ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE)) ifdef GENERIC_KERNEL_CMDLINE INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)" endif -else # boot_uses_generic_kernel_image != true -ifdef BOARD_KERNEL_BASE - INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) -endif -ifdef BOARD_KERNEL_PAGESIZE - INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) -endif -ifdef INTERNAL_KERNEL_CMDLINE - INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)" -endif -endif # boot_uses_generic_kernel_image == true -boot_uses_generic_kernel_image := +else ifndef BUILDING_VENDOR_BOOT_IMAGE # && BOARD_USES_GENERIC_KERNEL_IMAGE != true + ifdef INTERNAL_KERNEL_CMDLINE + INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)" + endif + ifdef BOARD_KERNEL_BASE + INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) + endif + ifdef BOARD_KERNEL_PAGESIZE + INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) + endif +endif # BUILDING_VENDOR_BOOT_IMAGE == "" && BOARD_USES_GENERIC_KERNEL_IMAGE != true INTERNAL_MKBOOTIMG_VERSION_ARGS := \ --os_version $(PLATFORM_VERSION_LAST_STABLE) \ @@ -1909,19 +1910,10 @@ $(INSTALLED_RECOVERY_RAMDISK_BUILD_PROP_TARGET): $(INSTALLED_RAMDISK_BUILD_PROP_ $(copy-file-to-target) endif -ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER))) - INTERNAL_RECOVERYIMAGE_ARGS := --ramdisk $(recovery_ramdisk) +INTERNAL_RECOVERYIMAGE_ARGS := --ramdisk $(recovery_ramdisk) -ifneq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE)) -ifdef GENERIC_KERNEL_CMDLINE - INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)" -endif # GENERIC_KERNEL_CMDLINE != "" -endif # BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE != true - -else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER) - INTERNAL_RECOVERYIMAGE_ARGS := \ - $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ - --ramdisk $(recovery_ramdisk) +ifneq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(BOARD_USES_RECOVERY_AS_BOOT))) +INTERNAL_RECOVERYIMAGE_ARGS += $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) # Assumes this has already been stripped ifneq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE)) ifdef INTERNAL_KERNEL_CMDLINE @@ -1947,7 +1939,7 @@ endif ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET) endif -endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined +endif # (BUILDING_VENDOR_BOOT_IMAGE and BOARD_USES_RECOVERY_AS_BOOT) ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS) endif @@ -4511,11 +4503,7 @@ else ifneq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE)) cp $(firstword $(INSTALLED_KERNEL_TARGET)) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel endif endif -ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER))) -ifneq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE)) - echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline -endif # BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE != true -else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER) +ifneq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(BOARD_USES_RECOVERY_AS_BOOT))) ifdef INSTALLED_2NDBOOTLOADER_TARGET cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second endif @@ -4543,7 +4531,7 @@ endif ifdef BOARD_KERNEL_PAGESIZE echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize endif -endif # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER) +endif # not (BUILDING_VENDOR_BOOT_IMAGE and BOARD_USES_RECOVERY_AS_BOOT) endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true @# Components of the boot image $(hide) mkdir -p $(zip_root)/BOOT @@ -4559,11 +4547,9 @@ endif ifdef INSTALLED_KERNEL_TARGET $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/ endif -ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET +ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE)) echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline -else ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE)) - echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline -else # INSTALLED_VENDOR_BOOTIMAGE_TARGET == "" && BOARD_USES_GENERIC_KERNEL_IMAGE != true +else ifndef INSTALLED_VENDOR_BOOTIMAGE_TARGET # && BOARD_USES_GENERIC_KERNEL_IMAGE != true echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline ifdef INSTALLED_2NDBOOTLOADER_TARGET cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second