Inject Heads version string into coreboot LOCALVERSION... (#859)

* config/coreboot-*: drop CONFIG_LOCALVERSION
Will be injected as part of the build using $(HEADS_GIT_VERSION)
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>

* modules/coreboot: inject $(HEADS_GIT_VERSION) as CONFIG_LOCALVERSION
Needed for fwupd to handle board updates
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>

* modules/coreboot: override SMBIOS ProductName with $(BOARD)
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>

* Use $(BOARD)-$(HEADS_GIT_VERSION) as basis for output filename
makes builds uniquely identifiable based on board and version.
Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
MrChromebox 2020-10-21 10:04:27 -05:00 committed by GitHub
parent b3d01c1962
commit bd7a945bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 31 additions and 36 deletions

View File

@ -1,3 +1,17 @@
# Need to set CB_OUTPUT_FILE before board .config included so
# that target overrides in x230/x430-flash (eg) are properly handled
GIT_HASH := $(shell git rev-parse HEAD)
GIT_STATUS := $(shell \
if git diff --exit-code >/dev/null ; then \
echo clean ; \
else \
echo dirty ; \
fi)
HEADS_GIT_VERSION := $(shell git describe --tags --dirty)
CB_OUTPUT_FILE := heads-$(BOARD)-$(HEADS_GIT_VERSION).rom
LB_OUTPUT_FILE := linuxboot-$(BOARD)-$(HEADS_GIT_VERSION).rom
all:
-include .config
@ -100,16 +114,6 @@ include $(CONFIG)
# Unless otherwise specified, we are building for heads
CONFIG_HEADS ?= y
# Some things want usernames, we use the current checkout
# so that they are reproducible
GIT_HASH := $(shell git rev-parse HEAD)
GIT_STATUS := $(shell \
if git diff --exit-code >/dev/null ; then \
echo clean ; \
else \
echo dirty ; \
fi)
# record the build date / git hashes and other files here
HASHES := $(build)/$(BOARD)/hashes.txt
@ -186,10 +190,10 @@ CROSS_TOOLS := \
ifeq "$(CONFIG_COREBOOT)" "y"
all: $(build)/$(BOARD)/coreboot.rom
else ifeq "$(CONFIG_LINUXBOOT)" "y"
all: $(build)/$(BOARD)/linuxboot.rom
ifeq ($(CONFIG_COREBOOT), y)
all: $(build)/$(BOARD)/$(CB_OUTPUT_FILE)
else ifeq ($(CONFIG_LINUXBOOT), y)
all: $(build)/$(BOARD)/$(LB_OUTPUT_FILE)
else
$(error "$(BOARD): neither CONFIG_COREBOOT nor CONFIG_LINUXBOOT is set?")
endif

View File

@ -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 \

View File

@ -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 \

View File

@ -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 $@

View File

@ -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 $@

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_USE_OPTION_TABLE=y
# CONFIG_COLLECT_TIMESTAMPS is not set

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="4.8.1-Purism-1-heads-beta"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_USE_BLOBS=y
CONFIG_MEASURED_BOOT=y

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="4.8.1-Purism-1-heads-beta"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_USE_BLOBS=y
CONFIG_MEASURED_BOOT=y

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="4.8.1-Purism-1-heads-beta"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_USE_BLOBS=y
CONFIG_MEASURED_BOOT=y

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="4.8.1-Purism-1-heads-beta"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_USE_BLOBS=y
CONFIG_MEASURED_BOOT=y

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_CBFS_SIZE=0xC00000
CONFIG_VENDOR_PURISM=y

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="-heads"
CONFIG_ANY_TOOLCHAIN=y
# CONFIG_INCLUDE_CONFIG_FILE is not set
CONFIG_CBFS_SIZE=0x700000

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="-heads"
CONFIG_ANY_TOOLCHAIN=y
# CONFIG_INCLUDE_CONFIG_FILE is not set
CONFIG_CBFS_SIZE=0x700000

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
# CONFIG_INCLUDE_CONFIG_FILE is not set
# CONFIG_COLLECT_TIMESTAMPS is not set

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
# CONFIG_INCLUDE_CONFIG_FILE is not set
# CONFIG_COLLECT_TIMESTAMPS is not set

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_MEASURED_BOOT=y
CONFIG_VENDOR_LENOVO=y

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
# CONFIG_INCLUDE_CONFIG_FILE is not set
# CONFIG_COLLECT_TIMESTAMPS is not set

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
# CONFIG_INCLUDE_CONFIG_FILE is not set
# CONFIG_COLLECT_TIMESTAMPS is not set

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_MEASURED_BOOT=y
CONFIG_VENDOR_LENOVO=y

View File

@ -1,4 +1,3 @@
CONFIG_LOCALVERSION="heads"
CONFIG_ANY_TOOLCHAIN=y
CONFIG_MEASURED_BOOT=y
CONFIG_VENDOR_LENOVO=y

View File

@ -37,6 +37,8 @@ EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches -Wno-err
coreboot_configure := \
mkdir -p "$(build)/$(coreboot_dir)" \
&& cp "$(pwd)/$(CONFIG_COREBOOT_CONFIG)" "$(build)/$(coreboot_dir)/.config" \
&& echo 'CONFIG_LOCALVERSION="Heads-$(HEADS_GIT_VERSION)"' >> $(build)/$(coreboot_dir)/.config \
&& echo 'CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="$(BOARD)"' >> $(build)/$(coreboot_dir)/.config \
&& $(MAKE) olddefconfig \
-C "$(build)/$(coreboot_base_dir)" \
obj="$(build)/$(coreboot_dir)" \
@ -76,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

View File

@ -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 \