Difference between revisions of "Using a custom kernel and loader.o"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m
m
 
(28 intermediate revisions by 12 users not shown)
Line 1: Line 1:
'''''Note:''''' This is just groundwork and is nothing more than JavaScouts quick guide to his patch set ATT.
+
These instructions will allow you to run a custom kernel, without the danger of having to reprogram your [[Flash ROM]]. Plenty of other people have already written HOWTO's. If you want to use a custom Linux 2.6 kernel, you must have ''udev'' installed. This article is based on a custom Linux 2.6.15 kernel.
  
Plenty of other people have already written how to's. You must have udev installed or the 2.6 kernel will not work. Check out this page on [http://www.gentoo.org/doc/en/migration-to-2.6.xml Migrating to the 2.6 kernel].  
+
For more information, check out [http://www.gentoo.org/doc/en/migration-to-2.6.xml The complete Gentoo Linux 2.6 migration guide]. Other useful pages are [http://linuxheadquarters.com/howto/tuning/kernelpatch.shtml Applying a Kernel Patch] and [http://linkstationwiki.org/Articles/GeneralKernelBuild General Kernel Build]
  
Other useful pages are [http://linuxheadquarters.com/howto/tuning/kernelpatch.shtml How to apply a kernel patch] and [http://linkstationwiki.org/Articles/GeneralKernelBuild this article on compling a kernel]
+
== Preparing for Install ==
 +
Download the vanilla kernel source, untar it, and move into the source directory.
  
Basically its
+
# cd /usr/src
 +
# wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.15.tar.bz2
 +
# tar xvjf linux-2.6.15.tar.bz2
 +
# cd linux-2.6.15
  
cd /usr/src
+
Download the latest kernel patch and apply it. You may need to adjust the name of the patch.  The patch should support both the standard Kurobox and HG model. Please report any changes needed to the config files, or any bugs you find, on the forums. Remember to include the type of box you are running, along with any supporting information-- the more information the better.  
wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.15.tar.bz2
+
  tar xvjf linux-2.6.15.tar.bz2
+
cd linux-2.6.15
+
Note: The following patch does not work with the standard Kurobox. Use the patch located
+
[http://www.kurobox.com/downloads/gentoo/kurobox-sources-2.6.15.2.patch.bz2 here] for the standard Kurobox.
+
  
  wget http://webpages.charter.net/trevorpowdrell/kurobox-sources-2.6.15.patch.bz2
+
  # wget http://www.kurobox.com/downloads/kernel/kurobox-patch-2-6-15.tar.bz2
 +
# tar xvjf kurobox-patch-2-6-15.tar.bz2
 +
# patch -p1 < kurobox-patch-2-6-15.patch
  
Whatever patch you use, you need to unzip it and apply it.
+
== Configure the Kernel ==
 +
Next we need to configure the kernel. There is a basic configuration with each patch.  
  
bunzip2 kurobox-sources-2.6.15.patch.bz2
+
First set the arch for the Kurobox (necessary):
patch -p1 < kurobox-sources-2.6.15.patch
+
  
Next we need to configure the kernel. There is a basic configuration with each patch. for the Kurobox HG do this:
+
  # export ARCH=ppc
 
+
  cp config_kuroboxhg .config
+
  
 
For the standard Kurobox do this:
 
For the standard Kurobox do this:
  
  cp config_kurobox .config
+
  # cp config_kurobox .config
 +
 
 +
For the Kurobox HG do this:
 +
 
 +
# cp config_kuroboxhg .config
  
 
If you want to use the standard kernel type this:
 
If you want to use the standard kernel type this:
  
  make oldconfig
+
  # make oldconfig
  
 
If you want to customize your kernel type this:
 
If you want to customize your kernel type this:
  
  make menuconfig
+
  # make menuconfig
  
Make the kernel and make and install the modules
+
== Compile and Prepare the Kernel ==
 +
Make the kernel and make and install the modules. This took just under 2.5 hours on my Kurobox with the standard configuration.
  
  make vmlinux modules modules_install
+
  # make vmlinux modules modules_install
  
Loader.o needs a binary of the new kernel. We'll convert our new kernel and put the new kernel in /boot
+
''loader.o'' will need a binary of the new kernel, so we'll convert our new kernel and put it in ''/boot''
  
  objcopy -O binary vmlinux /boot/vmlinux-2.6.15-kurobox
+
  # objcopy -O binary vmlinux /boot/vmlinux-2.6.15-kurobox
  
Change to /boot
+
== Loading Your New Kernel ==
 +
Change to ''/boot'' and download a copy from the Kurobox download area if you don't have it yet. The loader.o module will work with the standard kurobox and the HG.
  
  cd /boot
+
  # cd /boot
 +
# wget http://www.kurobox.com/downloads/kernel/loader.o
  
If you don't have a copy of loader.o in /boot you should download a copy from the Gentoo downloads area
+
Sync the drive, load the kernel into memory, and jump to the new kernel.
  
  wget http://www.kurobox.com/downloads/gentoo/loader.o
+
For the standard Kurobox do this:
 +
 
 +
  # sync;insmod loader.o kernel=vmlinux-2.6.15-kurobox
 +
 
 +
For the Kurobox HG do this:
 +
 
 +
# sync;insmod -f loader.o kernel=vmlinux-2.6.15-kurobox
 +
 
 +
If your new kernel works, you can set up the Kurobox bootloader.
 +
 
 +
An init script is needed to load the new kernel every time on a power-up/reboot.
 +
 
 +
The basic idea in the script, is to check the kernel release with `uname -r`, and if the kernel is "old", use insmod to load the new kernel.
 +
 
 +
== Sylver init script example ==
 +
The Sylver install howto has init script called bootnewos - see the Project Sylver install page.
 +
 
 +
== gentoo init script example ==
 +
Create file
 +
vi /etc/init.d/load-2.6-kernel
 +
 
 +
!/sbin/runscript
 +
# Copyright 1999-2006 Gentoo Foundation
 +
# Distributed under the terms of the GNU General Public License v2
 +
# $Header: $
 +
 +
depend() {
 +
before modules
 +
}
 +
 +
start() {
 +
ebegin "Loading 2.6 kernel with loader.o module"
 +
KERNEL_RELEASE=`uname -r`
 +
if [ "$KERNEL_RELEASE" = "2.4.17_mvl21" ]
 +
then
 +
/usr/bin/sync
 +
/sbin/insmod -f /boot/loader.o kernel=/boot/vmlinux-2.6.15-kurobox
 +
fi
 +
eend $?
 +
}
 +
 +
stop() {
 +
ebegin "cannot stop this service"
 +
eend $?
 +
}
 +
 
 +
Install
 +
rc-update add load-2.6-kernel boot
  
Sync the drive, load the kernel into memory, and jump to the new kernel.
 
  
sync;insmod loader.o kernel=vmlinux-2.6.15-kurobox
+
----
  
 +
Add Debian, Fedora examples here.
  
 +
----
 +
== Additional Reading ==
 +
Here is some additional reading on init scripts:
 +
* [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4 Gentoo Initscripts]
 +
* [http://www.linux.com/article.pl?sid=05/08/02/1821218 linux.com article on init scripts]
  
[[Category:Gentoo]]
+
{{Template:Articles|Kurobox|Gentoo|Kernel}}
[[Category:HowTo]]
+

Latest revision as of 00:21, 13 July 2007

These instructions will allow you to run a custom kernel, without the danger of having to reprogram your Flash ROM. Plenty of other people have already written HOWTO's. If you want to use a custom Linux 2.6 kernel, you must have udev installed. This article is based on a custom Linux 2.6.15 kernel.

For more information, check out The complete Gentoo Linux 2.6 migration guide. Other useful pages are Applying a Kernel Patch and General Kernel Build

Contents

Preparing for Install

Download the vanilla kernel source, untar it, and move into the source directory.

# cd /usr/src
# wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.15.tar.bz2
# tar xvjf linux-2.6.15.tar.bz2
# cd linux-2.6.15

Download the latest kernel patch and apply it. You may need to adjust the name of the patch. The patch should support both the standard Kurobox and HG model. Please report any changes needed to the config files, or any bugs you find, on the forums. Remember to include the type of box you are running, along with any supporting information-- the more information the better.

# wget http://www.kurobox.com/downloads/kernel/kurobox-patch-2-6-15.tar.bz2
# tar xvjf kurobox-patch-2-6-15.tar.bz2
# patch -p1 < kurobox-patch-2-6-15.patch

Configure the Kernel

Next we need to configure the kernel. There is a basic configuration with each patch.

First set the arch for the Kurobox (necessary):

# export ARCH=ppc

For the standard Kurobox do this:

# cp config_kurobox .config

For the Kurobox HG do this:

# cp config_kuroboxhg .config

If you want to use the standard kernel type this:

# make oldconfig

If you want to customize your kernel type this:

# make menuconfig

Compile and Prepare the Kernel

Make the kernel and make and install the modules. This took just under 2.5 hours on my Kurobox with the standard configuration.

# make vmlinux modules modules_install

loader.o will need a binary of the new kernel, so we'll convert our new kernel and put it in /boot

# objcopy -O binary vmlinux /boot/vmlinux-2.6.15-kurobox

Loading Your New Kernel

Change to /boot and download a copy from the Kurobox download area if you don't have it yet. The loader.o module will work with the standard kurobox and the HG.

# cd /boot
# wget http://www.kurobox.com/downloads/kernel/loader.o

Sync the drive, load the kernel into memory, and jump to the new kernel.

For the standard Kurobox do this:

# sync;insmod loader.o kernel=vmlinux-2.6.15-kurobox

For the Kurobox HG do this:

# sync;insmod -f loader.o kernel=vmlinux-2.6.15-kurobox

If your new kernel works, you can set up the Kurobox bootloader.

An init script is needed to load the new kernel every time on a power-up/reboot.

The basic idea in the script, is to check the kernel release with `uname -r`, and if the kernel is "old", use insmod to load the new kernel.

Sylver init script example

The Sylver install howto has init script called bootnewos - see the Project Sylver install page.

gentoo init script example

Create file

vi /etc/init.d/load-2.6-kernel
!/sbin/runscript 
# Copyright 1999-2006 Gentoo Foundation 
# Distributed under the terms of the GNU General Public License v2 
# $Header: $ 

depend() { 
before modules 
} 

start() { 
ebegin "Loading 2.6 kernel with loader.o module" 
KERNEL_RELEASE=`uname -r` 
if [ "$KERNEL_RELEASE" = "2.4.17_mvl21" ] 
then 
/usr/bin/sync 
/sbin/insmod -f /boot/loader.o kernel=/boot/vmlinux-2.6.15-kurobox 
fi 
eend $? 
} 

stop() { 
ebegin "cannot stop this service" 
eend $? 
} 

Install

rc-update add load-2.6-kernel boot



Add Debian, Fedora examples here.


Additional Reading

Here is some additional reading on init scripts: