forked from openkylin/platform_build
Merge "Refactor vendor_boot v4 build logic and add more checks"
This commit is contained in:
commit
bebc8a35ef
|
@ -210,6 +210,40 @@ $(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
|
|||
echo "$$x"generic >> $@.tmp; done
|
||||
$(hide) mv $@.tmp $@
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Declare vendor ramdisk fragments
|
||||
INTERNAL_VENDOR_RAMDISK_FRAGMENTS :=
|
||||
|
||||
# Validation check and assign default --ramdisk_type.
|
||||
$(foreach vendor_ramdisk_fragment,$(BOARD_VENDOR_RAMDISK_FRAGMENTS), \
|
||||
$(if $(and $(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).KERNEL_MODULE_DIRS), \
|
||||
$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).PREBUILT)), \
|
||||
$(error Must not specify KERNEL_MODULE_DIRS for prebuilt vendor ramdisk fragment "$(vendor_ramdisk_fragment)": $(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).KERNEL_MODULE_DIRS))) \
|
||||
$(eval VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).STAGING_DIR := $(call intermediates-dir-for,PACKAGING,vendor_ramdisk_fragment-stage-$(vendor_ramdisk_fragment))) \
|
||||
$(eval VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).FILES :=) \
|
||||
$(if $(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).KERNEL_MODULE_DIRS), \
|
||||
$(if $(filter --ramdisk_type,$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS)),, \
|
||||
$(eval BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS += --ramdisk_type DLKM))) \
|
||||
)
|
||||
|
||||
# Create the "kernel module directory" to "vendor ramdisk fragment" inverse mapping.
|
||||
$(foreach vendor_ramdisk_fragment,$(BOARD_VENDOR_RAMDISK_FRAGMENTS), \
|
||||
$(foreach kmd,$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).KERNEL_MODULE_DIRS), \
|
||||
$(eval kmd_vrf := KERNEL_MODULE_DIR_VENDOR_RAMDISK_FRAGMENT_$(kmd)) \
|
||||
$(if $($(kmd_vrf)),$(error Kernel module directory "$(kmd)" belongs to multiple vendor ramdisk fragments: "$($(kmd_vrf))" "$(vendor_ramdisk_fragment)", each kernel module directory should belong to exactly one or none vendor ramdisk fragment)) \
|
||||
$(eval $(kmd_vrf) := $(vendor_ramdisk_fragment)) \
|
||||
) \
|
||||
)
|
||||
INTERNAL_VENDOR_RAMDISK_FRAGMENTS += $(BOARD_VENDOR_RAMDISK_FRAGMENTS)
|
||||
|
||||
# Assign --ramdisk_name for each vendor ramdisk fragment.
|
||||
$(foreach vendor_ramdisk_fragment,$(INTERNAL_VENDOR_RAMDISK_FRAGMENTS), \
|
||||
$(if $(filter --ramdisk_name,$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS)), \
|
||||
$(error Must not specify --ramdisk_name for vendor ramdisk fragment: $(vendor_ramdisk_fragment))) \
|
||||
$(eval BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS += --ramdisk_name $(vendor_ramdisk_fragment)) \
|
||||
$(eval .KATI_READONLY := BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS) \
|
||||
)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# kernel modules
|
||||
|
||||
|
@ -415,38 +449,24 @@ else
|
|||
VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR :=
|
||||
endif
|
||||
|
||||
# Create the "kernel module directory" to "vendor ramdisk fragment" inverse mapping.
|
||||
$(foreach vendor_ramdisk_fragment,$(BOARD_VENDOR_RAMDISK_FRAGMENTS), \
|
||||
$(if $(and $(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).KERNEL_MODULE_DIRS), \
|
||||
$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).PREBUILT)), \
|
||||
$(error Must not specify KERNEL_MODULE_DIRS for prebuilt vendor ramdisk fragment "$(vendor_ramdisk_fragment)": $(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).KERNEL_MODULE_DIRS))) \
|
||||
$(eval VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).STAGING_DIR := $(call intermediates-dir-for,PACKAGING,vendor_ramdisk_fragment-dlkm-$(vendor_ramdisk_fragment))) \
|
||||
$(eval VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).FILES :=) \
|
||||
$(foreach dir,$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).KERNEL_MODULE_DIRS), \
|
||||
$(eval kmd_vrf := KERNEL_MODULE_DIR_VENDOR_RAMDISK_FRAGMENT_$(dir)) \
|
||||
$(if $($(kmd_vrf)),$(error Kernel module directory "$(dir)" belongs to multiple vendor ramdisk fragments: "$($(kmd_vrf))" "$(vendor_ramdisk_fragment)", each kernel module directory should belong to exactly one or none vendor ramdisk fragment)) \
|
||||
$(eval $(kmd_vrf) := $(vendor_ramdisk_fragment)) \
|
||||
) \
|
||||
)
|
||||
|
||||
BOARD_KERNEL_MODULE_DIRS += top
|
||||
$(foreach dir,$(BOARD_KERNEL_MODULE_DIRS), \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,RECOVERY,$(TARGET_RECOVERY_ROOT_OUT),,modules.load.recovery,,$(dir))) \
|
||||
$(eval vendor_ramdisk_fragment := $(KERNEL_MODULE_DIR_VENDOR_RAMDISK_FRAGMENT_$(dir))) \
|
||||
$(foreach kmd,$(BOARD_KERNEL_MODULE_DIRS), \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,RECOVERY,$(TARGET_RECOVERY_ROOT_OUT),,modules.load.recovery,,$(kmd))) \
|
||||
$(eval vendor_ramdisk_fragment := $(KERNEL_MODULE_DIR_VENDOR_RAMDISK_FRAGMENT_$(kmd))) \
|
||||
$(if $(vendor_ramdisk_fragment), \
|
||||
$(eval output_dir := $(VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).STAGING_DIR)) \
|
||||
$(eval result_var := VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).FILES) \
|
||||
$(eval ### else ###), \
|
||||
$(eval output_dir := $(TARGET_VENDOR_RAMDISK_OUT)) \
|
||||
$(eval result_var := ALL_DEFAULT_INSTALLED_MODULES)) \
|
||||
$(eval $(result_var) += $(call build-image-kernel-modules-dir,VENDOR_RAMDISK,$(output_dir),,modules.load,$(VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR),$(dir))) \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-ramdisk-recovery-load,$(dir))) \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR,$(if $(filter true,$(BOARD_USES_VENDOR_DLKMIMAGE)),$(TARGET_OUT_VENDOR_DLKM),$(TARGET_OUT_VENDOR)),vendor,modules.load,$(VENDOR_STRIPPED_MODULE_STAGING_DIR),$(dir))) \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-charger-load,$(dir))) \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,ODM,$(if $(filter true,$(BOARD_USES_ODM_DLKMIMAGE)),$(TARGET_OUT_ODM_DLKM),$(TARGET_OUT_ODM)),odm,modules.load,,$(dir))) \
|
||||
$(eval $(result_var) += $(call build-image-kernel-modules-dir,VENDOR_RAMDISK,$(output_dir),,modules.load,$(VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR),$(kmd))) \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-ramdisk-recovery-load,$(kmd))) \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR,$(if $(filter true,$(BOARD_USES_VENDOR_DLKMIMAGE)),$(TARGET_OUT_VENDOR_DLKM),$(TARGET_OUT_VENDOR)),vendor,modules.load,$(VENDOR_STRIPPED_MODULE_STAGING_DIR),$(kmd))) \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-charger-load,$(kmd))) \
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,ODM,$(if $(filter true,$(BOARD_USES_ODM_DLKMIMAGE)),$(TARGET_OUT_ODM_DLKM),$(TARGET_OUT_ODM)),odm,modules.load,,$(kmd))) \
|
||||
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-recovery-as-boot-load,$(dir))),\
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,GENERIC_RAMDISK,$(TARGET_RAMDISK_OUT),,modules.load,,$(dir)))))
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-recovery-as-boot-load,$(kmd))),\
|
||||
$(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,GENERIC_RAMDISK,$(TARGET_RAMDISK_OUT),,modules.load,,$(kmd)))))
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Cert-to-package mapping. Used by the post-build signing tools.
|
||||
|
@ -1083,17 +1103,12 @@ endef
|
|||
INTERNAL_VENDOR_RAMDISK_FRAGMENT_TARGETS :=
|
||||
INTERNAL_VENDOR_RAMDISK_FRAGMENT_ARGS :=
|
||||
|
||||
$(foreach vendor_ramdisk_fragment,$(BOARD_VENDOR_RAMDISK_FRAGMENTS), \
|
||||
$(foreach vendor_ramdisk_fragment,$(INTERNAL_VENDOR_RAMDISK_FRAGMENTS), \
|
||||
$(eval prebuilt_vendor_ramdisk_fragment_file := $(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).PREBUILT)) \
|
||||
$(if $(prebuilt_vendor_ramdisk_fragment_file), \
|
||||
$(eval vendor_ramdisk_fragment_target := $(call build-prebuilt-vendor-ramdisk-fragment,$(vendor_ramdisk_fragment),$(prebuilt_vendor_ramdisk_fragment_file))) \
|
||||
$(eval ### else ###), \
|
||||
$(eval vendor_ramdisk_fragment_target := $(call build-vendor-ramdisk-fragment,$(vendor_ramdisk_fragment))) \
|
||||
$(if $(filter --ramdisk_type,$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS)),, \
|
||||
$(eval BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS += --ramdisk_type DLKM))) \
|
||||
$(if $(filter --ramdisk_name,$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS)), \
|
||||
$(error Must not specify --ramdisk_name for vendor ramdisk fragment: $(vendor_ramdisk_fragment))) \
|
||||
$(eval BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS += --ramdisk_name $(vendor_ramdisk_fragment)) \
|
||||
$(eval vendor_ramdisk_fragment_target := $(call build-vendor-ramdisk-fragment,$(vendor_ramdisk_fragment)))) \
|
||||
$(eval INTERNAL_VENDOR_RAMDISK_FRAGMENT_TARGETS += $(vendor_ramdisk_fragment_target)) \
|
||||
$(eval INTERNAL_VENDOR_RAMDISK_FRAGMENT_ARGS += $(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS) --vendor_ramdisk_fragment $(vendor_ramdisk_fragment_target)) \
|
||||
)
|
||||
|
@ -4892,9 +4907,9 @@ ifdef BOARD_KERNEL_PAGESIZE
|
|||
echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/VENDOR_BOOT/pagesize
|
||||
endif
|
||||
echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/VENDOR_BOOT/vendor_cmdline
|
||||
ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
|
||||
echo "$(BOARD_VENDOR_RAMDISK_FRAGMENTS)" > "$(zip_root)/VENDOR_BOOT/vendor_ramdisk_fragments"
|
||||
$(foreach vendor_ramdisk_fragment,$(BOARD_VENDOR_RAMDISK_FRAGMENTS), \
|
||||
ifdef INTERNAL_VENDOR_RAMDISK_FRAGMENTS
|
||||
echo "$(INTERNAL_VENDOR_RAMDISK_FRAGMENTS)" > "$(zip_root)/VENDOR_BOOT/vendor_ramdisk_fragments"
|
||||
$(foreach vendor_ramdisk_fragment,$(INTERNAL_VENDOR_RAMDISK_FRAGMENTS), \
|
||||
mkdir -p $(zip_root)/VENDOR_BOOT/RAMDISK_FRAGMENTS/$(vendor_ramdisk_fragment); \
|
||||
echo "$(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).MKBOOTIMG_ARGS)" > "$(zip_root)/VENDOR_BOOT/RAMDISK_FRAGMENTS/$(vendor_ramdisk_fragment)/mkbootimg_args"; \
|
||||
$(eval prebuilt_ramdisk := $(BOARD_VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).PREBUILT)) \
|
||||
|
@ -4904,7 +4919,7 @@ ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
|
|||
$(VENDOR_RAMDISK_FRAGMENT.$(vendor_ramdisk_fragment).STAGING_DIR), \
|
||||
$(zip_root)/VENDOR_BOOT/RAMDISK_FRAGMENTS/$(vendor_ramdisk_fragment)/RAMDISK); \
|
||||
))
|
||||
endif # BOARD_VENDOR_RAMDISK_FRAGMENTS != ""
|
||||
endif # INTERNAL_VENDOR_RAMDISK_FRAGMENTS != ""
|
||||
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET
|
||||
ifdef BUILDING_SYSTEM_IMAGE
|
||||
@# Contents of the system image
|
||||
|
|
|
@ -25,6 +25,7 @@ _board_strip_readonly_list += BOARD_EGL_CFG
|
|||
_board_strip_readonly_list += BOARD_HAVE_BLUETOOTH
|
||||
_board_strip_readonly_list += BOARD_INSTALLER_CMDLINE
|
||||
_board_strip_readonly_list += BOARD_KERNEL_CMDLINE
|
||||
_board_strip_readonly_list += BOARD_BOOT_HEADER_VERSION
|
||||
_board_strip_readonly_list += BOARD_BOOTCONFIG
|
||||
_board_strip_readonly_list += BOARD_KERNEL_BASE
|
||||
_board_strip_readonly_list += BOARD_USES_GENERIC_AUDIO
|
||||
|
@ -828,7 +829,14 @@ ifndef BUILDING_VENDOR_BOOT_IMAGE
|
|||
ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
|
||||
$(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if not building vendor_boot image)
|
||||
endif
|
||||
endif
|
||||
else # BUILDING_VENDOR_BOOT_IMAGE
|
||||
ifneq (,$(call math_lt,$(BOARD_BOOT_HEADER_VERSION),4))
|
||||
ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
|
||||
$(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if \
|
||||
BOARD_BOOT_HEADER_VERSION is less than 4)
|
||||
endif
|
||||
endif
|
||||
endif # BUILDING_VENDOR_BOOT_IMAGE
|
||||
|
||||
ifneq ($(words $(BOARD_VENDOR_RAMDISK_FRAGMENTS)),$(words $(sort $(BOARD_VENDOR_RAMDISK_FRAGMENTS))))
|
||||
$(error BOARD_VENDOR_RAMDISK_FRAGMENTS has duplicate entries: $(BOARD_VENDOR_RAMDISK_FRAGMENTS))
|
||||
|
|
Loading…
Reference in New Issue