zapret/docs/compile/build_howto_openwrt.txt

58 lines
2.1 KiB
Plaintext
Raw Normal View History

How to compile native programs for use in openwrt
-------------------------------------------------
2024-11-17 17:43:01 +00:00
1) Install required packages to the host system :
debian,ubuntu : apt install build-essential patch libncurses-dev python3-distutils unzip gawk wget git
fedora: dnf install make patch gcc g++ ncurses-devel git perl
Other packages may be required on your distribution. Look for the errors.
2) Download latest SDK for your target platform from https://downloads.openwrt.org
2024-11-16 13:43:26 +00:00
examples :
2024-11-16 13:43:26 +00:00
curl -o - https://downloads.openwrt.org/releases/23.05.5/targets/x86/64/openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64.tar.xz | tar -Jxvf -
cd openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64
2024-11-16 13:43:26 +00:00
curl -o - https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-sdk-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst | tar --zstd -xvf -
cd openwrt-sdk-x86-64_gcc-13.3.0_musl.Linux-x86_64
2024-11-17 17:43:01 +00:00
3) Install required libs
2024-11-16 13:43:26 +00:00
./scripts/feeds update base packages
./scripts/feeds install libnetfilter-queue zlib libcap
2024-11-17 17:43:01 +00:00
4) Prepare openwrt package definitions
2024-11-16 13:43:26 +00:00
cp -R /opt/zapret/docs/compile/openwrt/. .
cp -R /opt/zapret/tpws package/zapret/tpws
cp -R /opt/zapret/nfq package/zapret/nfqws
cp -R /opt/zapret/mdig package/zapret/mdig
cp -R /opt/zapret/ip2net package/zapret/ip2net
2024-11-16 16:08:02 +00:00
rm -f package/zapret/tpws/tpws/tpws package/zapret/nfqws/nfq/nfqws package/zapret/mdig/mdig/mdig package/zapret/ip2net/ip2net/ip2net
2024-11-16 13:43:26 +00:00
2024-11-17 17:43:01 +00:00
5) Prepare .config
make defconfig
If you only need bins without packages comment 'CONFIG_AUTOREMOVE=y' line in .config
6) Compile
dynamic build : make package/{tpws,nfqws,mdig,ip2net}/compile
static build : make CFLAGS=-static package/{tpws,nfqws,mdig,ip2net}/compile
7) Get result
2024-11-16 13:43:26 +00:00
2024-11-17 17:43:01 +00:00
executables only : build_dir/target/<progname>
ipk or apk packages : bin/packages/*/base
2024-11-16 13:43:26 +00:00
2024-11-17 17:43:01 +00:00
8) Installating to openwrt to use with zapret
2024-11-16 13:43:26 +00:00
2024-11-17 17:43:01 +00:00
zapret with or without binaries should be already installed in /opt/zapret.
Install ipk's or apk's with all compiled progs using opkg or apk.
Bins are placed to /opt/zapret/binaries/my.
Or copy binaries there manually and set chmod 755 to them.
Run install_bin.sh or install_easy.sh. They will use bins in 'my' folder.