external/LinuxBoot: Deprecate GOPATH in u-root

This is a breaking change for now when using latest u-root main, which
is the default behavior in LinuxBoot.
u-root switched to golang modules and therefore `go get` is not the
standard behavior anymore. The workaround for this is to pull the
repository and build directly in the directory for now. Another apporach
would be to use `go install $pkg@latest` to install the binary at that
particular version into the golang binary path.

Currently missing is a control structure to enable the build process for
legacy versions <v0.8.0.

Signed-off-by: Patrik Tesarik <patrik.tesarik@9elements.com>
Change-Id: Ifa03504da6fa321ffc6d2506b27ebd2e3ed9961b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65090
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
This commit is contained in:
Patrik Tesarik 2022-06-10 23:23:21 +02:00 committed by Felix Held
parent eb05560fe1
commit b35c1f45a9
1 changed files with 8 additions and 6 deletions

View File

@ -40,11 +40,11 @@ endif
get: version get: version
if [ -d "$(go_path_dir)/src/$(uroot_package)" ]; then \ if [ -d "$(go_path_dir)/src/$(uroot_package)" ]; then \
git -C $(go_path_dir)/src/$(uroot_package) checkout --quiet main; \ git -C $(go_path_dir)/src/$(uroot_package) checkout --quiet main; \
GOPATH=$(go_path_dir) go get -d -u -v $(uroot_package) || \ git -C $(go_path_dir)/src/$(uroot_package) pull || \
echo -e "\n<<u-root package update failed>>\n"; \ echo -e "\n<<Pulling u-root package from GitHub failed>>\n"; \
else \ else \
GOPATH=$(go_path_dir) go get -d -u -v $(uroot_package) || \ git clone https://${uroot_package} ${go_path_dir}/src/${uroot_package} || \
(echo -e "\n<<failed to get u-root package. Please check your internet access>>\n" && \ (echo -e "\n<<Failed to clone u-root package. Please check your internet access>>\n" && \
exit 1); \ exit 1); \
fi fi
@ -52,10 +52,12 @@ checkout: get
git -C $(go_path_dir)/src/$(uroot_package) checkout --quiet $(CONFIG_LINUXBOOT_UROOT_VERSION) git -C $(go_path_dir)/src/$(uroot_package) checkout --quiet $(CONFIG_LINUXBOOT_UROOT_VERSION)
build: checkout build: checkout
GOPATH=$(go_path_dir) go build -o $(uroot_bin) $(uroot_package) cd ${go_path_dir}/src/${uroot_package}; \
go build -o ${uroot_bin} .
u-root: build u-root: build
GOARCH=$(ARCH-y) GOPATH=$(go_path_dir) $(uroot_bin) \ GOARCH=$(ARCH-y) $(uroot_bin) \
-uroot-source ${go_path_dir}/src/${uroot_package} \
$(uroot_args) -o $(project_dir)/initramfs_u-root.cpio $(uroot_cmds) $(uroot_args) -o $(project_dir)/initramfs_u-root.cpio $(uroot_cmds)
.PHONY: all u-root build checkout get version .PHONY: all u-root build checkout get version