交叉编译ARM版(R7000路由器)SSR-libev客户端/服务器端

1.搭建编译环境

我的编译系统是 centos7
首先下载工具链
R6250-V1.0.0.62_with_toolchain_source.zip
只需要里面的hndtools-arm-linux-2.6.36-uclibc-4.5.3.tar.bz2工具链包,R7000 通用

1
2
3
4
5
cd /home/R7000
tar jxvf hndtools-arm-linux-2.6.36-uclibc-4.5.3.tar.bz2
sudo ln -s /home/R7000/hndtools-arm-linux-2.6.36-uclibc-4.5.3 /opt/brcm-arm

yum install libelf.so.1 libz.so.1 asciidoc xmlto

2.下载源码包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
wget https://tls.mbed.org/download/mbedtls-2.4.0-apache.tgz
tar zxvf mbedtls-2.4.0-apache.tgz
mkdir mbedtls

wget https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz
tar zxvf zlib-1.2.11.tar.gz
mkdir zlib

wget https://downloads.sourceforge.net/projects/pcre/files/pcre/8.39/pcre-8.39.tar.gz
tar zxvf pcre-8.39.tar.gz
mkdir pcre

git clone https://github.com/shadowsocksr/shadowsocksr-libev.git
mkdir ss

3.添加环境变量

1
2
3
4
5
6
export PATH=/opt/brcm-arm/bin:$PATH
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/brcm-arm/lib:/usr/local/lib:/usr/lib
export CC=arm-uclibc-linux-2.6.36-gcc
export CXX=arm-uclibc-linux-2.6.36-g++
export AR=arm-uclibc-linux-2.6.36-ar
export RANLIB=arm-uclibc-linux-2.6.36-ranlib

4.开始编译

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
cd mbedtls-2.4.0-apache
vi Makefile#修改第二行为DESTDIR=/home/R7000/mbedtls
make && make install

cd ../
cd zlib-1.2.11
./configure --prefix=/home/R7000/zlib
make && make install

cd ../
cd pcre-8.39
./configure --prefix=/home/R7000/pcre --host=arm-uclibc-linux


cd shadowsocksr-libev
./configure --prefix=/home/R7000/ss --with-mbedtls=/home/R7000/mbedtls --with-zlib=/home/R7000/zlib --with-pcre=/home/R7000/pcre --host=arm-uclibc-linux --with-crypto-library=mbedtls --disable-ssp
make && make install

cd /home/R7000/ss/bin
arm-uclibc-strip ss-local ss-manager ss-redir ss-server ss-tunnel

5.开始测试

copy 到/jffs/shadowsocks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
root@R7000:/jffs/ssserver# /jffs/shadowsocks/ss-redir -v

shadowsocks-libev 2.5.6 with mbed TLS 2.4.0

maintained by Max Lv <max.c.lv@gmail.com> and Linus Yang <laokongzi@gmail.com>

usage:

ss-redir

-s <server_host> Host name or IP address of your remote server.
-p <server_port> Port number of your remote server.
-l <local_port> Port number of your local server.
-k <password> Password of your remote server.
-m <encrypt_method> Encrypt method: table, rc4, rc4-md5,
aes-128-cfb, aes-192-cfb, aes-256-cfb,
aes-128-ctr, aes-192-ctr, aes-256-ctr,
bf-cfb, camellia-128-cfb, camellia-192-cfb,
camellia-256-cfb, cast5-cfb, des-cfb,
idea-cfb, rc2-cfb, seed-cfb, salsa20,
chacha20 and chacha20-ietf.
The default cipher is rc4-md5.

[-a <user>] Run as another user.
[-f <pid_file>] The file path to store pid.
[-t <timeout>] Socket timeout in seconds.
[-c <config_file>] The path to config file.
[-n <number>] Max number of open files.
[-b <local_address>] Local address to bind.

[-u] Enable UDP relay.
TPROXY is required in redir mode.
[-U] Enable UDP relay and disable TCP relay.
[-A] Enable onetime authentication.

[--mtu <MTU>] MTU of your network interface.
[--mptcp] Enable Multipath TCP on MPTCP Kernel.

[-v] Verbose mode.
[-h, --help] Print this message.

收工,交叉编译第一次练手

参考资料:
http://www.jianshu.com/p/b1a8443dbe5f
http://blog.csdn.net/bunny27/article/details/50589452 (原文已删)
http://ahui.us/post/netgear-r6300v2-ngrep.html
http://www.cnblogs.com/jackyshan/p/5985590.html


交叉编译ARM版(R7000路由器)SSR-libev客户端/服务器端
https://cuojue.org/read/build_ssr_for_arm.html
作者
WeiCN
发布于
2017年1月20日
许可协议