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

Clean up specifying build directory



Instead of setting the build directory unconditionally (which doesn't
entirely work anyway; U-Boot handles it well, but TFA and DT-rebasing do
not), by default let each project use it's own working directory.
However, if BUILD_BASE is set, then use that to create build directories
for the projects that support it.

Signed-off-by: Grant Likely's avatarGrant Likely <grant.likely@arm.com>
parent 90e038ef
......@@ -19,7 +19,7 @@ include $(UBOOT_OUTPUT)/.config
ifdef CONFIG_ROCKCHIP_RK3399
TFA_PLAT := rk3399
UBOOT_EXTRA := BL31=$(TFA_PATH)/build/$(TFA_PLAT)/release/bl31/bl31.elf
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
......@@ -41,9 +41,9 @@ endif
# Grab the platform specific variables into generic versions
#UBOOT_EXTRA ?= EXT_DTB=$(DT_PATH)/$(DTB_TARGET)
#UBOOT_EXTRA ?= EXT_DTB=$(DT_OUTPUT)/$(DTB_TARGET)
FLASH_IMAGE ?= $(TFA_PATH)/build/$(TFA_PLAT)/release/flash-image.bin
FLASH_IMAGE ?= $(TFA_OUTPUT)/$(TFA_PLAT)/release/flash-image.bin
ESP_SIZE ?= $$((64*1024*1024))
ESP_OFFSET ?= $$((4*1024*1024))
......@@ -54,12 +54,11 @@ SCT_VERSION:=UEFI2.6SCTII_Final_Release
dtb:
${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
fdtput ${DT_OUTPUT}/${DTB_TARGET} -t s / u-boot-ver `cd ${UBOOT_PATH} && git describe`
fdtput ${DT_OUTPUT}/${DTB_TARGET} -t s / tfa-ver `cd ${TFA_PATH} && git describe`
fdtput ${DT_OUTPUT}/${DTB_TARGET} -t s / dt-ver `cd ${DT_PATH} && git describe`
#fdtput ${DT_OUTPUT}/${DTB_TARGET} -t x /ap806/config-space@f0000000/serial@512000 clock-frequency 0xbebc200
u-boot: export KBUILD_OUTPUT=$(UBOOT_OUTPUT)
u-boot: dtb
${MAKE} -C ${UBOOT_PATH} ${UBOOT_EXTRA} -j4
......@@ -89,7 +88,7 @@ esp.tree/.done: scripts/main.mk Shell.efi $(SCT_VERSION).zip
mkdir -p esp.tree/efi/boot
cp Shell.efi esp.tree/efi/boot/bootaa64.efi
cp $(DT_PATH)/$(DTB_TARGET) \
cp $(DT_OUTPUT)/$(DTB_TARGET) \
$(UBOOT_OUTPUT)/lib/efi_selftest/efi_selftest_miniapp_return.efi \
$(UBOOT_OUTPUT)/lib/efi_selftest/efi_selftest_miniapp_exception.efi \
$(UBOOT_OUTPUT)/lib/efi_selftest/efi_selftest_miniapp_exit.efi \
......
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright (C) Arm Limited, 2020
#
# Makefile Conventions:
# Variable names:
# TARGET: U-Boot configuration name; TFA, OP-TEE, and other target
# configuration names key off the U-Boot configuration; this is a
# U-Boot oriented tool after all.
# *_PATH: Full path to project source directories or other assets
# *_OUTPUT: Build directories for each of the sub projects
# *_EXTRA: Extra parameters to the make call. Gets added to make targets, e.g.
# "$(MAKE) -C ${PROJECT_PATH} ... ${PROJECT_EXTRA} ..."
ifndef TARGET
$(error TARGET is not set)
......@@ -8,27 +18,38 @@ endif
# Set some defaults that can be overridden by the target makefile include
export DT_PATH := $(CURDIR)/devicetree-rebasing
export DT_OUTPUT := $(DT_PATH)
export TFA_PATH := $(CURDIR)/arm-trusted-firmware
export UBOOT_PATH := $(CURDIR)/u-boot
export UBOOT_OUTPUT := $(CURDIR)/u-boot/build-$(TARGET)
# Give the option of building in a separate directory
ifdef BUILD_OUTPUT
__BUILD := $(realpath $(BUILD_OUTPUT))
export TFA_OUTPUT := $(__BUILD)/tfa
export TFA_EXTRA += BUILD_BASE=$(TFA_OUTPUT)
export UBOOT_OUTPUT := $(__BUILD)/u-boot
export UBOOT_EXTRA += KBUILD_OUTPUT=$(UBOOT_OUTPUT)
else
export TFA_OUTPUT := $(TFA_PATH)/build
export UBOOT_OUTPUT := $(UBOOT_PATH)
endif
all: tfa-fip
clean:
cd $(UBOOT_PATH) && make mrproper
cd $(UBOOT_PATH) && make KBUILD_OUTPUT=$(UBOOT_OUTPUT) clean
$(MAKE) -C $(UBOOT_PATH) $(UBOOT_EXTRA) mrproper
cd $(TFA_PATH) && git clean -fdx
cd $(CURDIR)/mv-ddr && git clean -fdx
$(UBOOT_OUTPUT)/.config:
mkdir -p $(UBOOT_OUTPUT)
$(MAKE) -C $(UBOOT_PATH) KBUILD_OUTPUT=$(UBOOT_OUTPUT) $(TARGET)_defconfig
$(MAKE) -C $(UBOOT_PATH) $(UBOOT_EXTRA) $(TARGET)_defconfig
echo CONFIG_CMD_BOOTEFI_HELLO=y >> $(UBOOT_OUTPUT)/.config
echo CONFIG_CMD_BOOTEFI_SELFTEST=y >> $(UBOOT_OUTPUT)/.config
echo CONFIG_CMD_NVEDIT_EFI=y >> $(UBOOT_OUTPUT)/.config
echo CONFIG_CMD_EFIDEBUG=y >> $(UBOOT_OUTPUT)/.config
echo CONFIG_CMD_GPT=y >> $(UBOOT_OUTPUT)/.config
$(MAKE) -C $(UBOOT_PATH) KBUILD_OUTPUT=$(UBOOT_OUTPUT) olddefconfig
$(MAKE) -C $(UBOOT_PATH) $(UBOOT_EXTRA) olddefconfig
%: $(UBOOT_OUTPUT)/.config
$(MAKE) -f scripts/main.mk TARGET=$(TARGET) $@
......
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