[coreboot-gerrit] Change in coreboot[master]: payloads/external/Linuxboot/targets: use go get to install u-root

Jens Drenhaus (Code Review) gerrit at coreboot.org
Tue Nov 6 16:47:26 CET 2018


Jens Drenhaus has uploaded this change for review. ( https://review.coreboot.org/29515


Change subject: payloads/external/Linuxboot/targets: use go get to install u-root
......................................................................

payloads/external/Linuxboot/targets: use go get to install u-root

make sure, there is proper go tree set up in inside the linuxboot
build directory. Then use go get to to download u-root from github.
It also builds the code and installs u-root into the bin directory
of the lokal go tree.

Change-Id: I72866944165823300566e2e9bdaba59599a88178
Signed-off-by: Jens Drenhaus <jens.drenhaus at 9elements.com>
---
M payloads/external/LinuxBoot/targets/u-root.mk
1 file changed, 12 insertions(+), 35 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/29515/1

diff --git a/payloads/external/LinuxBoot/targets/u-root.mk b/payloads/external/LinuxBoot/targets/u-root.mk
index d4a0837..75499d7 100644
--- a/payloads/external/LinuxBoot/targets/u-root.mk
+++ b/payloads/external/LinuxBoot/targets/u-root.mk
@@ -12,7 +12,7 @@
 ## GNU General Public License for more details.
 ##
 
-uroot_git_repo=https://github.com/u-root/u-root.git
+uroot_git_repo=github.com/u-root/u-root
 uroot_dir=$(project_dir)/go/src/github.com/u-root/u-root
 go_version=$(shell go version | sed -nr 's/.*go([0-9]+\.[0-9]+.?[0-9]?).*/\1/p' )
 go_version_major=$(shell echo $(go_version) |  sed -nr 's/^([0-9]+)\.([0-9]+)\.?([0-9]*)$$/\1/p')
@@ -36,58 +36,35 @@
 	exit 1
 endif
 endif
-	mkdir -p $(project_dir)/go/src/github.com/u-root
+	mkdir -p $(go_path_dir)/src
+	mkdir -p $(go_path_dir)/bin
 
-$(uroot_dir)/.git:
-	@echo "    Git        Cloning u-root $(CONFIG_LINUXBOOT_UROOT_VERSION)"
-	git clone $(uroot_git_repo) $(uroot_dir)
-
-fetch: check $(uroot_dir)/.git
-	-cd "$(uroot_dir)" && git fetch origin
-
-checkout: fetch
-	cd "$(uroot_dir)" && \
-	if ! git diff --quiet _cb_checkout "$(CONFIG_LINUXBOOT_UROOT_VERSION)" -- 2>/dev/null; \
-	then \
-		printf "    CHECKOUT    $(project_name) [$(CONFIG_LINUXBOOT_UROOT_VERSION)]\n"; \
-		git checkout $$(git rev-parse HEAD) >/dev/null 2>&1; \
-		git branch -f _cb_checkout "$(CONFIG_LINUXBOOT_UROOT_VERSION)" && \
-		git checkout _cb_checkout && \
-		$(if $(project_patches), \
-		for patch in $(project_patches); do \
-			printf "    PATCH       $$patch\n"; \
-			git am --keep-cr "$$patch" || \
-				( printf "Error when applying patches.\n"; \
-				  git am --abort; exit 1; ); \
-		done;,true;) \
-	fi
-
-$(uroot_dir)/u-root: $(uroot_dir)/u-root.go
+$(go_path_dir)/bin/u-root:
 	@echo "    GO        u-root"
-	cd $(uroot_dir); \
-	GOPATH=$(go_path_dir) go build u-root.go
+	cd $(go_path_dir)/src; \
+	GOPATH=$(go_path_dir) go get -u $(uroot_git_repo)
 
-$(project_dir)/initramfs.cpio.xz: checkout $(uroot_dir)/u-root
+$(project_dir)/initramfs.cpio.xz: check $(go_path_dir)/bin/u-root
 	@echo "    MAKE       u-root $(CONFIG_LINUXBOOT_UROOT_VERSION)"
 ifneq ($(CONFIG_LINUXBOOT_UROOT_COMMANDS),)
 ifneq ($(CONFIG_LINUXBOOT_UROOT_FILES),)
-	cd $(uroot_dir); \
+	cd $(go_path_dir)/bin; \
 	GOARCH=$(CONFIG_LINUXBOOT_ARCH) GOPATH=$(go_path_dir) ./u-root \
 	-build=bb -files $(CONFIG_LINUXBOOT_UROOT_FILES) -o $(project_dir)/initramfs.cpio \
 	$(patsubst %,cmds/%,$(CONFIG_LINUXBOOT_UROOT_COMMANDS))
 else
-	cd $(uroot_dir); \
+	cd $(go_path_dir)/bin; \
 	GOARCH=$(CONFIG_LINUXBOOT_ARCH) GOPATH=$(go_path_dir) ./u-root \
 	-build=bb -o $(project_dir)/initramfs.cpio \
 	$(patsubst %,cmds/%,$(CONFIG_LINUXBOOT_UROOT_COMMANDS))
 endif
 else
 ifneq ($(CONFIG_LINUXBOOT_UROOT_FILES),)
-	cd $(uroot_dir); \
+	cd $(go_path_dir)/bin; \
 	GOARCH=$(CONFIG_LINUXBOOT_ARCH) GOPATH=$(go_path_dir) ./u-root \
 	-build=bb -files $(CONFIG_LINUXBOOT_UROOT_FILES) -o $(project_dir)/initramfs.cpio coreboot-app
 else
-	cd $(uroot_dir); \
+	cd $(go_path_dir)/bin; \
 	GOARCH=$(CONFIG_LINUXBOOT_ARCH) GOPATH=$(go_path_dir) ./u-root \
 	-build=bb -o $(project_dir)/initramfs.cpio coreboot-app
 endif
@@ -96,4 +73,4 @@
 
 build: $(project_dir)/initramfs.cpio.xz
 
-.PHONY: build checkout fetch all check
+.PHONY: build all check

-- 
To view, visit https://review.coreboot.org/29515
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I72866944165823300566e2e9bdaba59599a88178
Gerrit-Change-Number: 29515
Gerrit-PatchSet: 1
Gerrit-Owner: Jens Drenhaus <jens.drenhaus at 9elements.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181106/aa39dedb/attachment.html>


More information about the coreboot-gerrit mailing list