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
3 changed files with 41 additions and 2 deletions

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