How to create a custom install kernel/initrd
Hi All -
I'm not sure if this is the right list to ask, but some of the other
emails I've seen seem to indicate so. If not, please forgive and point
me in the right direction.
In a nutshell, I need to create a custom kernel/initrd for doing a
Sarge/stable netinst. Does anyone have a clean working recipe for
creating a netboot kernel/initrd from scratch. With details ?
I've been using the kernel/initrd pairs on
http://ftp.debian.org/debian/dists/sarge/main/installer-i386/current/images/netboot/debian-installer/i386/2.6/
just fine. These work nicely from a PXE environment, as well as a
syslinux setup on a USB memory stick. Perfect.
Unfortunately, I now have to help several remote sites install Sarge on
Dell equipment. Dell as we all know, likes to be different
driver-wise. The current kludge mechanism I've been using up to now is
to ask the remote site to download the 2.4 kernel ISO from
http://wiki.osuosl.org/display/LNX/Debian+on+Dell+Servers
<http://wiki.osuosl.org/display/LNX/Debian+on+Dell+Servers>
and install with that. Then I either send them a custom 2.6 kernel
.deb, or have them build it locally and install it. The kernel is built
from 2.6.15 and uses the Jeff Garzik patches which are at (also off the
link above)
http://www.kernel.org/pub/linux/kernel/people/jgarzik/libata/
specifically the 2.6.15-libata1.patch.bz2
The actual procudure for creating that kernel is at the bottom of this
email. Not hard, and just forcing a couple of modules in the initrd.
It works. Now, I would like to use this custom kernel/initrd to create
a new netboot kernel/initrd. That way, the remote sites can just use
them in their own PXE environment, or they can bung them onto a USB key
and boot from that. Simpler, cleaner, the Debian way.
I've dug through the docs in the debian-installer package
(/usr/share/doc/debian-installer/custom-kernel.txt.gz), as well as
several recipes on the net ...
http://dsplabs.cs.utt.ro/~juve/blog/index.cgi/01147559232
http://huge.cajones.org/~dick/debian/custom_installer.pdf
The problem always stems at the *dpkg-buildpackage* step in
linux-kernel-di-i386-2.6-1.23. It always complains about unmet
dependencies for my custom kernel ...
mongo:/usr/src/linux-kernel-di-i386-2.6-1.23# dpkg-buildpackage
dpkg-buildpackage: source package is linux-kernel-di-i386-2.6
dpkg-buildpackage: source version is 1.23
dpkg-buildpackage: source maintainer is Frans Pop <fjp@debian.org>
dpkg-buildpackage: host architecture is i386
dpkg-checkbuilddeps: Unmet build dependencies: linux-image-2.6.15-686
dpkg-buildpackage: Build dependencies/conflicts unsatisfied; aborting.
dpkg-buildpackage: (Use -d flag to override.)
mongo:/usr/src/linux-kernel-di-i386-2.6-1.23#
Doing it with -d to ignore dependencies only shows this :
dpkg-buildpackage: host architecture is i386
debian/rules clean
kernel-wedge gen-control > debian/control
dh_testdir
dh_clean `find modules -type l`
dpkg-source -b linux-kernel-di-i386-2.6-1.23
dpkg-source: warning: unknown information field in input data in
package's section of control info file
dpkg-source: warning: unknown information field in input data in
package's section of control info file
:
:
kernel-wedge install-files
install -D -m 644 /boot/vmlinuz-2.6.15-686
debian/kernel-image-2.6.15-686-di/boot/vmlinuz
install -D -m 644 /boot/System.map-2.6.15-686
debian/kernel-image-2.6.15-686-di/boot/System.map
kernel-wedge copy-modules 2.6.15 686 2.6.15-686
DEB_HOST_ARCH_OS is not a supported variable name at
/usr/bin/dpkg-architecture line 271.
command exited with status 9
make: *** [binary-arch] Error 2
So, does anyone have a clean working recipe for creating a netboot
kernel/initrd from scratch. With details ? The custom-kernel.txt.gz
file is a little sparse in the "satisfy dependencies" arena ...
=== Custom Kernel creation ===
How to create a Debian 2.6 kernel on Sarge for the Dell PowerEdge 850
This assumes that the system has been installed with the custom
debian-dell-2.4.31.iso that is available at
http://wiki.osuosl.org/display/LNX/Debian+on+Dell+Servers
Add the following lines to /etc/mkinitrd/modules. This will ensure that
the initrd we generate will definitely load up the ata, ext3 and network
drivers.
ata_piix
ext3
tg3
Add the following to /etc/kernel-img.conf, otherwise dpkg with
constantly ask us if we really want to use an initrd. Note - this puts
the onus of configuring the bootloader to use the initrd on us ...
do_initrd = Yes
We need several packages, so install the following with apt-get. This
will also pull in other dependencies.
cd /usr/src
apt-get install linux-source-2.6.15 kernel-package initrd-tools linux-source-2.6.15
Get the 2.6.15 patches for libata. This link is off the main custom wiki
page above.
wget http://www.kernel.org/pub/linux/kernel/people/jgarzik/libata/2.6.15-libata1.patch.bz2
bunzip2 2.6.15-libata1.patch.bz2
Unpack the source (we're in /usr/src).
tar -xvjf linux-source-2.6.15.tar.bz2
We will need the config file from the default 2.6.15 kernel as well, but
we don't want to actually install this one. So get it with
wget http://http.us.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.15-1-686_2.6.15-8_i386.deb
Extract the contents to temporary dir ttt and copy the config
dpkg --extract linux-image-2.6.15_2.6.15-8_i386.deb ttt
cp ttt/boot/config-2.6.15 linux-source-2.6.15/.config
rm -rf ttt
Apply the patch
cd linux-source-2.6.15
patch -p1 < ../2.6.15-libata1.patch
cd ..
Build the kernel - we're using 1.0 as a revision label
make-kpkg --rev=1.0 --initrd kernel_image
And finally install it ...
dpkg --install kernel-image-2.6.15_1.0_i386.deb
Now you have to actually configure your bootloader (lilo, grub) to use
the new kernel. It should already be installed in /boot along with the
initrd. Using grub is easy ...
update-grub
=== ===
--
Dean Carpenter
dcarpenter at puresend dot com
Reply to: