Compile patched openvpn ipk package for openwrt/lede router


#
#
# Cross compile ipk on digital ocean Debian 8 64 bit
# Guide https://lede-project.org/docs/guide-developer/compile_packages_for_lede_with_the_sdk
#
# Raspberry Pi 3 as openwrt router, want to install scramble openvpn
# Quickest way is to compile the existing base openvpn with the xor patch added
# at the moment the openwrt/lede base for openvpn is 2.4.0
# and the scramble xor patch from tunnelblick is 2.4.1,
# but this is ok, as the patch is compatible and works on 2.4.0
#
# https://github.com/Tunnelblick/Tunnelblick/tree/master/third_party/sources/openvpn/openvpn-2.4.1/patches
#
# We do our cross compiling work on a Debian 8.7 64 bit VPS
# First create new user e.g. use83

adduser usr83

# Follow the prompts to set the new user's information.
# It is fine to accept the defaults to leave all of this information blank.

usermod -aG sudo usr83
su - usr83
sudo ls

sudo apt-get update
sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev subversion mercurial asciidoc bash bc binutils bzip2 fastjar flex git-core gcc util-linux gawk libgtk2.0-dev intltool zlib1g-dev make genisoimage libncurses5-dev libssl-dev patch perl-modules rsync ruby sdcc unzip wget gettext xsltproc zlib1g-dev openjdk-7-jdk libboost1.55-dev libxml-parser-perl libusb-dev bin86 bcc sharutils openjdk-7-jdk -y

#
# install SDK, you find it in the same directory that you got your
# openwrt/LEDE router package
# fetch pre-compiled sdk, I'm using Raspberry Pi 3 as openwrt/lede router.
# This was mine
# https://downloads.lede-project.org/releases/17.01.0/targets/brcm2708/bcm2710/
#

wget https://downloads.lede-project.org/releases/17.01.0/targets/brcm2708/bcm2710/lede-sdk-17.01.0-brcm2708-bcm2710_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz

tar -xvf ./lede-sdk-17.01.0-brcm2708-bcm2710_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64.tar.xz

cd $HOME/lede-sdk-17.01.0-brcm2708-bcm2710_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64

make menuconfig

# Select Global Build Settings and press enter, in the submenu
# un-tick all 4
#
# “Select all target specific packages by default”
# “Select all kernel module packages by default”
# “Select all userspace packages by default”
# “Cryptographically sign package lists”
#
# Now save your changes and exit from the SDK's menu.

./scripts/feeds update -a
./scripts/feeds install openvpn

cd ./package/feeds/base/openvpn/patches
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.1/patches/02-tunnelblick-openvpn_xorpatch-a.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.1/patches/03-tunnelblick-openvpn_xorpatch-b.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.1/patches/04-tunnelblick-openvpn_xorpatch-c.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.1/patches/05-tunnelblick-openvpn_xorpatch-d.diff
wget https://raw.githubusercontent.com/Tunnelblick/Tunnelblick/master/third_party/sources/openvpn/openvpn-2.4.1/patches/06-tunnelblick-openvpn_xorpatch-e.diff

cd $HOME/lede-sdk-17.01.0-brcm2708-bcm2710_gcc-5.4.0_musl-1.1.16_eabi.Linux-x86_64

make menuconfig

# goto Network/vpn/
# enter M for openvpn-mbedtls
#
# save and exit

make

ls bin/packages/arm_cortex-a53_neon-vfpv4/base


# this will produce ipk
# openvpn-mbedtls_2.4.0-3_arm_cortex-a53_neon-vfpv4.ipk
#
# https://www.dropbox.com/s/rc95fq3xi6ynp3p/openvpn-mbedtls_2.4.0-3_arm_cortex-a53_neon-vfpv4.ipk
#

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment