Merge commit '71ab876'

master
Harry Cheng 5 years ago
commit e38e72c0d4

@ -5,6 +5,14 @@ mode ?= debug
out_dir ?= build/$(arch) out_dir ?= build/$(arch)
out_img ?= build/$(arch).img out_img ?= build/$(arch).img
out_qcow2 ?= build/$(arch).qcow2 out_qcow2 ?= build/$(arch).qcow2
python ?= 0
golang ?= 0
iperf3 ?= 0
redis ?= 0
nginx ?= 0
ucore ?= 0
test ?= 0
biscuit ?= 0
rcore_fs_fuse_revision ?= 351d382 rcore_fs_fuse_revision ?= 351d382
@ -28,7 +36,7 @@ cmake_build_args += -DCMAKE_BUILD_TYPE=Release
endif endif
.PHONY: all clean build rust ucore biscuit bin busybox nginx redis alpine iperf3 .PHONY: all clean build rust ucore biscuit bin busybox nginx redis alpine iperf3 python golang
all: build all: build
@ -39,13 +47,16 @@ rust:
@cp $(rust_bins) $(out_dir)/rust @cp $(rust_bins) $(out_dir)/rust
ucore: ucore:
ifeq ($(ucore), 1)
@echo Building ucore programs @echo Building ucore programs
@mkdir -p ucore/build @mkdir -p ucore/build
@cd ucore/build && cmake $(cmake_build_args) .. && make @cd ucore/build && cmake $(cmake_build_args) .. && make
@rm -rf $(out_dir)/ucore && mkdir -p $(out_dir)/ucore @rm -rf $(out_dir)/ucore && mkdir -p $(out_dir)/ucore
@cp $(ucore_bin_path)/* $(out_dir)/ucore @cp $(ucore_bin_path)/* $(out_dir)/ucore
endif
biscuit: biscuit:
ifeq ($(biscuit), 1)
ifneq ($(shell uname)-$(arch), Darwin-$(filter $(arch), riscv32 riscv64 aarch64)) ifneq ($(shell uname)-$(arch), Darwin-$(filter $(arch), riscv32 riscv64 aarch64))
@echo Building biscuit programs @echo Building biscuit programs
@mkdir -p biscuit/build @mkdir -p biscuit/build
@ -53,6 +64,7 @@ ifneq ($(shell uname)-$(arch), Darwin-$(filter $(arch), riscv32 riscv64 aarch64)
@rm -rf $(out_dir)/biscuit && mkdir -p $(out_dir)/biscuit @rm -rf $(out_dir)/biscuit && mkdir -p $(out_dir)/biscuit
@cp $(biscuit_bin_path)/* $(out_dir)/biscuit @cp $(biscuit_bin_path)/* $(out_dir)/biscuit
endif endif
endif
$(busybox): $(busybox):
ifeq ($(arch), x86_64) ifeq ($(arch), x86_64)
@ -73,6 +85,7 @@ endif
busybox: $(busybox) busybox: $(busybox)
nginx: nginx:
ifeq ($(nginx), 1)
ifneq ($(shell uname), Darwin) ifneq ($(shell uname), Darwin)
@echo Building nginx @echo Building nginx
mkdir -p $(out_dir)/usr/local/nginx/conf mkdir -p $(out_dir)/usr/local/nginx/conf
@ -81,8 +94,36 @@ ifneq ($(shell uname), Darwin)
@cp nginx/build/$(arch)/nginx $(out_dir) @cp nginx/build/$(arch)/nginx $(out_dir)
@cp nginx/nginx.conf $(out_dir)/usr/local/nginx/conf @cp nginx/nginx.conf $(out_dir)/usr/local/nginx/conf
endif endif
endif
python:
ifeq ($(python), 1)
ifeq ($(arch), $(filter $(arch), x86_64 aarch64))
ifneq ($(shell uname), Darwin)
@echo Building Python
@mkdir -p $(out_dir)/python
@cd python && make arch=$(arch) all
@cp -r python/build/$(arch)/target/* $(out_dir)/python
@dd if=/dev/urandom of=$(out_dir)/dev/urandom count=512
endif
endif
endif
golang:
ifeq ($(golang), 1)
ifeq ($(arch), $(filter $(arch), x86_64 aarch64))
ifneq ($(shell uname), Darwin)
@echo Building Golang
@mkdir -p $(out_dir)/golang
@cd golang && make arch=$(arch) all
@cp -r golang/build/$(arch)/target/* $(out_dir)/golang
@dd if=/dev/urandom of=$(out_dir)/dev/urandom count=512
endif
endif
endif
redis: redis:
ifeq ($(redis), 1)
ifneq ($(shell uname), Darwin) ifneq ($(shell uname), Darwin)
@echo Building redis @echo Building redis
@mkdir -p $(out_dir) @mkdir -p $(out_dir)
@ -91,8 +132,10 @@ ifneq ($(shell uname), Darwin)
@cp redis/build/$(arch)/redis-cli $(out_dir)/redis-cli @cp redis/build/$(arch)/redis-cli $(out_dir)/redis-cli
@cp redis/redis.conf $(out_dir)/redis.conf @cp redis/redis.conf $(out_dir)/redis.conf
endif endif
endif
iperf3: iperf3:
ifeq ($(iperf3), 1)
ifeq ($(arch), x86_64) ifeq ($(arch), x86_64)
ifneq ($(shell uname), Darwin) ifneq ($(shell uname), Darwin)
@echo Building iperf3 @echo Building iperf3
@ -102,6 +145,7 @@ ifneq ($(shell uname), Darwin)
@cp iperf3/build/$(arch)/iperf3 $(out_dir) @cp iperf3/build/$(arch)/iperf3 $(out_dir)
endif endif
endif endif
endif
$(alpine): $(alpine):
-wget "http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/$(arch)/$(alpine_file)" -O $(alpine) -wget "http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/$(arch)/$(alpine_file)" -O $(alpine)
@ -114,13 +158,15 @@ ifeq ($(arch), $(filter $(arch), x86_64 aarch64))
endif endif
test: test:
ifeq ($(test), 1)
ifeq ($(arch), $(filter $(arch), x86_64 aarch64)) ifeq ($(arch), $(filter $(arch), x86_64 aarch64))
@echo setup test DIR @echo setup test DIR
@mkdir -p $(out_dir) @mkdir -p $(out_dir)
@cp -r testsuits_alpine $(out_dir)/test @cp -r testsuits_alpine $(out_dir)/test
endif endif
endif
build: rust ucore biscuit $(busybox) nginx redis iperf3 test build: rust ucore biscuit $(busybox) nginx redis iperf3 python golang test
sfsimg: $(out_qcow2) sfsimg: $(out_qcow2)

1
golang/.gitignore vendored

@ -0,0 +1 @@
build/**

@ -0,0 +1,74 @@
golang_version := 1.12.7
golang_tarball := go$(golang_version).src.tar.gz
golang_tarball_path := src/$(golang_tarball)
golang_bin_tarball := go$(golang_version).linux-amd64.tar.gz
golang_bin_tarball_path := src/$(golang_bin_tarball)
build_dir := build/$(arch)
golang_bin_dir := $(build_dir)/go
golang_src_dir := $(build_dir)/go/src
golang_src_build_dir := $(build_dir)/target/src
prefix := $(arch)-linux-musl-
bin := $(build_dir)/target/bin/go
ifeq ($(arch), mipsel)
prefix := mipsel-linux-musln32-
go_arch := mipsle
else ifeq ($(arch), aarch64)
go_arch := arm64
else ifeq ($(arch), x86_64)
go_arch := amd64
endif
cc := $(prefix)gcc
cxx := $(prefix)g++
strip := $(prefix)strip
$(golang_bin_tarball_path):
wget https://dl.google.com/go/$(golang_bin_tarball) -O $(golang_bin_tarball_path)
$(golang_bin_dir): $(golang_bin_tarball_path)
mkdir -p $(build_dir)
cd $(build_dir) && tar xvf ../../$(golang_bin_tarball_path)
cd $(build_dir)/go && patch -p1 < ../../../set-external-linker.patch
touch $(golang_bin_dir)
$(golang_src_build_dir): $(golang_src_dir)
mkdir -p $(build_dir)/target
cp -r $(golang_src_dir) $(golang_src_build_dir)
$(bin): $(golang_bin_dir) $(golang_src_build_dir)
cd $(golang_src_build_dir) && \
GOROOT_BOOTSTRAP=`realpath ../../go` \
GOROOT_FINAL=/golang \
GOOS=linux \
GOARCH=$(go_arch) \
CC_FOR_TARGET=$(cc) \
CXX_FOR_TARGET=$(cxx) \
CC=x86_64-linux-musl-gcc \
CXX=x86_64-linux-musl-g++ \
LD=x86_64-linux-musl-ld \
GO_LDFLAGS="-buildmode=pie" \
CGO_ENABLED=1 \
./make.bash
# if [ "$(arch)" != "x86_64" ]; then \
# mv $(build_dir)/target/bin/*_*/* $(build_dir)/target/bin; \
# rm -rf $(build_dir)/target/bin/*_*; \
# rm -rf $(build_dir)/target/pkg/linux_amd64; \
# rm -rf $(build_dir)/target/pkg/tool/linux_amd64; \
# fi
# rm -rf $(build_dir)/target/pkg/obj
# rm -rf $(build_dir)/target/pkg/bootstrap
.PHONY: all clean
all: $(bin)
clean:
rm -rf build/$(arch)

