payloads/ipxe: Unconditionally restore config files post-build

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>
This commit is contained in:
Matt DeVillier 2026-01-14 17:04:41 -06:00
commit 3b18467e8a

View file

@ -42,15 +42,10 @@ checkout: fetch
config: checkout
ifeq ($(CONSOLE_SERIAL),yy)
cp "$(project_dir)/src/config/console.h" "$(project_dir)/src/config/console.h.cb"
cp "$(project_dir)/src/config/serial.h" "$(project_dir)/src/config/serial.h.cb"
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
ifneq ($(filter y,$(CONFIG_HAS_SCRIPT) $(CONFIG_IPXE_NO_PROMPT)),)
cp "$(project_dir)/src/config/general.h" "$(project_dir)/src/config/general.h.cb"
endif
ifeq ($(CONFIG_HAS_SCRIPT),y)
sed -i'' 's|//#define\s*IMAGE_SCRIPT.*|#define IMAGE_SCRIPT|' "$(project_dir)/src/config/general.h"
endif
@ -73,13 +68,7 @@ else
$(MAKE) -C $(project_dir)/src $(IPXE_BUILD_TARGET) $(PXE_MAKE_OPTS)
endif
cp $(project_dir)/src/$(IPXE_BUILD_TARGET) $(project_dir)/ipxe.rom
ifeq ($(CONSOLE_SERIAL),yy)
cp "$(project_dir)/src/config/console.h.cb" "$(project_dir)/src/config/console.h"
cp "$(project_dir)/src/config/serial.h.cb" "$(project_dir)/src/config/serial.h"
endif
ifneq ($(filter y,$(CONFIG_HAS_SCRIPT) $(CONFIG_IPXE_NO_PROMPT)),)
cp "$(project_dir)/src/config/general.h.cb" "$(project_dir)/src/config/general.h"
endif
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