Commit fb1c14ab authored by Grant Likely's avatar Grant Likely
Browse files

Refactor to use u-boot defconfig to get defaults



U-Boot defconfig already knows a lot about the platform. Use the
defconfig data to know what the SoC is and start with sane defaults.

This currently works by running the U-Boot defconfig step with a
:=$(shell) statement before executing any make rules. It is a little
ugly to do it this way, and it may be better to recursively call Make
so that the output of make <target>_defconfig is executed in a proper
rule.
Signed-off-by: Grant Likely's avatarGrant Likely <grant.likely@arm.com>
parent 36562b20
......@@ -4,6 +4,6 @@ DTB_TARGET := src/arm64/marvell/armada-8040-mcbin.dtb
UBOOT_EXTRA := EXT_OS_DTB=${DT_PATH}/${DTB_TARGET}
TFA_PLAT := a80x0_mcbin
TFA_EXTRA := MV_DDR_PATH=${CURDIR}/mv-ddr USE_COHERENT_MEM=0 SCP_BL2=${CURDIR}/binaries-marvell/mrvl_scp_bl2.img BL33=${UBOOT_OUTPUT}/u-boot.bin all fip
TFA_EXTRA := MV_DDR_PATH=${CURDIR}/mv-ddr USE_COHERENT_MEM=0 SCP_BL2=${CURDIR}/binaries-marvell/mrvl_scp_bl2.img
FLASH_EXTRA := seek=1
......@@ -8,12 +8,11 @@
DTB_TARGET := src/arm64/rockchip/rk3399-rockpro64-v2.dtb
TFA_PLAT := rk3399
TFA_EXTRA := bl31
TFA_DEPS := dtb
u-boot: export UBOOT_EXTRA=BL31=$(TFA_PATH)/build/$(TFA_PLAT)/release/bl31/bl31.elf
UBOOT_EXTRA += EXT_DTB=${DT_PATH}/${DTB_TARGET}
UBOOT_DEPS := tfa
UBOOT_EXTRA := BL31=$(TFA_PATH)/build/$(TFA_PLAT)/release/bl31/bl31.elf
UBOOT_EXTRA += EXT_DTB=${DT_PATH}/${DTB_TARGET}
UBOOT_DEPS := tfa-bl31
FLASH_IMAGE := ${UBOOT_OUTPUT}/flash_image.bin
......
......@@ -11,25 +11,43 @@ MAKE=make
# Set some defaults that can be overridden by the target makefile include
DT_PATH := $(CURDIR)/devicetree-rebasing
TFA_PLAT := $(TARGET)
TFA_PATH := $(CURDIR)/arm-trusted-firmware
UBOOT_PATH := $(CURDIR)/u-boot
UBOOT_OUTPUT := $(UBOOT_PATH)/build-$(TARGET)
all: u-boot tfa
all: tfa-fip
# Include the platform specific Makefile
include scripts/${TARGET}.mk
# Make U-Boot configure itself, and then use the U-Boot config to get
# of default settings.
DUMMY:=$(shell $(MAKE) -C $(UBOOT_PATH) KBUILD_OUTPUT=$(UBOOT_OUTPUT) $(TARGET)_defconfig)
include $(UBOOT_OUTPUT)/.config
ifdef CONFIG_ROCKCHIP_RK3399
TFA_PLAT := rk3399
UBOOT_EXTRA := BL31=$(TFA_PATH)/build/$(TFA_PLAT)/release/bl31/bl31.elf
FLASH_IMAGE := $(UBOOT_OUTPUT)/flash_image.bin
DTB_TARGET := src/arm64/$(CONFIG_DEFAULT_FDT_FILE)
u-boot: tfa-bl31
endif
ifdef CONFIG_ARMADA_8K
DTB_TARGET := src/arm64/marvell/$(CONFIG_DEFAULT_DEVICE_TREE).dtb
ifeq ($(CONFIG_DEFAULT_DEVICE_TREE),"armada-8040-mcbin")
TFA_PLAT := a80x0_mcbin
endif
endif
ifndef TFA_PLAT
$(error TARGET=$(TARGET) is not yet supported by this tool; $(CONFIG_DEFAULT_DEVICE_TREE))
endif
# Grab the platform specific variables into generic versions
UBOOT_EXTRA ?= EXT_DTB=$(DT_PATH)/$(DTB_TARGET)
UBOOT_DEPS ?= dtb
TFA_DEPS ?= u-boot
FLASH_IMAGE ?= $(TFA_PATH)/build/$(TFA_PLAT)/release/flash-image.bin
.PHONY: dtb u-boot tfa clean
.PHONY: dtb u-boot clean
clean:
cd ${UBOOT_PATH} && make mrproper
......@@ -37,21 +55,26 @@ clean:
cd ${CURDIR}/mv-ddr && git clean -fdx
dtb:
cd ${DT_PATH} && ${MAKE} ${DTB_TARGET}
${MAKE} -C ${DT_PATH} ${DTB_TARGET}
fdtput ${DT_PATH}/${DTB_TARGET} -t s / u-boot-ver `cd ${UBOOT_PATH} && git describe`
fdtput ${DT_PATH}/${DTB_TARGET} -t s / tfa-ver `cd ${TFA_PATH} && git describe`
fdtput ${DT_PATH}/${DTB_TARGET} -t s / dt-ver `cd ${DT_PATH} && git describe`
#fdtput ${DT_PATH}/${DTB_TARGET} -t x /ap806/config-space@f0000000/serial@512000 clock-frequency 0xbebc200
u-boot: export KBUILD_OUTPUT=$(UBOOT_OUTPUT)
u-boot: dtb ${UBOOT_DEPS}
u-boot: dtb
mkdir -p ${UBOOT_OUTPUT}
${MAKE} -C ${UBOOT_PATH} ${UBOOT_EXTRA} ${TARGET}_defconfig
${MAKE} -C ${UBOOT_PATH} ${UBOOT_EXTRA} -j4
tfa: export PLAT=$(TFA_PLAT)
tfa: ${TFA_DEPS}
cd ${TFA_PATH} && ${MAKE} LOG_LEVEL=20 ${TFA_EXTRA}
tfa-bl31: export PLAT=$(TFA_PLAT)
tfa-bl31:
${MAKE} -C ${TFA_PATH} LOG_LEVEL=20 ${TFA_EXTRA} bl31
tfa-fip: export BL33=$(UBOOT_OUTPUT)/u-boot.bin
tfa-fip: export PLAT=$(TFA_PLAT)
tfa-fip: u-boot ${TFA_DEPS}
${MAKE} -C ${TFA_PATH} LOG_LEVEL=20 ${TFA_EXTRA} all fip
flash-to-sd:
sudo dd if=${FLASH_IMAGE} of=${FLASH_DEVICE} ${FLASH_EXTRA} conv=fdatasync status=progress
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment