Makefile: Allow downstream config in site-local/config

Allow downstreams to add config to site-local/config, which can set
config options, including overriding board config and exporting config
to /etc/config.

The intent of site-local is exactly the same as in coreboot - it is a
place for downstreams to add customizations that are included at well-
defined points in the build.  site-local should never appear in the
upstream repository.  coreboot's documentation explains this as well:
https://doc.coreboot.org/tutorial/managing_local_additions.html

Move definitions of ROM artifacts later, so site config can override
BRAND_NAME (and still is included after board config to override it as
well).

Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
Jonathon Hall 2023-12-18 13:34:55 -05:00
parent 12a099ad8e
commit 0cb6d9154f
No known key found for this signature in database
GPG Key ID: 1E9C3CA91AE25114

View File

@ -12,13 +12,6 @@ HEADS_GIT_VERSION := $(shell git describe --abbrev=7 --tags --dirty)
# Override BRAND_NAME to set the name displayed in the UI, filenames, versions, etc.
BRAND_NAME ?= Heads
CB_OUTPUT_BASENAME := $(shell echo $(BRAND_NAME) | tr A-Z a-z)-$(BOARD)-$(HEADS_GIT_VERSION)
CB_OUTPUT_FILE := $(CB_OUTPUT_BASENAME).rom
CB_OUTPUT_FILE_GPG_INJ := $(CB_OUTPUT_BASENAME)-gpg-injected.rom
CB_BOOTBLOCK_FILE := $(CB_OUTPUT_BASENAME).bootblock
CB_UPDATE_PKG_FILE := $(CB_OUTPUT_BASENAME).zip
LB_OUTPUT_FILE := linuxboot-$(BOARD)-$(HEADS_GIT_VERSION).rom
all:
-include .config
@ -59,6 +52,20 @@ CONFIG_LEGACY_FLASH := n
include $(CONFIG)
# Include site-local/config only if it exists, downstreams can set configs for
# all boards, including overriding values specified by boards. site-local is
# not a part of the upstream distribution but is for downstreams to insert
# customizations at well-defined points, like in coreboot:
# https://doc.coreboot.org/tutorial/managing_local_additions.html
-include $(pwd)/site-local/config
CB_OUTPUT_BASENAME := $(shell echo $(BRAND_NAME) | tr A-Z a-z)-$(BOARD)-$(HEADS_GIT_VERSION)
CB_OUTPUT_FILE := $(CB_OUTPUT_BASENAME).rom
CB_OUTPUT_FILE_GPG_INJ := $(CB_OUTPUT_BASENAME)-gpg-injected.rom
CB_BOOTBLOCK_FILE := $(CB_OUTPUT_BASENAME).bootblock
CB_UPDATE_PKG_FILE := $(CB_OUTPUT_BASENAME).zip
LB_OUTPUT_FILE := linuxboot-$(BOARD)-$(HEADS_GIT_VERSION).rom
# Unless otherwise specified, we are building for heads
CONFIG_HEADS ?= y