Fix init_boot.img build rule with TARGET_NO_KERNEL:=true

If TARGET_NO_KERNEL is true (device has prebuilt boot.img), then the
init_boot.img build arguments wouldn't be propagated correctly.
This is because INTERNAL_INIT_BOOT_IMAGE_ARGS is misplaced within a
`ifneq ($(strip $(TARGET_NO_KERNEL)),true)` conditional block.

Fix this by moving INTERNAL_INIT_BOOT_IMAGE_ARGS initialization into the
`ifeq ($(BUILDING_INIT_BOOT_IMAGE),true)` block, which is closer to its
first use.

Bug: 237630862
Test: m initbootimage
Change-Id: I6c0ee2c4b5d0be77a93311eba714e0ed555ffd25
This commit is contained in:
Yi-Yo Chiang 2022-06-30 17:33:29 +08:00
parent ea00bc65af
commit 8b0776d1ca

View file

@ -967,15 +967,11 @@ ifneq ($(strip $(TARGET_NO_KERNEL)),true)
INTERNAL_BOOTIMAGE_ARGS := \
$(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET))
INTERNAL_INIT_BOOT_IMAGE_ARGS :=
# TODO(b/229701033): clean up BOARD_BUILD_GKI_BOOT_IMAGE_WITHOUT_RAMDISK.
ifneq ($(BOARD_BUILD_GKI_BOOT_IMAGE_WITHOUT_RAMDISK),true)
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
ifneq ($(BUILDING_INIT_BOOT_IMAGE),true)
INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
else
INTERNAL_INIT_BOOT_IMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
endif
endif
endif
@ -1222,6 +1218,8 @@ ifeq ($(BUILDING_INIT_BOOT_IMAGE),true)
INSTALLED_INIT_BOOT_IMAGE_TARGET := $(PRODUCT_OUT)/init_boot.img
$(INSTALLED_INIT_BOOT_IMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_RAMDISK_TARGET)
INTERNAL_INIT_BOOT_IMAGE_ARGS := --ramdisk $(INSTALLED_RAMDISK_TARGET)
ifdef BOARD_KERNEL_PAGESIZE
INTERNAL_INIT_BOOT_IMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
endif