From 1459e701e3c867dcede633e6ed4000491a4dfc67 Mon Sep 17 00:00:00 2001 From: Trammell hudson Date: Tue, 13 Feb 2018 17:46:48 -0500 Subject: [PATCH] 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. --- Makefile | 7 +++++-- boards/winterfell.config | 18 ++++++++++++------ modules/u-root | 10 +++++----- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index e39c428f..a371f182 100644 --- a/Makefile +++ b/Makefile @@ -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 \ $^ \ diff --git a/boards/winterfell.config b/boards/winterfell.config index aa862f64..d946bdfc 100644 --- a/boards/winterfell.config +++ b/boards/winterfell.config @@ -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 diff --git a/modules/u-root b/modules/u-root index ecdf2abc..0720a640 100644 --- a/modules/u-root +++ b/modules/u-root @@ -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