Make the Heads runtime opt-out from the initrd.cpio. #317

Allow sub-modules like u-root to opt out of the Heads runtime,
while retaining the musl-libc built tools.
This commit is contained in:
Trammell hudson 2018-02-13 17:46:48 -05:00
parent fc5d21cc28
commit 1459e701e3
No known key found for this signature in database
GPG Key ID: 687A5005935B1533
3 changed files with 22 additions and 13 deletions

View File

@ -18,6 +18,9 @@ endif
include $(CONFIG)
# Unless otherwise specified, we are building for heads
CONFIG_HEADS ?= y
# Controls how many parallel jobs are invoked in subshells
CPUS := $(shell nproc)
MAKE_JOBS ?= -j$(CPUS) --max-load 16
@ -386,12 +389,12 @@ $(build)/$(coreboot_dir)/util/cbmem/cbmem: \
#
initrd-y += $(pwd)/blobs/dev.cpio
initrd-y += $(build)/$(BOARD)/heads.cpio
initrd-y += $(build)/$(BOARD)/modules.cpio
initrd-y += $(build)/$(BOARD)/tools.cpio
initrd-$(CONFIG_HEADS) += $(build)/$(BOARD)/heads.cpio
initrd.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
$(build)/$(BOARD)/initrd.cpio.xz: $(or $(INITRD_OVERRIDE),$(initrd-y))
$(build)/$(BOARD)/initrd.cpio.xz: $(initrd-y)
$(call do,CPIO-CLEAN,$@,\
$(pwd)/bin/cpio-clean \
$^ \

View File

@ -4,24 +4,30 @@ CONFIG_LINUXBOOT=y
CONFIG_LINUXBOOT_ROM=blobs/winterfell.rom
CONFIG_LINUX_CONFIG=config/linux-linuxboot.config
# If you want to build with the go-based u-root instead of
# everything else. Note that turning this on will turn off
# all of the other build tools.
# If you want to build with the go-based u-root instead of Heads
CONFIG_UROOT=y
ifeq "$(CONFIG_UROOT)" "y"
# The busybox will likely be redundant and can be trimmed for space.
CONFIG_BUSYBOX=n
CONFIG_ZLIB=n
CONFIG_MUSL=n
else
# These don't fit if u-root is turned on
CONFIG_CRYPTSETUP=y
CONFIG_FLASHROM=y
#CONFIG_GPG=y
CONFIG_GPG=y
CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y
#CONFIG_MBEDTLS=y
CONFIG_MBEDTLS=y
CONFIG_PCIUTILS=y
CONFIG_POPT=y
#CONFIG_QRENCODE=y
#CONFIG_TPMTOTP=y
#CONFIG_XEN=y
CONFIG_XEN=y
CONFIG_DROPBEAR=y
endif
# Linux modules will still be linked into the u-root tree
CONFIG_LINUX_USB=y

View File

@ -5,10 +5,8 @@
# own dependencies.
#
ifeq "$(CONFIG_UROOT)" "y"
u-root_url := github.com/u-root/u-root
u-root_output := $(build)/$(BOARD)/initrd.cpio
u-root_output := $(build)/$(BOARD)/u-root.cpio
export GOPATH=$(build)/go
@ -26,8 +24,10 @@ $(u-root_output): $(GOPATH)
)
# Override the initrd inputs and add in the kernel modules
INITRD_OVERRIDE += $(u-root_output)
INITRD_OVERRIDE += $(build)/$(BOARD)/modules.cpio
initrd-$(CONFIG_UROOT) += $(u-root_output)
# If we are building for u-root, disable the default CONFIG_HEADS
ifeq "$(CONFIG_UROOT)" "y"
CONFIG_HEADS=n
endif