Early

netconsole in the initrd

If something breaks before root is mounted, netconsole will not be loaded in the normal case, since the module is not in the initrd. In some cases it will be enough to add netconsole and your network card driver module to /etc/initramfs-tools/modules and rebuild the initrd.

But if your network card needs firmware, it gets a bit trickier.

1. Create /etc/initramfs-tools/hooks/early_netconsole which makes sure the needed firmware files and firmware loaders are added to the initrd:

#!/bin/sh

PREREQ=""

prereqs()
{
        echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
        prereqs
        exit 0
        ;;
esac
. /usr/share/initramfs-tools/hook-functions

echo "Adding netconsole to initrd"
# Change this to your own network card module:
force_load tg3
manual_add_modules netconsole
mkdir -p $DESTDIR/lib/udev/rules.d
cp /lib/udev/firmware.sh $DESTDIR/lib/udev
cp /lib/udev/rules.d/50-firmware.rules $DESTDIR/lib/udev/rules.d

exit 0

2. Create /etc/initramfs-tools/scripts/init-premount/early_netconsole which makes sure netconsole is loaded after udev is ready to load firmware:

#!/bin/sh -e

PREREQ="udev"

# Output pre-requisites
prereqs()
{
        echo "$PREREQ"
}

case "$1" in
    prereqs)
        prereqs
        exit 0
        ;;
esac

modprobe netconsole

3. Make sure /etc/modprobe.d/netconsole is configured before running update-initramfs -u, for example:

options netconsole netconsole=6666@192.168.1.103/eth0,6666@192.168.1.104/00:01:02:0a:0b:0c

KernelTeam/Netconsole/Early (last edited 2009-11-01 09:09:48 by 80-219-115-70)