Build a new kernel (and kernel modules) for the LinkStation
PowerPC Only | This method only works for the powerpc-hdhlan and powerpc-hdhglan LinkStations.
Contents
Abstract
This article is for people that want to build a new kernel for the LinkStation. We will use the powerpc-hdhglan LinkStation for our example.
Prerequisites
This article assumes that you have installed Projects/OpenLink or Projects/FreeLink and the appropriate development tools. You also will need the kernel source code, a working kernel .config, and any applicable patches. You may download them from [here].
Cross-Toolchain | You can build the kernel and kernel modules much, much faster by using a cross-toolchain.:)
Method
- Extract the kernel source code somewhere sensible. Mine lives in /mnt/ somewhere with an alias to it from /usr/src/linux to keep it off the tiny system partition:
tar -xvzf linux-sources-2.4.20-lsw-ppc-hg1.tgz mkdir /usr/src ln -s /path/to/kernel/directory /usr/src/linux cd /usr/src/linux
- Copy the kernel .config to the kernel source directory then run:
make menuconfig
- You can add/remove features to/from the kernel. Note that the supplied kernel .config will build properly so any errors when compiling are most likely due to your modifications.
- Compile the kernel. Make sure you have something else to amuse you because this takes a while:
make oldconfig make dep make objcopy -O binary vmlinux
- Compile the kernel modules. This step may take some time depending on the modules you selected:
make modules make modules_install
- Now copy the kernel modules to the correct place:
cp -r release_modules/lib/modules/2.4.20_mvl31-linkstationwiki-hg1/ /lib/modules/
- Load your new kernel using the kernel loader how-to. Then build the kernel module dependencies:
depmod -a
- You should now have a working kernel replacement and be able to load some shiny new kernel modules!
References
Jochang included some useful information in his [loader how-to]. Also Trevor Powdrell from the Kuro forums wrote a [patch] that allows the powerpc-hdhglan kernel to compile under GCC 3.3/3.4.