[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

building custom kernel package



Install the package "kernel-package" and use make-kpkg to build the kernel.  
This builds nice Debian packages of the kernel which make it a lot easier to 
manage and track which machines are running which versions.  Also the kernel 
package installation takes care of making the initrd.

Then to create the initrd you need the initrd-tools package and mkcramfs (for 
cramfs) or genromfs (for romfs).

Initrd-tools by default puts all the kernel's modules into the initrd which 
isn't necessary (and if your kernel settings are like mine you'll get a 2M 
initrd image).

I've written some scripts to help manage this.  I've attached two scripts for
inclusion in /etc/mkinitrd/scripts directory (make sure you don't run the
devfs script in any other way), and the mkinitrd.conf file I use.  With that
and the correct /etc/mkinitrd/modules file it should all work fine.

For creating a romfs change /usr/sbin/mkinitrd to have the following as the 
last few lines:
if [ $VERBOSE ]; then
#       mkcramfs $workdir/initrd /dev/fd/3 3>&1 >&2
        genromfs -f /dev/fd/3 -d $workdir/initrd -v 3>&1 >&2 | gzip -9
else
#       mkcramfs $workdir/initrd /dev/fd/3 3>&1 > /dev/null
        genromfs -f /dev/fd/3 -d $workdir/initrd 3>&1 > /dev/null | gzip -9
fi

Romfs generates smaller images than cramfs (between 5% and 15% space savings 
in my tests).  The romfs kernel driver uses less memory than the cramfs 
driver.  Also romfs works out of the box while cramfs is always broken and 
needs patching.

Sorry for the form response, I just re-wrote a previous message.

-- 
http://www.coker.com.au/bonnie++/     Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/       Postal SMTP/POP benchmark
http://www.coker.com.au/projects.html Projects I am working on
http://www.coker.com.au/~russell/     My home page

Attachment: copy-needed-modules
Description: copy-needed-modules

Attachment: devfs
Description: devfs

# /etc/mkinitrd/mkinitrd.conf:
#  Configuration file for mkinitrd(8).  See mkinitrd.conf(5).
#
# This file is meant to be parsed as a shell script.

# What modules to install.
MODULES=none

# The length (in seconds) of the startup delay during which linuxrc may be
# interrupted.
DELAY=0

# If this is set to probe mkinitrd will try to figure out what's needed to
# mount the root file system.  This is equivalent to the old PROBE=on setting.
ROOT=probe

# This controls the permission of the resulting initrd image.
UMASK=022

# Turn this on to see the messages from mkcramfs.
VERBOSE=on

Reply to: