在Centos7上交叉编译生成OpenWrt固件
安装ss-*
获取最新的ss, 当前是
wget https://github.com/*/*-libev/archive/v2.5.6.tar.gz
解压后 ./configure, make, make install
设置代理
[root@u02 ~]# more /etc/*-local.json { "server": "milton.somewhere.com", , "local_address":"127.0.0.1", , "password": "foobar", , "method": "aes-256-cfb" }
启动本地代理
/usr/local/bin/ss-local -c /etc/*-local.json -b
如果要在后台启动
nohup /usr/local/bin/ss-local -c /etc/*-local.json -b 0.0.0.0 -l 1080 > /dev/null 2>&1 & # 检查是否成功启动 netstat -lnp| # 加入开机自启动 echo " nohup ss-local -c /etc/*/config.json /dev/null 2>&1 &" /etc/rc.local # 查看后台进程 ps aux |grep ss-local
配置为git的代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
or
git config --local http.proxy 'socks5://127.0.0.1:18001' # 检查是否生效 git config --list
Git导出代码
# The development branch (trunk) contains everything from documentation to experimental patches. git clone git://github.com/openwrt/openwrt.git # 15.05 branch (Chaos Calmer) git clone -b chaos_calmer git://github.com/openwrt/openwrt.git # 14.07 branch (Barrier Breaker) git clone -b barrier_breaker git://github.com/openwrt/openwrt.git # 更新代码 git pull
(可选)下载并安装所有可用的"feeds"
cd openwrt ./scripts/feeds update -a
# 中间会出很多warning, 不用管它 ./scripts/feeds install -a
让OpenWrt构建系统检查缺失的package, 这里你需要选择编译的配置和目标
make menuconfig (most likely you would like to use this) make defconfig
编译
make defconfig sudo yum install zlib-static patch subversion make defconfigmake menuconfig make V=s
make V=99 TARGET_DEVICES=y1
Proceed with build (i.e. cross-compile the downloaded sources to binaries)
\\After the cross-compilation process the trunk-directory contained over 240000 files with a total size of above 3GiB!
编译结果
编译成功后, 生成的文件可以在 <buildroot_dir>/bin 目录找到. The compiled files are additionally classified by the target platform, so e.g. a firmware built for an ar71xx device will be located in <buildroot_dir>/bin/ar71xx directory.
E.g. if your <buildroot_dir> is ~/openwrt/trunk, the binaries are in ~/openwrt/trunk/bin/ar71xx.
注: 构建中需要的库
yum install openssl-devel ncurses-devel yum install zlib-static patch subversion