Kernel recompile Howto


Forum: Other Help Topics
Topic: Kernel recompile Howto
started by: nebulah

Posted by nebulah on April 19 2005,06:05
I've been playing around with DSL for a while, but got stuck at building a new kernel for it. I'm using the manual copying method for remastering the CD. What i did:

- Got kernel-source-2.4.30 from < http://www.kernel.org >
- configured with a standard knoppix config file
- patched source with knoppix-kernel.patch
- compiled bzImage + modules + cloop.o
- replaced the cloop.o from minirt24.gz, also updated the modules in scsi-dir
- replaced the linux24

*Works*

Posted by echo6 on May 07 2005,07:31
Where are the Knoppix patches?
Posted by friedgold on May 07 2005,11:21
One place you can get the knoppix config/patches is from /usr/src on Knoppix cd. It seems a bit silly downloading a whole CD just to get the patch, but I'm not sure where else to get it
Posted by lorenzo, Italy on May 23 2005,09:50
where is the cloop.o ??
is it mandatory ?

Posted by Guest on May 28 2005,16:26
I would REALLY REALLY like to see a detailed walk-through on this whole area, ESPECIALLY how to patch kernel modules in dsl.

There's at least one (and probably others) in sore need of updating (loop-aes).

Or is it already in the forums somewhere and I can't find it?

Could someone point me at any likely sources of help?

Posted by clacker on June 02 2005,22:48
Quote (friedgold @ May 07 2005,07:21)
One place you can get the knoppix config/patches is from /usr/src on Knoppix cd. It seems a bit silly downloading a whole CD just to get the patch, but I'm not sure where else to get it

You can get not only that patch but also the Knoppix .config in the kernelsources.dsl in the dsl repository.

Posted by jonf on June 06 2005,19:45
Here is a step by step kernel recompile.
I did this in Debian, because that happens to be my distro of choice.

You need the kernel-source, cloop-source, dsl*.iso, and the kernel-source.dsl from the repository.

I will assume you have all the dependencies for compiling a kernel. With debian you can do apt-get builddeps kernel-package to get everything you need.

I used 2.4.31 from < http://kernel.org. >  I couldn't find the cloop sources so I got them from my debian repositories apt-get install cloop-src.  Downloaded the dsl package from the dsl rearpository.

# make a directory to work with
mkdir ~/dsl
export dsl_work_dir=~/dsl
cd $dsl_work_dir

# get the kernel sources
wget < http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.31.tar.bz2 >

# get kernelsource.dsl
wget < http://gulus.usherbrooke.ca/pub....rce.dsl >

# get dsl, you need the KNOPPIX file and minirt.gz
# I got mine off my pen drive, but I'll assume you are using a CD
wget < http://gulus.usherbrooke.ca/pub....1.1.iso >

# get the cloop source, maybe you can get it here, I couldn't
# < http://www.knopper.net/download/knoppix/ >
# I got it from a debian repository
# < http://packages.debian.org/testing/misc/cloop-src.html >
# because the first link was down when I tried, and I got the
# deb, I will be going off that.


# rename dsl package because gzip is too smart for its own good.
mv kernelsource.dsl kernelsource.tar.gz

# extract you kernel-sources
tar jxvf linux-2.4.31.tar.bz2

# extract kernelsource dsl
tar jxvf kernelsource.tar.gz

# The debian package of cloop-src installed in /usr/src
# lets get it into our dir
cp /usr/src/cloop.tar.gz $dsl_work_dir

# and extract it
tar -zxvf cloop.tar.gz

# copy dsl .config to out new sources
cp usr/src/linux/.config linux-2.4.31/

# go into our kernel-source dir
cd linux-2.4.31

# configure kernel
make oldconfig

# If you need to make any changes now it the time to do it.
# You shouldn't need to and if you are reading this, you
# probably shouldn't do it any way, but its here for completeness
make menuconfig

# apply knoppix patch
patch -p1 < ../usr/src/knoppix-kernel.patch

# Our kernel is now ready to compile
make dep; make bzImage; make modules

if [ ! -d ../modules ] && mkdir ../modules


# There is probably a better way to do this, but I don't know it
sudo make modules_install
cp /lib/modules/2.4.31 ../modules/
sudo rm -rdf /usr/src/2.4.31

# If you made it this far without errors, have a cookie
# now on to the cloop module
# this assumes you used the debian package it extracts to
# modules/cloop which we extracted in $dsl_work_dir
cd $dsl_work_dir/modules/cloop
make $KERNEL_DIR=$dsl_work_dir/linux-2.4.31
cd $dsl_work_dir

# lets extract our iso
mkdir iso_source
sudo mount dsl-1.1.iso /mnt -o loop
cp -a /mnt/* $dsl_work_dir/iso_source/
umount /mnt

# This assumes that you have cloop up and running on your current system, if not you can do this with dsl by adapting the remastering howto.
sudo /sbin/modprobe cloop file=$dsl_work_dir/iso_source/KNOPPIX/KNOPPIX
mkdir KNOPPIX
sudo mount /dev/cloop0 ./KNOPPIX
cp -a modules/2.4.31 ./KNOPPIX/lib/modules/
rm -rdf ./KNOPPIX/lib/modules/2.4.26
umount ./KNOPPIX
sudo /sbin/modprobe -r cloop

# KNOPPIX file is done, onto the minirt.gz
cd iso_source/boot/isolinux
gunzip minirt.gz
mkdir tmp
sudo mount minirt tmp
cd tmp/modules
cp $dsl_work_dir/modules/cloop/cloop.o ./
cd ../../
sudo umount tmp/
rmdir tmp/
gzip minirt


# lets replace out kernel
cp $dsl_work_dir/linux-2.4.31/arch/i386/boot/bzImage ./linux24

cd $dsl_work_dir

Now you just need to make the iso, burn and boot it.
mkisofs -no-pad -l -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o newdsl.iso iso_source

There are probably numerous errors, this was adapted from a usb pendrive method from memory and my memory isn't that great,  I will update it if anyone finds any errors.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.