From 03f0fa182269395618d407cc6c4460d3889c7192 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 13 Nov 2021 19:40:59 -0700 Subject: [PATCH] payloads/U-Boot: Tidy up the U-Boot build This doesn't work at present, merely printing an error when U-Boot is selected as a payload. This is because it adds a file into the U-Boot tree which makes U-Boot's build system think that the tree is unclean. Update the rules to put the tag file outside the source tree. Use an out-of-tree build for U-Boot to avoid changing the source tree. Signed-off-by: Simon Glass Change-Id: I24d6545b54f97afeefaca3ffed79eec2e7afacb4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59600 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans --- payloads/external/Makefile.inc | 2 +- payloads/external/U-Boot/Kconfig | 2 +- payloads/external/U-Boot/Makefile | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc index 6db17209aa..151a27c010 100644 --- a/payloads/external/Makefile.inc +++ b/payloads/external/Makefile.inc @@ -197,7 +197,7 @@ payloads/external/GRUB2/grub2/build/default_payload.elf: grub2 # U-Boot -payloads/external/U-Boot/u-boot/u-boot-dtb.bin u-boot: $(DOTCONFIG) +payloads/external/U-Boot/build/u-boot/u-boot-dtb.bin u-boot: $(DOTCONFIG) $(MAKE) -C payloads/external/U-Boot \ CONFIG_UBOOT_MASTER=$(CONFIG_UBOOT_MASTER) \ CONFIG_UBOOT_STABLE=$(CONFIG_UBOOT_STABLE) diff --git a/payloads/external/U-Boot/Kconfig b/payloads/external/U-Boot/Kconfig index 9e51ae17cc..b635bbb38d 100644 --- a/payloads/external/U-Boot/Kconfig +++ b/payloads/external/U-Boot/Kconfig @@ -32,7 +32,7 @@ config PAYLOAD_CONFIGFILE from the U-Boot config directory config PAYLOAD_FILE - default "payloads/external/U-Boot/u-boot/u-boot-dtb.bin" + default "payloads/external/U-Boot/build/u-boot/u-boot-dtb.bin" config PAYLOAD_OPTIONS default "-l 0x1110000 -e 0x1110015" diff --git a/payloads/external/U-Boot/Makefile b/payloads/external/U-Boot/Makefile index 38dfe99a0e..1d1d3324e3 100644 --- a/payloads/external/U-Boot/Makefile +++ b/payloads/external/U-Boot/Makefile @@ -9,7 +9,10 @@ TAG-$(CONFIG_UBOOT_STABLE)=$(STABLE_COMMIT_ID) project_name=U-Boot project_dir=u-boot project_git_repo=http://git.denx.de/u-boot.git -project_config_file=$(project_dir)/.config +project_build_dir=build +project_config_file=$(project_build_dir)/.config + +make_args=-C $(project_dir) O=../build unexport KCONFIG_AUTOHEADER unexport KCONFIG_AUTOCONFIG @@ -31,11 +34,11 @@ ifeq ($(CONFIG_UBOOT_MASTER),y) git fetch #master doesn't get a file, so it's continuously updated - rm -f $(project_dir)/$(STABLE_COMMIT_ID) + rm -f $(STABLE_COMMIT_ID) else cd $(project_dir); git show $(TAG-y) >/dev/null 2>&1 ; if [ $$? -ne 0 ]; \ then echo " Fetching new commits from the $(project_name) git repo"; git fetch; fi - touch $(project_dir)/$(STABLE_COMMIT_ID) + touch $(STABLE_COMMIT_ID) endif checkout: fetch @@ -43,26 +46,26 @@ checkout: fetch cd $(project_dir); git checkout master; git branch -D coreboot 2>/dev/null; git checkout -b coreboot $(TAG-y) config: checkout + mkdir -p $(project_build_dir) rm -f $(project_config_file) ifneq ($(CONFIG_PAYLOAD_CONFIGFILE),) ifneq ("$(wildcard $(CONFIG_PAYLOAD_CONFIGFILE))","") cat $(CONFIG_PAYLOAD_CONFIGFILE)" > tag-$(project_config_file) + $(MAKE) $(make_args) olddefconfig else echo "Error: File $(CONFIG_PAYLOAD_CONFIGFILE) does not exist" false endif else - cat $(project_dir)/configs/coreboot_defconfig >> $(project_config_file) + $(MAKE) $(make_args) coreboot_defconfig endif - $(MAKE) -C $(project_dir) olddefconfig - build: config echo " MAKE $(project_name) $(TAG-y)" - $(MAKE) -C $(project_dir) + $(MAKE) $(make_args) clean: - test -d $(project_dir) && $(MAKE) -C $(project_dir) clean || exit 0 + test -d $(project_dir) && $(MAKE) $(make_args) clean || exit 0 distclean: rm -rf $(project_dir)