diff --git a/Makefile b/Makefile index 0675f86a..e39c428f 100644 --- a/Makefile +++ b/Makefile @@ -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 \ $^ \ diff --git a/boards/winterfell.config b/boards/winterfell.config index aa145943..aa862f64 100644 --- a/boards/winterfell.config +++ b/boards/winterfell.config @@ -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 diff --git a/modules/u-root b/modules/u-root new file mode 100644 index 00000000..ecdf2abc --- /dev/null +++ b/modules/u-root @@ -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