udp2raw/doc/build_guide.md

93 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2017-08-11 08:30:22 +00:00
# udp2raw build guide
2017-11-29 07:00:00 +00:00
the guide on how to build udp2raw
2017-08-11 08:30:22 +00:00
2017-11-29 07:00:00 +00:00
## Build udp2raw for a specific platform
### linux platform which supports local compile
2017-08-11 08:30:22 +00:00
such as PC,raspberry pi
##### install git
run on debian/ubuntun
```
sudo apt-get install git
```
run on redhat/centos:
```
sudo yum install git
```
##### clone git code
run in any dir
```
git clone https://github.com/wangyu-/udp2raw-tunnel.git
cd udp2raw-tunnel
```
##### install compile tool
run on debian/ubuntun
```
sudo apt-get install build-essential
```
run on redhat/centos:
```
sudo yum groupinstall 'Development Tools'
```
run 'make'compilation done. the udp2raw file is the just compiled binary
2017-11-29 07:00:00 +00:00
### platform which needs cross-compile
2017-08-11 08:30:22 +00:00
such as openwrt router,run following instructions on your PC
##### install git
run on debian/ubuntun
```
sudo apt-get install git
```
run on redhat/centos:
```
sudo yum install git
```
##### download cross compile tool chain
find it on downloads.openwrt.org according to your openwrt version and cpu model.
for example, my tplink wdr4310 runs chaos_calmer 15.05,its with ar71xx cpudownload the following package.
```
http://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/OpenWrt-SDK-15.05-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
```
unzip it to any dir,such as /home/wangyu/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2
cd into staging_dir toolchain-xxxxx bin .find the soft link with g++ suffix. in my case ,its mips-openwrt-linux-g++ ,check for its full path:
```
/home/wangyu/Desktop/OpenWrt-SDK-15.05-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++
```
##### compile
modify first line of makefile to:
```
cc_cross=/home/wangyu/Desktop/OpenWrt-SDK-15.05-ar71xx-generic_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++
```
2017-08-21 09:50:49 +00:00
run `make cross`the just generated `udp2raw_cross` is the binary,compile done. copy it to your router to run.
2017-08-21 09:51:00 +00:00
`make cross` generates non-static binary. If you have any problem on running it,try to compile a static binary by using `make cross2` or `make cross3`.If your toolchain supports static compiling, usually one of them will succeed. The generated file is still named `udp2raw_cross`.
2017-11-29 07:00:00 +00:00
## Build a full release (include all binaries supported in the makefile)
1. make sure your linux is amd64 version
2. clone the repo
3. make sure you have g++ , make sure your g++ support the `-m32` option; make your your have installed libraries for `-m32` option
4. download https://github.com/wangyu-/files/releases/download/files/toolchains.tar.gz , and extract it to the right position (according to the makefile)
5. run `make release` inside udp2raw's directory