crosscompiling for openwrt with golang

缘来 实验了下nim语言(nimlang)在OpenWRT系统下可执行程序的交叉编译,也想实验一下Golang的交叉编译,发现更方便。 Golang支持的交叉编译平台 amd64 (also known as x86-64) A mature implementation. 386 (x86 or x86-32) Comparable to the amd64 port. arm (ARM) Supports Linux, FreeBSD, NetBSD, OpenBSD and Darwin binaries. Less widely used than the other ports. arm64 (AArch64) Supports Linux and Darwin binaries. New in 1.5 and not as well exercised as other ports. ppc64, ppc64le (64-bit PowerPC big- and little-endian) Supports Linux binaries. New in 1.5 and not as well exercised as other ports. mips, mipsle (32-bit MIPS big- and little-endian) Supports Linux binaries. New in 1.8 and not as well exercised as other ports. mips64, mips64le (64-bit MIPS big- and little-endian) Supports Linux binaries. New in 1.6 and not as well exercised as other ports. s390x (IBM System z) Supports Linux binaries. New in 1.7 and not as well exercised as other ports. wasm (WebAssembly) Targets the WebAssembly platform. New in 1.11 and not as well exercised as other ports. Golang针对mips系统的交叉编译 GOOS=linux GOARCH=mips go build -ldflags="-s -w" test.go 直接指定目标系统和CPU架构,就直接可以编译生成对应平台下的可执行文件 ...

November 15, 2019 · 1 min · nivrrex

crosscompiling for openwrt with nim

缘来 nim语言(nimlang)最近更新到1.02版本了,感觉还不错,正好最近在玩OpenWRT,记录一下在Linux下交叉编译mips架构的OpenWRT系统下的可执行程序步骤。 Debian系统下下载nim语言 sh -c 'printf "deb http://ftp.cn.debian.org/debian/ sid main" > /etc/apt/sources.list.d/sid.list' apt update apt -t sid install nim -y Debian系统下安装gcc等编译环境 apt-get install build-essential 下载对应架构的OpenWRT编译工具链toolchain wget https://archive.openwrt.org/releases/18.06.4/targets/ramips/mt7621/openwrt-sdk-18.06.4-ramips-mt7621_gcc-7.3.0_musl.Linux-x86_64.tar.xz tar xvf openwrt-sdk-18.06.4-ramips-mt7621_gcc-7.3.0_musl.Linux-x86_64.tar.xz rm openwrt-sdk-18.06.4-ramips-mt7621_gcc-7.3.0_musl.Linux-x86_64.tar.xz 设置环境并进行编译 export PATH=/root/openwrt-sdk-18.06.4-ramips-mt7621_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/:$PATH nim -d:release --opt=size -d:ssl --cpu:mipsel --os:linux --gcc.exe:mipsel-openwrt-linux-gcc --gcc.linkerexe:mipsel-openwrt-linux-gcc c test.nim 结 就这样,就可以生成对应路由器下的可执行文件啦~

November 15, 2019 · 1 min · nivrrex

ubnt er-x use openwrt

给UBNT的ER-X刷OpenWrt固件 缘 UBNT 的 ER-X 是个弱电箱的神器,设备很小,用的是 MT7621AT 。虽然没有无线,但是弱电箱里面无线信号本来就屏蔽的厉害,后期加装个 AP 就行了。 ...

July 9, 2018 · 3 min · nivrrex

fanqiang with chinadns

来由 用Opera等浏览器时,由于DNS被GFW污染了,所以fanqiang的有些不爽快,像Twitter.com和Facebook.com无法上,虽然IE等借助Shadowsocks可以直接上?所以想在OpenWRT上,把DNS污染问题彻底解决了。 ...

July 26, 2015 · 5 min · nivrrex

build openwrt with image builder

来由 这几天在折腾OpenWrt,前文fanqiang with openwrt+vps里说过, 我用的是PandoraBox最新编译的版本,但是其内置的packages里面很多软件没有编译,如Python等。而直接换用官方的packages,会提示兼容性问题,无法直接使用。 从网络Google了一下,可以两个同时使用。 ...

July 17, 2014 · 4 min · nivrrex

fanqiang with openwrt+vps

来由 在上一篇《fanqiang with vpn+chnroutes》中,通过免费的vpn和chnroutes,已经可以成功的翻墙了,后来觉得免费VPN不稳定,又买了一个月的付费vpn;再后来,觉得付费vpn不是共享,服务器上的多了,就又要换服务器,不爽;于是就决定,找个国外的vps主机,自己独享fq带宽! ...

July 8, 2014 · 4 min · nivrrex