[Aurora-sparc-devel] Building a kernel

Tom 'spot' Callaway tcallawa at redhat.com
Mon Dec 19 12:17:26 EST 2005


On Sun, 2005-12-18 at 11:31 -0500, IT3 Stuart Blake Tener, USN wrote: 
> Aurora Developers:
> 
> First thing I wanted to do was build a custom kernel, yet, I had no kernel
> source code installed when my installation finished. I am not sure what
> group of packages I didn't install to end up in that situation, but I do
> have the gcc compiler and other developer tools installed.
> 
> (1) What RPMs are required to have all the things requisite to build a
> kernel on Aurora?

Here is how to build a working source tree from the Aurora kernel
sources:

Make sure you have a working toolchain (gcc, make, and friends) and
rpm-build installed on your sparc machine. Download the kernel SRPM:
http://distro.ibiblio.org/pub/linux/distributions/aurora/build-2.0beta2/sparc/os/SRPMS/kernel-2.6.13-1.1603sp8.src.rpm

Then, install it:

rpm -ivh kernel-2.6.13-1.1603sp8.src.rpm

Next, build the source tree:

rpmbuild -bp --target sparc64 /usr/src/redhat/SPECS/kernel-2.6.spec

If you are missing any necessary dependencies, it will tell you here.
When this step completes, you will have a patched source tree
in /usr/src/redhat/BUILD/kernel-2.6.13/linux-2.6.13/. Go into that
directory. 

Run: make mrproper

This will clean the tree up a bit.

Edit Makefile, and change the EXTRAVERSION to something you'd recognize.
For example: 
EXTRAVERSION = spot1  
This will make up the last part of the kernel version (e.g.
2.6.13-spot1).

You will see a configs/ directory there, and in that directory is
kernel-2.6.13-sparc64.config and kernel-2.6.13-sparc64-smp.config. These
are the configs that Aurora uses to build its kernels. Pick one (SMP if
you have multiple processors) and copy it to:
/usr/src/redhat/BUILD/kernel-2.6.13/linux-2.6.13/.config 

Then run:

make ARCH=sparc64 menuconfig

Make any changes that you wish, keeping in mind that size is very tight
for these kernels, so modularize as much as possible.

Then, run:

make vmlinux 

This will make the kernel image. Aurora aliases make bzImage to this as
well, but if you're ever using unpatched kernel sources, the bzImage
target will not work there.
If you're on an SMP machine, you might do: make -j2 vmlinux (where 2 is
the number of processors available). This will speed things up.

When this finishes, make the modules:

make modules

If this completes successfully, install the modules.

make modules_install

(You can -j2 those as well)

Now, install the vmlinux file in /boot. I suggest highly that you copy
it to /boot with the full version in the name:

cp vmlinux /boot/vmlinux-2.6.13-spot1

Check /etc/modprobe.conf to make sure that your module entries are
correct, then run:

mkinitrd /boot/initrd-2.6.13-spot1.img 2.6.13-spot1

This will generate the initrd needed to preload modules before / is
mounted.

Last but not least, add an entry to /boot/silo.conf for the new kernel:

Look at the existing entries and make your new entry look just like
them, except with the different kernel and initrd names (and a unique
label).

Example:

image=/vmlinuz-2.6.13-spot1
        label=spot1
        initrd=/initrd-2.6.13-spot1.img
        read-only
        append="root=LABEL=/ ide=nodma"

And you're done! No need to rerun silo, sync to the hard drive a few
times, then reboot and select the new kernel from the SILO prompt.

Hope that helps,

~spot
-- 
Tom "spot" Callaway: Red Hat Senior Sales Engineer || GPG ID: 93054260
Fedora Extras Steering Committee Member (RPM Standards and Practices)
Aurora Linux Project Leader: http://auroralinux.org
Lemurs, llamas, and sparcs, oh my!



More information about the Aurora-sparc-devel mailing list