You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

216 lines
9.3 KiB

################################################################################
#
# Copyright (c) Hisilicon Technologies Co., Ltd. All rights reserved.
#
################################################################################
include $(BUILD_DIR)/bootloader.cfg
export CROSS_COMPILE=$(CFG_SOCT_ARM_TOOLCHAINS_NAME)-
CROSS_COMPILE64 = $(CFG_SOCT_AARCH64_TOOLCHAINS_NAME)-
CROSS_COMPILE32 = $(CFG_SOCT_ARM_TOOLCHAINS_NAME)-
PLATFORM := $(CFG_SOCT_CHIP_TYPE)
ifneq ($(findstring $(CFG_SOCT_CHIP_TYPE), reserved13 reserved9),)
PLATFORM := reserved13
endif
ifneq ($(findstring $(CFG_SOCT_CHIP_TYPE), reserved17),)
PLATFORM := reserved19
endif
################################################################################
CONFIG_PRODUCT_WITH_BOOT := $(CFG_SOCT_BUILD_WITH_PRODUCT)
IMAGE_DIR:=$(O)
ifeq ($(findstring fpga, $(CFG_SOCT_BOOT_REG_NAME)), fpga)
ENABLE_FPGA = y
ATF_ENABLE_FPGA = 1
else
ATF_ENABLE_FPGA = 0
endif
################################################################################
all:
ifeq ($(CFG_SOCT_MINIBOOT_SUPPORT),y)
else
UBOOT_SRC_DIR = $(VENDOR_OPEN_SOURCE_DIR)/u-boot/$(U_BOOT_VERSION)
UBOOT_SRC_DIR_SELF = $(UBOOT_SRC_DIR)/huanglong
CHIP_REG_DIR := $(PLATFORM)
UBOOT_BUILD_DIR = $(O)/slave-boot
SWITCH_ERET_BUILD_DIR = $(UBOOT_SRC_DIR_SELF)/arch/arm/cpu/$(PLATFORM)/eret
CONFIG_SLAVEBOOT_ERET = $(SWITCH_ERET_BUILD_DIR)/reset.bin
ifneq ($(findstring $(CFG_SOCT_CHIP_REVERSION), reserved19_c hi3751v811_c),)
UBOOT_DEFCONFIG_FILE = $(CFG_SOCT_CHIP_REVERSION)_slaveboot_defconfig
else
UBOOT_DEFCONFIG_FILE = $(PLATFORM)_slaveboot_defconfig
endif #CFG_SOCT_CHIP_REVERSION
export UBOOT_OUT_DIR=${UBOOT_BUILD_DIR}
ifeq ($(CFG_PRODUCT_TYPE),android)
export BUILD_ANDROID=y
endif
UBOOT_CONFIG_INCLUDE = $(UBOOT_BUILD_DIR)/include/configs/$(PLATFORM)_config.h
EXPORT_CONFIG = /bin/sh $(UBOOT_SRC_DIR_SELF)/include/configs/export.sh
CONFIG_UNIFIED_BOOT := y
copy_securec:
test -d $(UBOOT_BUILD_DIR)/huanglong/lib/securec || mkdir -p $(UBOOT_BUILD_DIR)/huanglong/lib/securec
test -d $(UBOOT_BUILD_DIR)/include/huanglong || mkdir -p $(UBOOT_BUILD_DIR)/include/huanglong
cp -arf $(PLATFORM_DIR)/secure_c/include/securec.h $(UBOOT_BUILD_DIR)/huanglong/lib/securec
cp -arf $(PLATFORM_DIR)/secure_c/include/securectype.h $(UBOOT_BUILD_DIR)/huanglong/lib/securec
cp -arf $(PLATFORM_DIR)/secure_c/include/*.h $(UBOOT_BUILD_DIR)/include/huanglong
ifeq ($(BOOTLOADER_DRIVERS_SOURCE_DIR),)
cp -arf $(PLATFORM_DIR)/secure_c/source/securecutil.h $(UBOOT_BUILD_DIR)/include/huanglong
cp -arf $(PLATFORM_DIR)/secure_c/source/*.c $(UBOOT_BUILD_DIR)/huanglong/lib/securec
cp -arf $(PLATFORM_DIR)/secure_c/source/*.h $(UBOOT_BUILD_DIR)/huanglong/lib/securec
cp -arf $(PLATFORM_DIR)/secure_c/source/*.inl $(UBOOT_BUILD_DIR)/huanglong/lib/securec
endif
prepare: $(CONFIG_FILE)
$(AT)test -d $(UBOOT_BUILD_DIR)/ || mkdir -p $(UBOOT_BUILD_DIR)
UBOOT_EXT := $(shell cd $(VENDOR_DIR)/huanglong/bootloader/source/uboot/uboot_ext && pwd)
$(shell ln -fsn $(UBOOT_EXT) $(UBOOT_SRC_DIR_SELF))
ifneq (,$(filter slaveboot-prepare all,$(MAKECMDGOALS)))
sinclude $(UBOOT_BUILD_DIR)/.check_dynamic_config_update
$(UBOOT_BUILD_DIR)/.check_dynamic_config_update:
test -d $(dir $(UBOOT_CONFIG_INCLUDE)) || mkdir -p $(dir $(UBOOT_CONFIG_INCLUDE))
rm -vf $(UBOOT_CONFIG_INCLUDE).tmp
$(EXPORT_CONFIG) "CONFIG_SLAVEBOOT_ERET=\"$(CONFIG_SLAVEBOOT_ERET)\"" \
"default slaveboot eret" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_DDR_LAYOUT_128M=$(CFG_SOCT_DDR_LAYOUT_128M)" \
"ddr layout 128M support" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_AUDIO_AMP_AUTO_SELECT_MODE=$(CFG_SOCT_AUDIO_AMP_AUTO_SELECT_MODE)" \
"audio amp auto select mode" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_VO_VDAC_AUTO_SELECT_MODE=$(CFG_SOCT_VO_VDAC_AUTO_SELECT_MODE)" \
"vo vdac auto select mode" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_ABORTBOOT_OFF=$(CFG_SOCT_ABORTBOOT_OFF)" \
"No abortboot" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_PRODUCT_WITH_BOOT=$(CONFIG_PRODUCT_WITH_BOOT)" \
"build product with boot" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_BOOTROM_CA_SUPPORT=$(BOOT_ADVCA_PROGRAMMER)" \
"build advca_programmer" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CFG_$(BOOTCONFIG_UPPER)_FPGA=$(CFG_FPGA)" \
"FPGA" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_BOOT_SIMULATE=$(CONFIG_BOOT_SIMULATE)" \
"Simulate boot" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CHIP_TYPE_$(CFG_SOCT_CHIP_TYPE)=1" \
"Chip type" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_ADVANCED_CHIP=$(CFG_SOCT_ADVANCED_CHIP)" \
"Advanced Chip" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_FPGA=$(ENABLE_FPGA)" \
"Current is fpga config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_AVS_SUPPORT=$(CFG_SOCT_AVS_SUPPORT)" \
"AVS config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_PMU_DEVICE=$(CFG_SOCT_PMU_DEVICE_SELECT)" \
"PMU Device config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_USB_SUPPORT=$(CFG_SOCT_BOOT_USB_SUPPORT)" \
"USB Driver config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_HSL_SUPPORT=$(CFG_SOCT_BOOT_HSL_SUPPORT)" \
"HSL area support" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_TEE_SUPPORT=$(CFG_SOCT_TEE_SUPPORT)" \
"TEE config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_TEE_ATF_SUPPORT=$(CFG_SOTC_TEE_ATF_SUPPORT)" \
"TEE ATF config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_ARM64_TOOLCHAINS=$(SOCT_KERNEL_TOOLCHAINS_NAME)" \
"ARM64 toolchains config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_ARM64_SUPPORT=$(CONFIG_ARM64_SUPPORT)" \
"ARM64 support config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_DISABLE_CONSOLE_INPUT=$(CFG_SOCT_USER_MODE)" \
"Disable console input" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_ENABLE_CONSOLE_OUTPUT=$(CFG_SOCT_BOOT_LOG_SUPPORT)" \
"Enable console output" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_SBL_VXX_UXX=$(SBL_VXX_UXX)" \
"Second boot config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_SUPPORT_BOOTLOG_RSVD=$(CFG_SOCT_SUPPORT_BOOTLOG_RSVD)" \
"bootlog reserved config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_BOOTLOG_RSVD_SIZE=$(CFG_SOCT_BOOTLOG_RSVD_SIZE)" \
"bootlog reserved size config" $(UBOOT_CONFIG_INCLUDE).tmp
@$(EXPORT_CONFIG) "CONFIG_T9_FPGA=$(CFG_SOCT_T9_FPGA)" \
"t9 FPGA" $(UBOOT_CONFIG_INCLUDE).tmp
ifneq ($(findstring $(CFG_SOCT_CHIP_REVERSION), reserved19_b reserved17_d), )
@$(EXPORT_CONFIG) "CONFIG_SOCT_REVERSION_SLS_B=y" \
"RESERVED19_B reversion" $(UBOOT_CONFIG_INCLUDE).tmp
endif
ifeq ($(CFG_SOCT_CHIP_REVERSION), reserved19_c)
@$(EXPORT_CONFIG) "CONFIG_SOCT_REVERSION_SLS_C=y" \
"RESERVED19_C reversion" $(UBOOT_CONFIG_INCLUDE).tmp
endif
ifneq ($(findstring $(CFG_SOCT_CHIP_TYPE), reserved5 reserved19 reserved17 hi3751v811), )
@$(EXPORT_CONFIG) "CONFIG_EMMC_SUPPORT=$(CFG_SOCT_EMMC_SUPPORT)" \
"emmc flash support" $(UBOOT_CONFIG_INCLUDE).tmp
endif
ifeq ($(CFG_SOCT_CHIP_REVERSION), hi3751v811_c)
@$(EXPORT_CONFIG) "CONFIG_SOCT_REVERSION_SLS_C=y" \
"HI3751V811_C reversion" $(UBOOT_CONFIG_INCLUDE).tmp
endif
@$(EXPORT_CONFIG) "CONFIG_ADVCA_SM_SUPPORT=$(CFG_SOCT_ADVCA_SM_SUPPORT)" \
"Enable SM encryption feature" $(UBOOT_CONFIG_INCLUDE).tmp
ifeq ($(CFG_SOCT_TWOSTAGEBOOT_SUPPORT),y)
ifeq ($(CFG_SOCT_BOOT_FBL),y)
@$(EXPORT_CONFIG) "CONFIG_FBL=y" \
"Support two stage boot FBL" $(UBOOT_CONFIG_INCLUDE).tmp
endif
ifeq ($(CFG_SOCT_BOOT_SBL),y)
@$(EXPORT_CONFIG) "CONFIG_SBL=y" \
"Support two stage boot SBL" $(UBOOT_CONFIG_INCLUDE).tmp
endif
endif
if [ -f $(UBOOT_CONFIG_INCLUDE) ]; then \
cmp -s $(UBOOT_CONFIG_INCLUDE) $(UBOOT_CONFIG_INCLUDE).tmp || \
cp -fv $(UBOOT_CONFIG_INCLUDE).tmp $(UBOOT_CONFIG_INCLUDE); \
else \
cp -fv $(UBOOT_CONFIG_INCLUDE).tmp $(UBOOT_CONFIG_INCLUDE); \
fi
endif
.PHONY: slaveboot-burn.bin slaveboot-prepare clean boot_clean prepare
all: slaveboot-burn.bin
slaveboot-prepare: copy_securec prepare $(UBOOT_CONFIG_INCLUDE)
test -d $(UBOOT_BUILD_DIR) || mkdir -p $(UBOOT_BUILD_DIR)
cp -rf $(UBOOT_SRC_DIR_SELF)/configs/$(UBOOT_DEFCONFIG_FILE) $(UBOOT_BUILD_DIR)/.config
$(MAKE) CROSS_COMPILE=$(CROSS_COMPILE32) -C $(UBOOT_SRC_DIR) VENDOR_ROOT_DIR=$(VENDOR_DIR) SDK_DIR=$(app_srctree) O=$(UBOOT_BUILD_DIR) prepare
slaveboot-burn.bin: slaveboot-prepare
ifneq ($(BOOTLOADER_DRIVERS_SOURCE_DIR),)
$(MAKE) CROSS_COMPILE=$(CROSS_COMPILE32) $(MKFLAGS) -C $(UBOOT_BUILD_DIR) DEVICE_TREE=$(CFG_DEVICE_TREE_NAME) VENDOR_ROOT_DIR=$(VENDOR_DIR) SDK_DIR=$(app_srctree) O= $(BOOTLOADER_DRIVERS_SOURCE_DIR)
else
ifeq ($(findstring $(CFG_SOCT_CHIP_TYPE), reserved5 reserved19 reserved17 hi3751v811), )
$(MAKE) CROSS_COMPILE=$(CROSS_COMPILE64) -C $(SWITCH_ERET_BUILD_DIR) VENDOR_ROOT_DIR=$(VENDOR_DIR) SDK_DIR=$(app_srctree) OPEN_SOURCE_DIR=$(VENDOR_OPEN_SOURCE_DIR)
endif
$(MAKE) CROSS_COMPILE=$(CROSS_COMPILE32) $(MKFLAGS) -C $(UBOOT_BUILD_DIR) DEVICE_TREE=$(CFG_DEVICE_TREE_NAME) VENDOR_ROOT_DIR=$(VENDOR_DIR) SDK_DIR=$(app_srctree) OPEN_SOURCE_DIR=$(VENDOR_OPEN_SOURCE_DIR) O= all $(UBOOT_CONFIG_FILE)
cp -rf $(UBOOT_BUILD_DIR)/u-boot.bin $(UBOOT_BUILD_DIR)/slaveboot-burn.bin
$(call copy_image,$(UBOOT_BUILD_DIR)/slaveboot-burn.bin,,$(IMAGE_DIR))
endif
clean: boot_clean
boot_clean:
rm -rf $(UBOOT_BUILD_DIR)
endif
###################################################################