Add scripts to build wireguard packages for TurrisOS
This commit is contained in:
parent
1aea21a3a6
commit
5d81ce56a5
1 changed files with 49 additions and 0 deletions
49
build_turris_openwrt.sh
Executable file
49
build_turris_openwrt.sh
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -o nounset
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
|
type git >/dev/null 2>&1 || { echo >&2 "git required. Aborting."; exit 1; }
|
||||||
|
type ccache >/dev/null 2>&1 || { echo >&2 "ccache required. Aborting."; exit 1; }
|
||||||
|
|
||||||
|
SDK="OpenWrt-SDK-mvebu_gcc-4.8-linaro_musl-1.1.15_eabi.Linux-x86_64"
|
||||||
|
sdk_url="https://repo.turris.cz/omnia/${SDK}.tar.bz2"
|
||||||
|
lede_dir="lede"
|
||||||
|
wireguard_path="${lede_dir}/package/network/services/wireguard"
|
||||||
|
arm_cc="${SDK}/staging_dir/toolchain-arm_cortex-a9+vfpv3_gcc-4.8-linaro_musl-1.1.15_eabi/bin/arm-openwrt-linux-g++"
|
||||||
|
arm_ld="${SDK}/staging_dir/toolchain-arm_cortex-a9+vfpv3_gcc-4.8-linaro_musl-1.1.15_eabi/bin/arm-openwrt-linux-ld"
|
||||||
|
kernel_dir="${SDK}/build_dir/target-arm_cortex-a9+vfpv3_musl-1.1.15_eabi/linux-mvebu/linux-4.4.91/arch/arm/kernel"
|
||||||
|
|
||||||
|
if [ ! -d $SDK ]; then
|
||||||
|
echo "Downloading and extracting SDK..."
|
||||||
|
wget $sdk_url
|
||||||
|
tar xf $SDK.tar.bz2
|
||||||
|
rm -f $SDK.tar.bz2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building for ${SDK}"
|
||||||
|
|
||||||
|
echo "Updating checkout..."
|
||||||
|
|
||||||
|
if [ -d $lede_dir ]; then
|
||||||
|
pushd $lede_dir
|
||||||
|
git pull
|
||||||
|
popd
|
||||||
|
else
|
||||||
|
git clone https://github.com/lede-project/source/ $lede_dir
|
||||||
|
fi
|
||||||
|
|
||||||
|
rsync -aP $wireguard_path $SDK/package
|
||||||
|
|
||||||
|
if [ ! -f $kernel_dir/module.lds ]; then
|
||||||
|
echo -e "SECTIONS {\n\t.core.plt : { BYTE(0) }\n\t.init.plt : { BYTE(0) }\n}" > $kernel_dir/module.lds
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building..."
|
||||||
|
|
||||||
|
make CXX=$arm_cc LD=$arm_ld V=s -C $SDK -j 5
|
||||||
|
|
||||||
|
rsync --remove-source-files $SDK/bin/mvebu-musl/packages/base/*.ipk ./
|
||||||
|
|
||||||
|
echo "Done."
|
Loading…
Add table
Reference in a new issue