2018-02-13 15:47:31 -05:00
|
|
|
#
|
|
|
|
# u-root go runtime
|
|
|
|
#
|
|
|
|
# This is not a normal Heads module, since it builds all of its
|
|
|
|
# own dependencies.
|
|
|
|
#
|
|
|
|
|
|
|
|
u-root_url := github.com/u-root/u-root
|
2018-02-13 17:46:48 -05:00
|
|
|
u-root_output := $(build)/$(BOARD)/u-root.cpio
|
2018-03-12 14:27:43 +01:00
|
|
|
UROOT_CMDS ?=
|
2018-02-13 15:47:31 -05:00
|
|
|
|
|
|
|
export GOPATH=$(build)/go
|
2018-03-12 14:27:43 +01:00
|
|
|
src_cmds := $(foreach cmd,$(UROOT_CMDS),github.com/u-root/u-root/cmds/$(cmd))
|
2018-02-13 15:47:31 -05:00
|
|
|
|
|
|
|
$(GOPATH):
|
|
|
|
$(call do,GO GET,$(u-root_url),\
|
|
|
|
go get $(u-root_url) \
|
|
|
|
)
|
|
|
|
|
2018-03-12 21:31:58 +01:00
|
|
|
clean:
|
|
|
|
rm -f $(build)/$(BOARD)/u-root.cpio
|
|
|
|
|
|
|
|
$(u-root_output): $(GOPATH) clean
|
2018-03-12 14:27:43 +01:00
|
|
|
ifeq ($(shell test -e boards/$(BOARD)/uinit.go && echo -n yes),yes)
|
|
|
|
ifeq ($(shell (test -d $(GOPATH)/src/github.com/u-root/u-root/cmds/uinit || echo -n yes)),yes)
|
|
|
|
mkdir $(GOPATH)/src/github.com/u-root/u-root/cmds/uinit
|
|
|
|
endif
|
|
|
|
cp boards/$(BOARD)/uinit.go $(GOPATH)/src/github.com/u-root/u-root/cmds/uinit
|
|
|
|
endif
|
2018-02-13 15:47:31 -05:00
|
|
|
$(call do,U-ROOT,$@,\
|
|
|
|
$(GOPATH)/bin/u-root \
|
|
|
|
-build=bb \
|
|
|
|
-format=cpio \
|
2018-03-12 14:27:43 +01:00
|
|
|
-o $@ \
|
|
|
|
$(src_cmds)\
|
2018-02-13 15:47:31 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
# Override the initrd inputs and add in the kernel modules
|
2018-02-13 17:46:48 -05:00
|
|
|
initrd-$(CONFIG_UROOT) += $(u-root_output)
|
2018-02-13 15:47:31 -05:00
|
|
|
|
|
|
|
|
2018-02-13 17:46:48 -05:00
|
|
|
# If we are building for u-root, disable the default CONFIG_HEADS
|
|
|
|
ifeq "$(CONFIG_UROOT)" "y"
|
|
|
|
CONFIG_HEADS=n
|
2018-02-13 15:47:31 -05:00
|
|
|
endif
|