From 9fb16492217f199be2bd8f60372a2a2df488e837 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Sun, 18 Oct 2020 13:55:10 -0500 Subject: [PATCH] Use $(BOARD)-$(HEADS_GIT_VERSION) as basis for output filename makes builds uniquely identifiable based on board and version. Signed-off-by: Matt DeVillier --- Makefile | 11 +++++++---- .../qemu-coreboot-fbwhiptail.config | 2 +- boards/qemu-coreboot/qemu-coreboot.config | 2 +- boards/t430-flash/t430-flash.config | 2 +- boards/x230-flash/x230-flash.config | 2 +- modules/coreboot | 4 +++- modules/linuxboot | 6 ++++-- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 4deebe571..2a0c9cd46 100644 --- a/Makefile +++ b/Makefile @@ -187,10 +187,13 @@ CROSS_TOOLS := \ -ifeq "$(CONFIG_COREBOOT)" "y" -all: $(build)/$(BOARD)/coreboot.rom -else ifeq "$(CONFIG_LINUXBOOT)" "y" -all: $(build)/$(BOARD)/linuxboot.rom +all: +ifeq ($(CONFIG_COREBOOT), y) +CB_OUTPUT_FILE := heads-$(BOARD)-$(HEADS_GIT_VERSION).rom +all: $(build)/$(BOARD)/$(CB_OUTPUT_FILE) +else ifeq ($(CONFIG_LINUXBOOT), y) +LB_OUTPUT_FILE := linuxboot-$(BOARD)-$(HEADS_GIT_VERSION).rom +all: $(build)/$(BOARD)/$(LB_OUTPUT_FILE) else $(error "$(BOARD): neither CONFIG_COREBOOT nor CONFIG_LINUXBOOT is set?") endif diff --git a/boards/qemu-coreboot-fbwhiptail/qemu-coreboot-fbwhiptail.config b/boards/qemu-coreboot-fbwhiptail/qemu-coreboot-fbwhiptail.config index b6210ca77..83ba5cd9e 100644 --- a/boards/qemu-coreboot-fbwhiptail/qemu-coreboot-fbwhiptail.config +++ b/boards/qemu-coreboot-fbwhiptail/qemu-coreboot-fbwhiptail.config @@ -48,7 +48,7 @@ export CONFIG_BOOT_DEV="/dev/sda1" run: qemu-system-x86_64 \ --machine q35 \ - --bios $(build)/$(BOARD)/coreboot.rom \ + --bios $(build)/$(BOARD)/$(CB_OUTPUT_FILE) \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-pci,rng=rng0 \ -netdev user,id=u1 -device e1000,netdev=u1 \ diff --git a/boards/qemu-coreboot/qemu-coreboot.config b/boards/qemu-coreboot/qemu-coreboot.config index dce3583ed..79643a5e1 100644 --- a/boards/qemu-coreboot/qemu-coreboot.config +++ b/boards/qemu-coreboot/qemu-coreboot.config @@ -58,7 +58,7 @@ run: qemu-system-x86_64 \ --machine q35 \ --serial /dev/tty \ - --bios $(build)/$(BOARD)/coreboot.rom \ + --bios $(build)/$(BOARD)/$(CB_OUTPUT_FILE) \ -object rng-random,filename=/dev/urandom,id=rng0 \ -device virtio-rng-pci,rng=rng0 \ -netdev user,id=u1 -device e1000,netdev=u1 \ diff --git a/boards/t430-flash/t430-flash.config b/boards/t430-flash/t430-flash.config index 43be7cb21..897eb6418 100644 --- a/boards/t430-flash/t430-flash.config +++ b/boards/t430-flash/t430-flash.config @@ -21,6 +21,6 @@ export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal --ifd --image # allow the board to boot into a minimal Heads and read the full # ROM from an external USB media. all: $(build)/$(BOARD)/$(BOARD).rom -$(build)/$(BOARD)/$(BOARD).rom: $(build)/$(BOARD)/coreboot.rom +$(build)/$(BOARD)/$(BOARD).rom: $(build)/$(BOARD)/$(CB_OUTPUT_FILE) dd of=$@ if=$< bs=65536 count=64 skip=128 sha256sum $@ diff --git a/boards/x230-flash/x230-flash.config b/boards/x230-flash/x230-flash.config index edb417ea7..283c8fbf8 100644 --- a/boards/x230-flash/x230-flash.config +++ b/boards/x230-flash/x230-flash.config @@ -26,6 +26,6 @@ export CONFIG_FLASHROM_OPTIONS="--force --noverify-all -p internal --ifd --image # allow the board to boot into a minimal Heads and read the full # ROM from an external USB media. all: $(build)/$(BOARD)/$(BOARD).rom -$(build)/$(BOARD)/$(BOARD).rom: $(build)/$(BOARD)/coreboot.rom +$(build)/$(BOARD)/$(BOARD).rom: $(build)/$(BOARD)/$(CB_OUTPUT_FILE) dd of=$@ if=$< bs=65536 count=64 skip=128 sha256sum $@ diff --git a/modules/coreboot b/modules/coreboot index f26888309..a4664e94e 100644 --- a/modules/coreboot +++ b/modules/coreboot @@ -78,10 +78,12 @@ $(build)/$(coreboot_dir)/.build: \ $(build)/$(BOARD)/initrd.cpio.xz \ # This produces a ROM image that is written with the flashrom program -$(build)/$(BOARD)/coreboot.rom: $(build)/$(coreboot_dir)/.build +ifneq ($(CONFIG_COREBOOT),) +$(build)/$(BOARD)/$(CB_OUTPUT_FILE): $(build)/$(coreboot_dir)/.build "$(build)/$(coreboot_dir)/cbfstool" "$(dir $<)coreboot.rom" print $(call do-copy,$(dir $<)coreboot.rom,$@) @touch $@ # update the time stamp +endif # # Helpful target for reconfiguring the coreboot target diff --git a/modules/linuxboot b/modules/linuxboot index 57ea31a23..19edcc4e6 100644 --- a/modules/linuxboot +++ b/modules/linuxboot @@ -59,9 +59,11 @@ endif linuxboot_output := build/$(linuxboot_board)/linuxboot.rom linuxboot_rom := $(build)/$(linuxboot_dir)/$(linuxboot_output) -$(build)/$(BOARD)/linuxboot.rom: $(build)/$(linuxboot_dir)/.build +ifneq ($(CONFIG_LINUXBOOT),) +$(build)/$(BOARD)/$(LB_OUTPUT_FILE): $(build)/$(linuxboot_dir)/.build $(call do-copy,$(dir $<)linuxboot.rom,$@) @touch $@ +endif # Also force a rebuild if any of the input files are updated $(build)/$(linuxboot_dir)/.build: \ @@ -70,7 +72,7 @@ $(build)/$(linuxboot_dir)/.build: \ $(build)/$(BOARD)/initrd.cpio.xz \ -linuxboot.run: $(build)/$(BOARD)/linuxboot.rom +linuxboot.run: $(build)/$(BOARD)/$(LB_OUTPUT_FILE) $(MAKE) -C $(build)/$(linuxboot_base_dir) \ BOARD:=$(linuxboot_board) \ KERNEL=$(build)/$(BOARD)/bzImage \