Replace backup file mechanism with git restore to fix restoration bugs and simplify the build system. Files are now always restored after build completion, ensuring a clean git state regardless of which configuration options modify the config files. TEST=build samsung/stumpy with iPXE for edk2 twice in a row without failure due to dirty repo state. Change-Id: I9c88f5ca5e5a0172f7c0a94e4edfe0192340d1e2 Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/90772 Reviewed-by: Sean Rhodes <sean@starlabs.systems> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
80 lines
2.8 KiB
Makefile
80 lines
2.8 KiB
Makefile
## SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
# 2022.1 - Last commit of January 2022
|
|
# When updating, change the name both here and in payloads/external/iPXE/Kconfig
|
|
STABLE_COMMIT_ID=7c39c04a537ce29dccc6f2bae9749d1d371429c1
|
|
|
|
TAG-$(CONFIG_IPXE_MASTER)=origin/master
|
|
TAG-$(CONFIG_IPXE_STABLE)=$(STABLE_COMMIT_ID)
|
|
|
|
project_name=iPXE
|
|
project_dir=ipxe
|
|
project_git_repo=https://git.ipxe.org/ipxe.git
|
|
|
|
ifeq ($(CONFIG_IPXE_BUILD_EFI),y)
|
|
IPXE_BUILD_TARGET := bin-x86_64-efi-sb/ipxe.efi
|
|
# Workaround problems with unrecognized ipxe/util/elf2efi relocations
|
|
PXE_MAKE_OPTS += EXTRA_CFLAGS="$(CFLAGS_x86_64) -fno-pic"
|
|
else
|
|
IPXE_BUILD_TARGET := bin/$(PXE_ROM_PCI_ID).rom
|
|
endif
|
|
|
|
all: build
|
|
|
|
$(project_dir):
|
|
echo " Cloning $(project_name) from Git"
|
|
git clone $(project_git_repo) $(project_dir)
|
|
|
|
fetch: $(project_dir)
|
|
cd $(project_dir); \
|
|
git show $(TAG-y) >/dev/null 2>&1 ; \
|
|
if [ $$? -ne 0 ] || [ "$(TAG-y)" = "origin/master" ]; then \
|
|
echo " Fetching new commits from the $(project_name) repo"; \
|
|
git fetch; \
|
|
fi
|
|
|
|
checkout: fetch
|
|
echo " Checking out $(project_name) revision $(TAG-y)"
|
|
cd $(project_dir); \
|
|
git checkout master; \
|
|
git branch -D coreboot 2>/dev/null; \
|
|
git checkout -b coreboot $(TAG-y)
|
|
|
|
config: checkout
|
|
ifeq ($(CONSOLE_SERIAL),yy)
|
|
sed -i'' 's|//#define\s*CONSOLE_SERIAL.*|#define CONSOLE_SERIAL|' "$(project_dir)/src/config/console.h"
|
|
sed -i'' 's|#define\s*COMCONSOLE.*|#define COMCONSOLE $(IPXE_UART)|' "$(project_dir)/src/config/serial.h"
|
|
sed -i'' 's|#define\s*COMSPEED.*|#define COMSPEED $(CONFIG_TTYS0_BAUD)|' "$(project_dir)/src/config/serial.h"
|
|
endif
|
|
ifeq ($(CONFIG_HAS_SCRIPT),y)
|
|
sed -i'' 's|//#define\s*IMAGE_SCRIPT.*|#define IMAGE_SCRIPT|' "$(project_dir)/src/config/general.h"
|
|
endif
|
|
ifeq ($(CONFIG_IPXE_NO_PROMPT),y)
|
|
sed -i'' 's|#define\s*BANNER_TIMEOUT.*|#define BANNER_TIMEOUT 0|' "$(project_dir)/src/config/general.h"
|
|
endif
|
|
ifeq ($(CONFIG_IPXE_HAS_HTTPS),y)
|
|
sed -i'' 's|.*DOWNLOAD_PROTO_HTTPS|#define DOWNLOAD_PROTO_HTTPS|g' "$(project_dir)/src/config/general.h"
|
|
endif
|
|
ifeq ($(CONFIG_IPXE_TRUST_CMD),y)
|
|
sed -i'' 's|.*IMAGE_TRUST_CMD|#define IMAGE_TRUST_CMD|g' "$(project_dir)/src/config/general.h"
|
|
endif
|
|
|
|
build: config $(CONFIG_SCRIPT)
|
|
ifeq ($(CONFIG_HAS_SCRIPT),y)
|
|
echo " MAKE $(project_name) $(TAG-y) EMBED=$(CONFIG_SCRIPT)"
|
|
$(MAKE) -C $(project_dir)/src $(IPXE_BUILD_TARGET) EMBED=$(CONFIG_SCRIPT) $(PXE_MAKE_OPTS)
|
|
else
|
|
echo " MAKE $(project_name) $(TAG-y)"
|
|
$(MAKE) -C $(project_dir)/src $(IPXE_BUILD_TARGET) $(PXE_MAKE_OPTS)
|
|
endif
|
|
cp $(project_dir)/src/$(IPXE_BUILD_TARGET) $(project_dir)/ipxe.rom
|
|
cd $(project_dir) && git restore src/config/console.h src/config/serial.h src/config/general.h
|
|
|
|
clean:
|
|
test -d $(project_dir) && $(MAKE) -C $(project_dir)/src veryclean || exit 0
|
|
rm -f $(project_dir)/ipxe.rom
|
|
|
|
distclean:
|
|
rm -rf $(project_dir)
|
|
|
|
.PHONY: all fetch config build clean distclean
|