In this post I’ll show you the steps necessary to build your own custom kernel to run on your NAS. In this post i only show to build it for Orion and Kirkwood LaCie devices, as i own these myself and know how to build it for them. I also use Ubuntu 32-bit to prepare and build the software on.
Note to 64-bit users:
The toolchain used here is 32-bit. If you want to crosscompile the kernel on a 64-bit machine you’ll need one extra package:
apt-get install ia32-libs
This will install the 32-bit shared libraries needed for building 32-bit apps on 64-bit systems.
First we need to prepare thing, which will consist of downloading the kernel source, ARM toolchain and necessary packages needed to build:
First we’ll install the necessary packages needed to build:
apt-get install uboot-mkimage build-essential libncurses5-dev
Navigate to your home directory (cd ~/) and lets start building!
Then we need to download the required software, starting with the kernel (as of writing, the current stable version is 3.8.4).
Unpack the kernel:
tar vxf linux-3.84.tar.xz
Download the ARM Toolchain:
Unpack the toolchain:
tar vxjf arm-2012.09-64-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Then we need to create the kernel modules directory, create a dir called kernelmodules:
Set some environment variables to enhance the building process:
Dive in the kernel source directory:
For Orion devices do the following to configure the kernel for that board:
For Kirkwood devices do the following to configure the kernel for that board:
The rest of the steps are the same for both boards, continue to customize the kernel (you will enter a menu where you add extra modules for your kernel, like extra filesystem support):
Optionally you can save the configuration file you just created with menuconfig, when leaving menuconfig you have saved the config in the current directory as:
If you make a copy of that file to a safe location you can use that configuration file again whenever you need to build a new kernel for the device the config is created for, this can be helpful if there are kernel updates or you want to extend or slim down the config.
Once you have set the options and modules you want and saved your configuration, you can start building the uImage needed by uBoot:
If you have a multicore processor you may append the number of cores to the make instruction, this will greatly speed up the compile process, so if you have a quadcore system you can make the image with:
make uImage -j4
When the build is complete there will be a file called uImage in
arch/arm/boot/, copy that file to your homedir:
cp arch/arm/boot/uImage ../
Now build your kernel modules:
If you have a multicore processor you may append the number of cores to the make instruction, this will greatly speed up the compile process, so if you have a quadcore system you can make the modules with:
make modules -j4
And install them (will be in ~/kernelmodules):
Create a tarball with your modules in it, so you can deploy them on your new to boot system:
tar vczf kernelmodules.tgz *
mv kernelmodules.tgz ../
That’s it! Now you have built your own ARM kernel with the latest kernel sources available. For LaCie based NAS devices the kernel can be booted in 2 ways, that’s the secret partition (/dev/sda6 or 7) using
dd of creating a
ext3 filesystem on those partitions with uImage in the following directory:
/snaps/00/boot/, but I will get back to you for this in the next round. You can also boot this via the uBoot console using TFTP.