mb/google/fatcat: config GPP_F23 as ISH gpio pin
[coreboot2.git] / payloads / external / LinuxBoot / targets / u-root.mk
blob90b48eaf3a16e4307cc6a58a5ab5f67ae2fa72bb
1 ## SPDX-License-Identifier: GPL-2.0-only
3 uroot_package = github.com/u-root/u-root
4 uroot_build = build/go/src/$(uroot_package)
6 UROOT_ARCH-$(CONFIG_LINUXBOOT_X86_64) = amd64
7 UROOT_ARCH-$(CONFIG_LINUXBOOT_X86) = 386
8 UROOT_ARCH-$(CONFIG_LINUXBOOT_ARM64) = arm64
9 UROOT_ARCH-$(CONFIG_LINUXBOOT_RISCV_RV64) = riscv64
11 go_version = $(shell go version | sed -nr 's/.*go([0-9]+\.[0-9]+.?[0-9]?).*/\1/p' )
12 go_version_major = $(shell echo $(go_version) | sed -nr 's/^([0-9]+)\.([0-9]+)\.?([0-9]*)$$/\1/p')
13 go_version_minor = $(shell echo $(go_version) | sed -nr 's/^([0-9]+)\.([0-9]+)\.?([0-9]*)$$/\2/p')
15 uroot_args += -build=$(CONFIG_LINUXBOOT_UROOT_FORMAT)
16 uroot_args += -initcmd $(CONFIG_LINUXBOOT_UROOT_INITCMD)
17 uroot_args += -uinitcmd=$(CONFIG_LINUXBOOT_UROOT_UINITCMD)
18 uroot_args += -defaultsh $(CONFIG_LINUXBOOT_UROOT_SHELL)
19 ifneq (CONFIG_LINUXBOOT_UROOT_FILES,)
20 uroot_args += $(foreach file,$(CONFIG_LINUXBOOT_UROOT_FILES),-files $(PWD)/$(file))
21 endif
23 uroot_cmds = $(CONFIG_LINUXBOOT_UROOT_COMMANDS)
25 version:
26 ifeq ("$(go_version)","")
27 printf "\n<<Please install Golang >= 1.9 for u-root mode>>\n\n"
28 exit 1
29 endif
30 ifeq ($(shell if [ $(go_version_major) -eq 1 ]; then echo y; fi),y)
31 ifeq ($(shell if [ $(go_version_minor) -lt 9 ]; then echo y; fi),y)
32 printf "\n Golang version $(go_version) currently installed.\n\
33 <<Please install Golang >= 1.9 for u-root mode>>\n\n"
34 exit 1
35 endif
36 endif
38 $(uroot_build):
39 git clone https://$(uroot_package) $(uroot_build)
40 git -C $(uroot_build) checkout --quiet $(CONFIG_LINUXBOOT_UROOT_VERSION)
42 $(uroot_build)/u-root: $(uroot_build)
43 cd $(uroot_build); \
44 go build -o u-root .
46 #$(CONFIG_LINUXBOOT_INITRAMFS_PATH)
47 build/initramfs_u-root.cpio: $(uroot_build)/u-root
48 GOARCH=$(UROOT_ARCH-y) $(uroot_build)/u-root \
49 -uroot-source $(uroot_build) \
50 $(uroot_args) -o build/initramfs_u-root.cpio $(uroot_cmds)