Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
From 6aed475557032a7ff9009e9b4b691b40b561876a Mon Sep 17 00:00:00 2001
|
||||
From: Angelo Compagnucci <angelo@amarulasolutions.com>
|
||||
Date: Tue, 8 May 2018 16:08:44 +0200
|
||||
Subject: [PATCH] build.go: explicit option for crosscompilation
|
||||
|
||||
Actually if GOHOSTOS == GOOS || GOHOSTARCH == GOARCH the go build system
|
||||
assume it's not cross compiling and uses the same toolchain also for the
|
||||
bootstrap. This is a problem in case the cross compilation mandates a
|
||||
different toolchain for bootstrap and target. This patch adds
|
||||
GO_ASSUME_CROSSCOMPILING variable to assure that in case of cross
|
||||
compilation CC_FOR_TARGET can be different from CC.
|
||||
|
||||
Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
|
||||
Signed-off-by: Anisse Astier <anisse@astier.eu>
|
||||
---
|
||||
src/cmd/dist/build.go | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
|
||||
index 7c44c4a605..03500920c4 100644
|
||||
--- a/src/cmd/dist/build.go
|
||||
+++ b/src/cmd/dist/build.go
|
||||
@@ -286,12 +286,13 @@ func xinit() {
|
||||
// $CC_FOR_goos_goarch, if set, applies only to goos/goarch.
|
||||
func compilerEnv(envName, def string) map[string]string {
|
||||
m := map[string]string{"": def}
|
||||
+ crosscompiling := os.Getenv("GO_ASSUME_CROSSCOMPILING")
|
||||
|
||||
if env := os.Getenv(envName); env != "" {
|
||||
m[""] = env
|
||||
}
|
||||
if env := os.Getenv(envName + "_FOR_TARGET"); env != "" {
|
||||
- if gohostos != goos || gohostarch != goarch {
|
||||
+ if gohostos != goos || gohostarch != goarch || crosscompiling == "1" {
|
||||
m[gohostos+"/"+gohostarch] = m[""]
|
||||
}
|
||||
m[""] = env
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
From 6b05378097c6a386ed9912d2471976dc39504e86 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Stewart <christian@aperture.us>
|
||||
Date: Thu, 27 Jul 2023 21:28:47 -0700
|
||||
Subject: [PATCH] cmd/dist: set buildvcs=false when building go-bootstrap
|
||||
|
||||
When building go-bootstrap as part of the make.bash process, the cmd/dist
|
||||
invokes the bootstrap Go compiler to build the go_bootstrap tool:
|
||||
|
||||
${GOROOT_BOOTSTRAP}/bin/go install -tags=math_big_pure_go compiler_bootstrap purego bootstrap/cmd/...
|
||||
|
||||
If there is an invalid .git directory in a parent of ${GOROOT_BOOTSTRAP},
|
||||
make.bash will fail. Reproduction of the issue:
|
||||
|
||||
mkdir go-issue-61620
|
||||
cd ./go-issue-61620
|
||||
wget https://go.dev/dl/go1.19.11.src.tar.gz
|
||||
mkdir go-bootstrap
|
||||
tar -xf go1.19.11.src.tar.gz -C ./go-bootstrap --strip-components=1
|
||||
cd ./go-bootstrap/src/
|
||||
bash make.bash
|
||||
cd ../../
|
||||
wget https://go.dev/dl/go1.20.6.src.tar.gz
|
||||
mkdir go
|
||||
tar -xf go1.20.6.src.tar.gz -C ./go/ --strip-components=1
|
||||
printf "gitdir: ../../does/not/exist/.git" > ./.git
|
||||
cd ./go/src/
|
||||
GOROOT_BOOTSTRAP=$(pwd)/../../go-bootstrap/ bash make.bash
|
||||
|
||||
The build fails with the following error:
|
||||
|
||||
Building Go toolchain1 using [snip]/go-1.19.10.
|
||||
error obtaining VCS status: exit status 128
|
||||
Use -buildvcs=false to disable VCS stamping.
|
||||
go tool dist: FAILED: [snip]/go-1.19.10/bin/go install -tags=math_big_pure_go \
|
||||
compiler_bootstrap purego bootstrap/cmd/...: exit status 1
|
||||
|
||||
This change unconditionally sets -buildvcs=false when compiling go-bootstrap. We
|
||||
don't need the revision information in those binaries anyway. Setting this flag
|
||||
was previously not done as we were unsure if the go-bootstrap compiler would be
|
||||
new enough to support the buildvcs build flag. Since Go 1.20.x, Go 1.19.x is the
|
||||
minimum version for go-bootstrap, and supports -buildvcs=false. We can now set
|
||||
-buildvcs=false without worrying about compatibility.
|
||||
|
||||
Related: https://github.com/golang/go/issues/54852
|
||||
Fixes: https://github.com/golang/go/issues/61620
|
||||
|
||||
---
|
||||
|
||||
Upstream: https://github.com/golang/go/pull/61621
|
||||
|
||||
Signed-off-by: Christian Stewart <christian@aperture.us>
|
||||
|
||||
---
|
||||
src/cmd/dist/buildtool.go | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go
|
||||
index a528d7aa76..3b411d6ebb 100644
|
||||
--- a/src/cmd/dist/buildtool.go
|
||||
+++ b/src/cmd/dist/buildtool.go
|
||||
@@ -221,6 +221,9 @@ func bootstrapBuildTools() {
|
||||
cmd := []string{
|
||||
pathf("%s/bin/go", goroot_bootstrap),
|
||||
"install",
|
||||
+ // Fixes cases where an invalid .git is present in a parent of GOROOT_BOOTSTRAP.
|
||||
+ // See: https://github.com/golang/go/issues/61620
|
||||
+ "-buildvcs=false",
|
||||
"-tags=math_big_pure_go compiler_bootstrap purego",
|
||||
}
|
||||
if vflag > 0 {
|
||||
--
|
||||
2.41.0
|
||||
|
||||
1
package/go/go-src/go-src.hash
Symbolic link
1
package/go/go-src/go-src.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../go.hash
|
||||
59
package/go/go-src/go-src.mk
Normal file
59
package/go/go-src/go-src.mk
Normal file
@@ -0,0 +1,59 @@
|
||||
################################################################################
|
||||
#
|
||||
# go-src
|
||||
#
|
||||
################################################################################
|
||||
|
||||
GO_SRC_VERSION = $(GO_VERSION)
|
||||
GO_SRC_SITE = https://go.dev/dl
|
||||
GO_SRC_SOURCE = go$(GO_VERSION).src.tar.gz
|
||||
GO_SRC_DL_SUBDIR = go
|
||||
|
||||
GO_SRC_LICENSE = BSD-3-Clause
|
||||
GO_SRC_LICENSE_FILES = LICENSE
|
||||
GO_SRC_CPE_ID_VENDOR = golang
|
||||
GO_SRC_CPE_ID_PRODUCT = go
|
||||
|
||||
HOST_GO_SRC_PROVIDES = host-go
|
||||
HOST_GO_SRC_DEPENDENCIES = \
|
||||
host-go-bootstrap-stage5 \
|
||||
$(HOST_GO_DEPENDENCIES_CGO)
|
||||
|
||||
ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y)
|
||||
|
||||
HOST_GO_SRC_CROSS_ENV = \
|
||||
CC_FOR_TARGET="$(TARGET_CC)" \
|
||||
CXX_FOR_TARGET="$(TARGET_CXX)" \
|
||||
GOOS="linux" \
|
||||
GOARCH=$(GO_GOARCH) \
|
||||
$(if $(GO_GO386),GO386=$(GO_GO386)) \
|
||||
$(if $(GO_GOARM),GOARM=$(GO_GOARM)) \
|
||||
GO_ASSUME_CROSSCOMPILING=1
|
||||
|
||||
endif
|
||||
|
||||
# The go build system is not compatible with ccache, so use
|
||||
# HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
|
||||
HOST_GO_SRC_MAKE_ENV = \
|
||||
GO111MODULE=off \
|
||||
GOCACHE=$(HOST_GO_HOST_CACHE) \
|
||||
GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE5_ROOT) \
|
||||
GOROOT_FINAL=$(HOST_GO_ROOT) \
|
||||
GOROOT="$(@D)" \
|
||||
GOBIN="$(@D)/bin" \
|
||||
GOOS=linux \
|
||||
CC=$(HOSTCC_NOCCACHE) \
|
||||
CXX=$(HOSTCXX_NOCCACHE) \
|
||||
CGO_ENABLED=$(HOST_GO_CGO_ENABLED) \
|
||||
$(HOST_GO_SRC_CROSS_ENV)
|
||||
|
||||
define HOST_GO_SRC_BUILD_CMDS
|
||||
cd $(@D)/src && \
|
||||
$(HOST_GO_SRC_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
|
||||
endef
|
||||
|
||||
define HOST_GO_SRC_INSTALL_CMDS
|
||||
$(GO_BINARIES_INSTALL)
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
Reference in New Issue
Block a user