Difference between revisions of "Build a new kernel (and kernel modules) for the LinkStation"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
 
Line 19: Line 19:
  
  
# 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:
+
* 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:
  <tt>tar -xvzf linux-sources-2.4.20-lsw-ppc-hg1.tgz</tt>
+
  tar -xvzf linux-sources-2.4.20-lsw-ppc-hg1.tgz
  <tt>mkdir /usr/src</tt>
+
  mkdir /usr/src
  <tt>ln -s /path/to/kernel/directory /usr/src/linux</tt>
+
  ln -s /path/to/kernel/directory /usr/src/linux
  <tt>cd /usr/src/linux</tt>
+
  cd /usr/src/linux
  
# Copy the kernel .config to the kernel source directory then run:
+
* Copy the kernel .config to the kernel source directory then run:
  <tt>make menuconfig</tt>
+
  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.
+
* 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:
+
* Compile the kernel. Make sure you have something else to amuse you because this takes a while:
 
  make oldconfig
 
  make oldconfig
 
  make dep
 
  make dep
Line 36: Line 36:
 
  objcopy -O binary vmlinux
 
  objcopy -O binary vmlinux
  
# Compile the kernel modules. This step may take some time depending on the modules you selected:
+
* Compile the kernel modules. This step may take some time depending on the modules you selected:
 
  make modules
 
  make modules
 
  make modules_install
 
  make modules_install
  
# Now copy the kernel modules to the correct place:  
+
* Now copy the kernel modules to the correct place:  
 
  cp -r release_modules/lib/modules/2.4.20_mvl31-linkstationwiki-hg1/ /lib/modules/
 
  cp -r release_modules/lib/modules/2.4.20_mvl31-linkstationwiki-hg1/ /lib/modules/
  
# Load your new kernel using the [[Articles/GeneralKernelLoader|kernel loader how-to]]. Then build the kernel module dependencies:  
+
* Load your new kernel using the [[Articles/GeneralKernelLoader|kernel loader how-to]]. Then build the kernel module dependencies:  
 
  depmod -a
 
  depmod -a
  
# You should now have a working kernel replacement and be able to load some shiny new kernel modules!
+
* You should now have a working kernel replacement and be able to load some shiny new kernel modules!
  
  

Revision as of 18:29, 16 June 2006

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/
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.