How To Build a TonidoPlug2 kernel

This is a step by step procedure to build the original kernel that comes with your tp2. All responsibility is yours. The software built here is to replace the kernel and modules on an existing operational sata or usb disk. The purpose is to assure yourself that you can build a functional kernel. I highly recommend that you build a stable kernel before creating a new one with different capabilities.

The kernel can be compiled on the plug itself, or you can use a Linux desktop. The described procedure works on Debian-based systems and should be the same for other flavors of Linux, except for installing dependencies.

  1. Open a command line terminal
  2. Install software dependencies.
    » sudo apt-get install build-essential automake autoconf libtool pkg-config intltool
    »sudo apt-get install libncurses5-dev uboot-mkimage
  3. Make a working directory and go to it. Mines is called ‘tonido’.
    » mkdir tonido
    » cd tonido
  4. Install kernal source.
    » tar xvjpf kernel-2.6.31-topkick1281p2-codelathe-20111122.tar.bz2
  5. Delete the download.
    » rm kernel-2.6.31-topkick1281p2-codelathe-20111122.tar.bz2
  6. 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
  7. 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 enviroment again. Highly recommend copy and paste on these commands as the statement need to be exact.
    » export PATH=/opt/arm-marvell-linux-gnueabi/bin:$PATH
    » export ARCH=arm
    • On the plug:
      » export CROSS_COMPILE=””
    • When cross compiling:
      » export CROSS_COMPILE=“arm-marvell-linux-gnueabi-”
  8. Clean up build for start fresh.
    » make mrproper
  9. Create a default configuration file for the build. This is the shipped kernel.
    » make mv88f6281_gw_defconfig
  10. If were going to change the kernel or modules. This is where the configuration is modified. The README file in this directory tells you about different program that will make the changes. I suggest just building a clean kernel for now using the default configuration.
  11. Build the kernel.
    » make uImage
  12. Build the modules
    » make modules
  13. Make a directories to store the new software.
    » mkdir ../current_kernel
    » mkdir ../current_kernel/boot
  14. Store the modules.
    » make INSTALL_MOD_PATH=../current_kernel modules_install
  15. 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

Installing the kernel

Assuming you boot directly from the tp2 and you have a bootable disk that is mounted at /media/disk1part1/.

  1. Using a command line on the plug:
    » cd /media/disk1part1/boot
    » sudo mv uImage uImage_save
    » cd /media/disk1part1/lib
    » sudo mv modules modules_save
  2. Now back at command shell at ~/tonido/kernel-2.6.31.
    • If you compiled on the plug:
      » sudo mv ../current_kernel/boot/uImage /media/disk1part1/boot/
      » sudo mv ../current_kernel/lib/modules/ /media/disk1part1/lib/
    • If you cross compiled:
      » scp ../current_kernel/boot/uImage root@tp2:/media/disk1part1/boot/
      » scp ../current_kernel/lib/modules/ root@tp2:/media/disk1part1/lib/
  3. Reboot and I hope it works.

Source: http://www.tonido.com/forum/viewtopic.php?f=37&t=4338