Enable easy building with the NERF u-root tree #317

This adds a `CONFIG_UROOT=y` option to allow the busybox
runtime to be replaced with the go u-root runtime.
You must have go 1.9 or newer for it to work.

It has been tested on the OCP winterfell and qemu nodes,
and it can be specified on the build command line as well.

Nothing from `heads/initrd` or any of the tools will be
linked into the cpio file.  Only the kernel modules and the
go shell will be included.
This commit is contained in:
Trammell hudson 2018-02-13 15:47:31 -05:00
parent e0d390c62d
commit 10c1f56b0a
No known key found for this signature in database
GPG Key ID: 687A5005935B1533
3 changed files with 41 additions and 2 deletions

View File

@ -391,7 +391,7 @@ initrd-y += $(build)/$(BOARD)/modules.cpio
initrd-y += $(build)/$(BOARD)/tools.cpio
initrd.intermediate: $(build)/$(BOARD)/initrd.cpio.xz
$(build)/$(BOARD)/initrd.cpio.xz: $(initrd-y)
$(build)/$(BOARD)/initrd.cpio.xz: $(or $(INITRD_OVERRIDE),$(initrd-y))
$(call do,CPIO-CLEAN,$@,\
$(pwd)/bin/cpio-clean \
$^ \

View File

@ -1,9 +1,14 @@
# Configuration for a Winterfell OCP node
# and it is NERF, not coreboot.
# and it uses LinuxBoot, not coreboot.
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.
CONFIG_UROOT=y
CONFIG_CRYPTSETUP=y
CONFIG_FLASHROM=y
#CONFIG_GPG=y
@ -18,6 +23,7 @@ CONFIG_POPT=y
#CONFIG_XEN=y
CONFIG_DROPBEAR=y
# Linux modules will still be linked into the u-root tree
CONFIG_LINUX_USB=y
CONFIG_LINUX_MLX4=y
CONFIG_LINUX_ATA=y

33
modules/u-root Normal file
View File

@ -0,0 +1,33 @@
#
# u-root go runtime
#
# This is not a normal Heads module, since it builds all of its
# own dependencies.
#
ifeq "$(CONFIG_UROOT)" "y"
u-root_url := github.com/u-root/u-root
u-root_output := $(build)/$(BOARD)/initrd.cpio
export GOPATH=$(build)/go
$(GOPATH):
$(call do,GO GET,$(u-root_url),\
go get $(u-root_url) \
)
$(u-root_output): $(GOPATH)
$(call do,U-ROOT,$@,\
$(GOPATH)/bin/u-root \
-build=bb \
-format=cpio \
-o $@ \
)
# Override the initrd inputs and add in the kernel modules
INITRD_OVERRIDE += $(u-root_output)
INITRD_OVERRIDE += $(build)/$(BOARD)/modules.cpio
endif