@ -0,0 +1,106 @@
This patch is intended to fix https://github.com/golang/go/issues/18243
diff --git a/src/cmd/link/internal/amd64/obj.go b/src/cmd/link/internal/amd64/obj.go
index 87e8091..4470e05 100644
--- a/src/cmd/link/internal/amd64/obj.go
+++ b/src/cmd/link/internal/amd64/obj.go
@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
PEreloc1: pereloc1,
TLSIEtoLE: tlsIEtoLE,
- Linuxdynld: "/lib64/ld-linux-x86-64.so.2",
+ Linuxdynld: "/lib/ld-musl-x86_64.so.1",
Freebsddynld: "/libexec/ld-elf.so.1",
Openbsddynld: "/usr/libexec/ld.so",
Netbsddynld: "/libexec/ld.elf_so",
diff --git a/src/cmd/link/internal/arm/obj.go b/src/cmd/link/internal/arm/obj.go
index da16f92..fd14940 100644
--- a/src/cmd/link/internal/arm/obj.go
+++ b/src/cmd/link/internal/arm/obj.go
@@ -58,7 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
Gentext: gentext,
Machoreloc1: machoreloc1,
- Linuxdynld: "/lib/ld-linux.so.3", // 2 for OABI, 3 for EABI
+ Linuxdynld: "/lib/ld-musl-armhf.so.1",
Freebsddynld: "/usr/libexec/ld-elf.so.1",
Openbsddynld: "/usr/libexec/ld.so",
Netbsddynld: "/libexec/ld.elf_so",
diff --git a/src/cmd/link/internal/arm64/obj.go b/src/cmd/link/internal/arm64/obj.go
index 6b386ad..9986371 100644
--- a/src/cmd/link/internal/arm64/obj.go
+++ b/src/cmd/link/internal/arm64/obj.go
@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
Gentext: gentext,
Machoreloc1: machoreloc1,
- Linuxdynld: "/lib/ld-linux-aarch64.so.1",
+ Linuxdynld: "/lib/ld-musl-aarch64.so.1",
Freebsddynld: "XXX",
Openbsddynld: "XXX",
diff --git a/src/cmd/link/internal/mips/obj.go b/src/cmd/link/internal/mips/obj.go
index c5d3451..fd85e63 100644
--- a/src/cmd/link/internal/mips/obj.go
+++ b/src/cmd/link/internal/mips/obj.go
@@ -60,7 +60,7 @@ func Init() (*sys.Arch, ld.Arch) {
Gentext: gentext,
Machoreloc1: machoreloc1,
- Linuxdynld: "/lib/ld.so.1",
+ Linuxdynld: "/lib/ld-musl-mipsle.so.1",
Freebsddynld: "XXX",
Openbsddynld: "XXX",
diff --git a/src/cmd/link/internal/mips64/obj.go b/src/cmd/link/internal/mips64/obj.go
index 83974e5..0f65647 100644
--- a/src/cmd/link/internal/mips64/obj.go
+++ b/src/cmd/link/internal/mips64/obj.go
@@ -59,7 +59,7 @@ func Init() (*sys.Arch, ld.Arch) {
Gentext: gentext,
Machoreloc1: machoreloc1,
- Linuxdynld: "/lib64/ld64.so.1",
+ Linuxdynld: "/lib/ld-musl-mips64le.so.1",
Freebsddynld: "XXX",
Openbsddynld: "XXX",
Netbsddynld: "XXX",
diff --git a/src/cmd/link/internal/ppc64/obj.go b/src/cmd/link/internal/ppc64/obj.go
index 273d9b4..abe257d 100644
--- a/src/cmd/link/internal/ppc64/obj.go
+++ b/src/cmd/link/internal/ppc64/obj.go
@@ -62,7 +62,7 @@ func Init() (*sys.Arch, ld.Arch) {
Machoreloc1: machoreloc1,
// TODO(austin): ABI v1 uses /usr/lib/ld.so.1,
- Linuxdynld: "/lib64/ld64.so.1",
+ Linuxdynld: "/lib/ld-musl-powerpc64le.so.1",
Freebsddynld: "XXX",
Openbsddynld: "XXX",
diff --git a/src/cmd/link/internal/s390x/obj.go b/src/cmd/link/internal/s390x/obj.go
index 9ac7eb8..b3f7a66 100644
--- a/src/cmd/link/internal/s390x/obj.go
+++ b/src/cmd/link/internal/s390x/obj.go
@@ -57,7 +57,7 @@ func Init() (*sys.Arch, ld.Arch) {
Gentext: gentext,
Machoreloc1: machoreloc1,
- Linuxdynld: "/lib64/ld64.so.1",
+ Linuxdynld: "/lib/ld-musl-s390x.so.1",
// not relevant for s390x
Freebsddynld: "XXX",
diff --git a/src/cmd/link/internal/x86/obj.go b/src/cmd/link/internal/x86/obj.go
index 6a744dc..d81f392 100644
--- a/src/cmd/link/internal/x86/obj.go
+++ b/src/cmd/link/internal/x86/obj.go
@@ -58,7 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
Machoreloc1: machoreloc1,
PEreloc1: pereloc1,
- Linuxdynld: "/lib/ld-linux.so.2",
+ Linuxdynld: "/lib/ld-musl-i386.so.1",
Freebsddynld: "/usr/libexec/ld-elf.so.1",
Openbsddynld: "/usr/libexec/ld.so",
Netbsddynld: "/usr/libexec/ld.elf_so",

@ -0,0 +1 @@
*.tar.gz

@ -0,0 +1,48 @@
python_version := 3.7.0
python_tarball := Python-$(python_version).tar.xz
python_tarball_path := src/$(python_tarball)
build_dir := build/$(arch)
python_dir := $(build_dir)/Python-$(python_version)
prefix := $(arch)-linux-musl-
prefix_dir := build/$(arch)/target
bin_unstripped := $(prefix_dir)/bin/python3.7_unstripped
bin := $(prefix_dir)/bin/python3.7
ifeq ($(arch), mipsel)
prefix := mipsel-linux-musln32-
endif
cc := $(prefix)gcc
strip := $(prefix)strip
$(python_tarball_path):
wget https://www.python.org/ftp/python/$(python_version)/$(python_tarball) -O $(python_tarball_path)
$(python_dir): $(python_tarball_path)
mkdir -p $(build_dir)
cd $(build_dir) && tar xvf ../../$(python_tarball_path)
$(bin): $(python_dir)
cd $(python_dir) && ./configure \
CC=$(cc) \
--host=$(arch)-linux-musl \
--target=$(arch)-linux-musl \
--build=x86_64-linux-gnu \
--disable-ipv6 \
--without-ensurepip \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no \
ac_cv_have_long_long_format=yes \
--prefix=`realpath ../target`
cd $(python_dir) && make -j8 build_all
mkdir -p $(prefix_dir)
cd $(python_dir) && make -j8 altinstall
.PHONY: all clean
all: $(bin)
clean:
rm -rf build/$(arch)

@ -0,0 +1 @@
*.tar.xz
Loading…
Cancel
Save