Circle Device


Techie Stuff


Quick Reference

Will be moved to Quick Reference soon

Cross Compile OpenVPN for MyBook

Cross Compile OpenVPN for MyBook

White Light Only

OpenVPN is a cool SSL VPN that uses UDP or TCP (no silly GRE packets) to transport your network traffic. It uses LZO compression and OpenSSL.

Before you can get this to do anything useful you will need a kernel module (tun.ko). Oooh, I know scary right? Don't worry it is not so bad. First make sure that arm-linux-gnueabi-* are in your path, my tools are in /home/ben/MyBook/WD-MyBookWorld-v1.02.12-GPL/toolchain/bin you will notice I have upgraded ;-) check that it works:

arm-linux-gnueabi-gcc --version
arm-linux-gnueabi-gcc (GCC) 3.4.3 (release) (CodeSourcery ARM Q1B 2005)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

I got these by downloading the file from Western Digital and extracting it into a directory then going into the toolchain directory and extracting gcc-csl-arm-2005q1-glibc-csl-arm.tar.gz.

Now to do the cool bit... extract the kernel!! In WD-MyBookWorld-v1.02.12-GPL/kernel/ extract kernel-source.tar.gz and go into kernel-source/kernel-0.4.6 and run the folloing commands.

CC=arm-linux-gnueabi-gcc make CROSS_COMPILE=arm-linux-gnueabi- oxnas_810_eabi_wd_prod_defconfig

New Note: see troubleshooting section below if you are having problems

This will just configure the basics, now we need to make sure that our module is actually going to be compiled.

make CROSS_COMPILE=arm-linux-gnueabi- menuconfig

Select Device Drivers --> Network device support --> then put an M in Universal TUN/TAP device driver support.

Universal TUN/TAP Screenshot

Now, save your settings and build your kernel modules:

CC=arm-linux-gnueabi-gcc make CROSS_COMPILE=arm-linux-gnueabi- modules

Somwhere in that crazy amount of output you should see:

  CC      drivers/net/tun.mod.o
  LD [M]  drivers/net/tun.ko

That is it, we now hava a kernel module that you can install using insmod into your mybook!

To find out how to compile OpenSSL see my older tutorial on Transmission. Then download lzo and compile (lzo-2.06 at time of writing):

CC="arm-linux-gnueabi-gcc" ./configure --build=arm-linux-gnueabi \  
--target=arm-linux-gnueabi --host=i686-pc-linux-gnu

And now OpenVPN (openvpn-2.2.2 at time of writing):

CC="arm-linux-gnueabi-gcc" ./configure --build=arm-linux-gnueabi \  
--target=arm-linux-gnueabi --host=i686-pc-linux-gnu   \
--with-ssl-headers=../openssl-1.0.0/include/ \
--with-ssl-lib=../openssl-1.0.0/ \
--with-lzo-headers=../lzo-2.06/include/ \

Cleanup coming soon...

Help with configuration? good important details on the central repo for MyBook Stuff, saves you reading about OpenVPN in the OpenVPN docs!

I am not the only crazy person who does things like this you know...


Error: Makefile:434: *** mixed implicit and normal rules. Stop.

I got this error, I believe it is related to the version of make you are using.

GNU Make 3.82
Built for x86_64-pc-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

The problem here is the Makefile for the kernel using deprecated or invalid rules. For more details please see this question and answer on StackOverflow. You can fix this problem by rewriting the rule:

config %config: scripts_basic outputmakefile FORCE
        $(Q)mkdir -p include/linux include/config
        $(Q)$(MAKE) $(build)=scripts/kconfig $@


%config: scripts_basic outputmakefile FORCE
        $(Q)mkdir -p include/linux include/config
        $(Q)$(MAKE) $(build)=scripts/kconfig $@

config: scripts_basic outputmakefile FORCE
        $(Q)mkdir -p include/linux include/config
        $(Q)$(MAKE) $(build)=scripts/kconfig $@

The same problem is present a little later in the file, repair it the same way and you may compile the kernel as normal.

Quick Links: Techie Stuff | General | Personal | Quick Reference