CJDNS on TP2 (Compiling a kernel with tun & IPv6 support)

Support for your TonidoPlug
Rookie Tonidoid
Rookie Tonidoid
Posts: 8
Joined: Sat Dec 31, 2011 7:19 pm

CJDNS on TP2 (Compiling a kernel with tun & IPv6 support)

Postby MaLaCoiD » Thu Feb 02, 2012 2:28 am

CJDNS is a new Internet- maybe; it's still in alpha but very promsing. It is a routing engine designed for security, scalability, speed and ease of use. It gives you an interface which connects other nodes and it gives you an IPv6 address generated from a public encryption key and a virtual network card (TUN device) which you can use to send packets to anyone in the CJDNS network to which you are connected.

Full Readme and whitepaper at:

I got it working on my TonidoPlug2 and thought I'd share. Thanks to pmcallihan for the instructions on building the stock kernel, which I've modified slightly.

Build the new kernel
This is a step by step procedure to build the kernel that comes with your TonidoPlug2. All responsibility is yours. The software built here is to replace the kernel and modules on an existing operational `sata or usb disk`. *Don't do this on the internal flash!*

The cross compiler used in this procedure is only functional on a Linux desktop. This was done with a Debian OS. It is my current choice. Linux is linux, the procedure should be the same except for installing dependencies.

1) Open a command line terminal.

2) Download a cross compiler.

wget http://www.plugcomputer.org/405/us/gplu ... bi.tar.bz2

3) Install the cross compiler in the /opt directory.

sudo tar xvjpf arm-marvell-linux-gnueabi.tar.bz2 -C /opt/

4) Install dependencies.

sudo apt-get install build-essential automake autoconf libtool pkg-config intltool libncurses5-dev uboot-mkimage

5) Make a working directory and go to it. Mine is called tonido.

mkdir tonido
cd tonido

6) Download TonidoPlug2 kernel source code.

wget http://www.tonidoplug.com/partners/topk ... 22.tar.bz2

7) Install kernel source.

tar xvjpf kernel-2.6.31-topkick1281p2-codelathe-20111122.tar.bz2

8) Simplify the package name and move to it.

mv kernel-2.6.31-topkick1281p2-codelathe-20111122 kernel-2.6.31
cd kernel-2.6.31

9) Set the environment for the build. The declarations are *only valid* for the life of the command shell. If you exit the shell and open a new shell to continue, you will need to set the environment again.

export PATH=/opt/arm-marvell-linux-gnueabi/bin:$PATH
export CROSS_COMPILE="arm-marvell-linux-gnueabi-"
export ARCH=arm

10) Clean up build for start fresh.

make mrproper

11) Create a default configuration file for the build. This is the shipped kernel, mostly. There seemed to be a few minor modifications but it's pretty much stock.

make mv88f6281_gw_defconfig

12) Now we are going to change the kernel or modules. This is where the stock configuration is modified. The README file in this directory tells you about different program that will make the changes. I suggest just building a stock kernel for now using the default configuration. To build a stock kernel, skip this step 12.

Enter the menu to configure different kernel features:

make menuconfig
Arrow keys navigate the menu. The kernel should already has the TUN kernel module. Verify:

Device Drivers --->
Network device support --->
Universal TUN/TAP device driver support
There should be `<M>` in front of `Universal TUN/TAP device driver support`. Exit back to main menu. It has `General setup --->` at the top. Now we need to enable IPv6:

Networking support --->
Networking options --->
The IPv6 protocol --->
There's probably just '< >' before 'The IPv6 protocol', so type `m` to enable this kernel feature. Exit back to the main menu and do one more Exit to get the prompt `Do you wish to save your new kernel configuration?` Hit `Enter`

13) Build the kernel.

make uImage

14) Build the modules.

make modules

15) Make a directories to store the new software.

mkdir ../current_kernel
mkdir ../current_kernel/boot

16) Store the modules.

make INSTALL_MOD_PATH=../current_kernel modules_install

17) Move the kernel into the new directory and change is access.
cp arch/arm/boot/uImage ../current_kernel/boot/
chmod 744 ../current_kernel/boot/uImage
The new kernel is at `../current_kernel/boot/uImage`
The new modules are at `../current_kernel/lib/modules`

18) Back up your current kernel and modules on the TonidoPlug2 by logging in as root. *tp2* is the IP of your TonidoPlug2.

ssh tp2 -l root
cd /boot
mv uImage uImage_stock
cd /lib
mv modules modules_stock

19) Back on the Linux box used to cross-compile the kernel, at `~/tonido/kernel-2.6.31`

scp ../current_kernel/boot/uImage root@tp2:/boot/
scp ../current_kernel/lib/modules/ root@tp2:/lib/

20) Check that the files copied over.

ssh tp2 -l root
ls -l /boot
ls /lib/modules*

21) Reboot your TonidoPlug2 and *pray* you got a gold star in Kindergarten for following directions.


When your TonidoPlug2 comes back up, follow the standard directions for compiling CJDNS: https://github.com/cjdelisle/cjdns

Return to “TonidoPlug Support”

Who is online

Users browsing this forum: No registered users and 5 guests