Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有没有交叉编译教程 #32

Closed
ghost opened this issue Apr 4, 2017 · 5 comments
Closed

有没有交叉编译教程 #32

ghost opened this issue Apr 4, 2017 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Apr 4, 2017

类似这种的
https://github.com/xtaci/kcptun/wiki/mip32-cross-compile

fpu默认都是关闭的 开启很麻烦 开启之后也用不了官方源kmod模块

@ghost
Copy link
Author

ghost commented Apr 4, 2017

https://downloads.lede-project.org/releases/17.01.0/targets/ar71xx/nand/packages/
可以看到完整的kmod数量有600+ 为了一个fpu选项而单独去编译这些依赖 实在让人难以接受 不如用 gomini

@ghost
Copy link
Author

ghost commented Apr 4, 2017

参照那个 wiki 改了一下

#mips版
cd ~
git clone https://github.com/gomini/go-mips32.git
cd go-mips32/src
export GOOS=linux
export GOARCH=mips32
./make.bash 
CGO_ENABLED=0 ./make.bash

export GOPATH=~/go-mips32/src/gocode
export GOOS=linux
export GOARCH=mips32
export GOROOT=~/go-mips32
export PATH=~/go-mips32/bin:$PATH

go get -v github.com/shawn1m/overture/main

VERSION=`date -u +%Y%m%d`
LDFLAGS="-X main.VERSION=$VERSION -s -w"
env CGO_ENABLED=0 GOOS=linux GOARCH=mips32 go build -ldflags "$LDFLAGS" -o ~/overture_linux_mips github.com/shawn1m/overture/main

mipsel版本 修改 GOARCH 参数即可

export GOARCH=mips32le

@ghost ghost closed this as completed Apr 4, 2017
@ghost
Copy link
Author

ghost commented Apr 5, 2017

发现官方已经支持没有开FPU的固件了
这个特性在go1.9会实现
https://github.com/golang/go/milestone/49
但是补丁早就已经出了 我试了可以用
https://go-review.googlesource.com/c/37958/
安装方法:
下载解压重命名文件夹到 ~/go 并编译
https://go.googlesource.com/go/+archive/861c5364826a25e50ac351df720bee24e8e10f9b.tar.gz
编译指令

cd ~/go/src
env GOARCH=mips ./make.bash

编译好了之后 正式开始编译overture mips版

~/go/bin/go get -v github.com/shawn1m/overture/main
env GOOS=linux GOARCH=mips GOMIPS=soft-float,mips32 ~/go/bin/go build -ldflags "-s -w" -a -o ~/overture_linux_mips github.com/shawn1m/overture/main

@ghost ghost reopened this Apr 5, 2017
@shawn1m
Copy link
Owner

shawn1m commented Apr 5, 2017

非常感谢,我等会把这个 issue 链接放到 README 里去,在 go 1.9 之前 mips 的问题还是很多。

shawn1m added a commit that referenced this issue Apr 5, 2017
@jemyzhang
Copy link
Contributor

原以为go 1.9.2已经merge了这个commit,没想到折腾半天,这个commit还没有merge进去。用了 @suikatomoki 的go版本可以,感谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants