LINUX GAZETTE
[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]

"Linux Gazette...making Linux just a little more fun!"


Installing Linux on Root Devices Unsupported by Your Distribution

By Zwane Mwaikambo


I'm sure the vast majority of sysadmins out there have occasionally acquired new server hardware that their latest Linux distribution does not support. This is usually not a problem because as long as you can install the base system you can then graft the other bits in once it's running. The only exception is when your root device isn't supported; that's when the excitement begins.

The key here is that the hardware is not distro supported. Most of the time you'll may find that the most recent kernels do support your hardware and hence, upgrading to the newer kernel would solve your problem. But it's a chicken-and-egg situation since you don't have a running system yet. With this article I hope to alleviate some of the headaches of these problematic installations so that you can get on with your usual duties sooner. The distribution i shall use as an example is Red Hat 7.1 (hereupon referred to as RH7.1), and the server root device is a RAID device on an Adaptec 2100 host adapter, but of course I will try to generalise so that you will be able to adapt this advice for just about any unsupported device (e.g. IDE RAID controllers or other SCSI HBAs).

The kernel shipped with RH7.1 is 2.4.2-2, a 2.4.2-ac based kernel with extra patches by Red Hat. My target kernel will be 2.4.10-ac1. I recommend "-ac" since Alan Cox incorporates lots of experimental drivers in his kernels for testing and hence usually has support for various devices first before the mainstream Linus kernel , which he merges to later. In order to build the kernels you will require an additional Linux box to do the compilations on (you might want to read the kernel-HOWTO if you're a bit rusty) and to prepare the bootdisks. When creating the bootdisk kernel image you can make good guesses based on the kernel ring buffer output from dmesg). Size is the objective here since we have to be able to fit the new kernel into the same space the original took, there really isn't much leeway so we have to pick carefully. Here is a rough outline of our new configuration with explanations. (Parts removed.)

CONFIG_X86=y
CONFIG_ISA=y
CONFIG_UID16=y

# Needed for newer drivers
CONFIG_EXPERIMENTAL=y
CONFIG_MODULES=y
CONFIG_MODVERSIONS=y
CONFIG_KMOD=y

# Select your target CPU but skip SMP due to the size
# hit when enabled
CONFIG_MPENTIUMIII=y

# Even if you have over 1G of RAM, stick with no
# highmem for the installation
CONFIG_NOHIGHMEM=y

CONFIG_NET=y
CONFIG_PCI=y
CONFIG_PCI_GOANY=y
CONFIG_PCI_BIOS=y
CONFIG_PCI_DIRECT=y

# This particular option just bloats the kernel
# no need for this during install
# CONFIG_PCI_NAMES is not set
CONFIG_SYSVIPC=y
CONFIG_SYSCTL=y
CONFIG_KCORE_ELF=y
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_MISC=y

# ACPI and APM are not required even for normal
# operation on desktop systems so skip it.
# CONFIG_PM is not set
# CONFIG_ACPI is not set
# CONFIG_APM is not set

# No need for parallel ports right now either
# CONFIG_PARPORT is not set

CONFIG_BLK_DEV_FD=y
# Some distributions use loop devices during
# installation
CONFIG_BLK_DEV_LOOP=y

# Initrds are almost always used during installation
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=4096
CONFIG_BLK_DEV_INITRD=y

CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set
# CONFIG_NETLINK is not set
# CONFIG_NETFILTER is not set
# CONFIG_FILTER is not set
CONFIG_UNIX=y
CONFIG_INET=y

# Any IDE devices? I usually have
# IDE cdroms
CONFIG_IDE=y
CONFIG_BLK_DEV_IDE=y
CONFIG_BLK_DEV_IDEDISK=y

# Speeds things up by reading multiple sectors at
# a time
CONFIG_IDEDISK_MULTI_MODE=y
CONFIG_BLK_DEV_IDECD=y
CONFIG_BLK_DEV_IDEPCI=y
CONFIG_IDEPCI_SHARE_IRQ=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
CONFIG_BLK_DEV_ADMA=y

# You may require this if you're installing to
# a disk on an addon card
# CONFIG_BLK_DEV_OFFBOARD is not set

# DMA is good to cut down that install time
# and general error checking
CONFIG_IDEDMA_PCI_AUTO=y
CONFIG_BLK_DEV_IDEDMA=y
CONFIG_IDEDMA_AUTO=y

# If you've got one of those IDE-RAID cards
# you'll want to check this out.
# CONFIG_BLK_DEV_ATARAID is not set
# CONFIG_BLK_DEV_ATARAID_PDC is not set
# CONFIG_BLK_DEV_ATARAID_HPT is not set

CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_SD_EXTRA_DEVS=40
CONFIG_SCSI_MULTI_LUN=y

# Of the low-level drivers, only pick the ones
# which you require doing installation
# I didn't select my aic7xxx based card
# since it only has a tape drive on it.
CONFIG_SCSI_DPT_I2O=y

# Increases kernel size, skip.
# CONFIG_SCSI_DEBUG is not set

# required for this specifc i2o based RAID
# card
CONFIG_I2O=y
CONFIG_I2O_PCI=y
CONFIG_I2O_BLOCK=y
CONFIG_I2O_SCSI=y

# We don't really need network card drivers
CONFIG_NETDEVICES=y

# You have to type somewhere ;)
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=256

# We can use the "text" based installation
# CONFIG_MOUSE is not set
# CONFIG_PSMOUSE is not set
# CONFIG_82C710_MOUSE is not set
# CONFIG_PC110_PAD is not set

# You can be a BOFH later ;)
# CONFIG_QUOTA is not set

# If you're on a distribution with ext3 installation
# support you might want to enable this (ditto for Reiser).
# But try keep the number of filesystems supported low
# CONFIG_EXT3_FS is not set

# Some distributions require msdos fs
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y

# For the installation media
CONFIG_ISO9660_FS=y
# CONFIG_JOLIET is not set

CONFIG_PROC_FS=y
CONFIG_DEVPTS_FS=y
CONFIG_EXT2_FS=y

# Your regular PC partitions
CONFIG_MSDOS_PARTITION=y

# This might not be necessary but may break things
CONFIG_NLS_DEFAULT="iso8859-1"

# Console drivers
#
CONFIG_VGA_CONSOLE=y

# No pretty penguins right now :)
# CONFIG_FB is not set

# Unless you have USB keyboards/mice skip this section
# CONFIG_USB is not set
After the kernel compilation is done, it's time to move the new kernel to the previous installation kernel's location, we do this by mounting the bootdisk used by the installation. You will require loopback block device support to do this.
# cd /tmp
# cp /cdrom/boot/boot.img .
# mkdir bootdisk
# mount -t msdos boot.img bootdisk -o loop
# cp /usr/src/linux-2.4.10-ac11/arch/i386/boot/bzImage bootdisk/vmlinuz
An rdev isn't required because syslinux passes the appropriate root device (ie initrd)
# umount bootdisk
# dd if=boot.img of=/dev/fd0
Lets compare sizes for this particular kernel build.
Original installation kernel : 652k
Custom installation kernel : 632k
Custom "normal" kernel : 951k
We obviously wouldn't be able to fit in a full-featured kernel onto our bootdisk.

Once that's done, we have a "new" installation disk with support for our root device. We now use the bootdisk to start the installation. I recommend using text-based installs since we removed framebuffer and mouse support to minimise the kernel size. Upon completion of the installation you will have an installed system but still won't be able to boot from the device. The reason is that your distribution will install the kernel packages from its installation medium, and not the one used during installation. We have to now go back to the compile box and do the following to create a bootdisk.

# rdev bzImage /dev/sda1
# dd if=bzImage of=/dev/fd0
(Use your actual root device instead of /dev/sda1.)

When that's done and you've booted to a shell, you can then unpack a new tarball on your target computer/server and configure as required. You may want to take the distribution config file and build on that by doing.

# cd /usr/src/linux-2.4.10-ac11
# cp /home/zwane/config-2.4.2-2 .config
# make oldconfig
Answer the prompted questions, then go through menuconfig to check the final configuration before compilation:
# make menuconfig
# make dep bzImage modules modules_install
Copy the resulting image to your kernel location (e.g /boot/vmlinuz) and edit your lilo configuration (or skip lilo if you're using grub ;) You will have to do a final rdev to your new kernel, since the kernel build process "detects" your current root device when compiling and sets it in kernels you build in that session. Or you can edit the toplevel Makefile (e.g. /usr/src/linux-2.4.10-ac11/Makefile) and change ROOT_DEVICE to your device.
# rdev /boot/vmlinuz /dev/sda1
You should be able to reboot now and enjoy the fruits of your labour!

Zwane Mwaikambo

Zwane is a net/sysadmin in Swaziland for one of the ISPs there (Realnet) until he starts University sometime in 2002. He's router-hopping during the day and hacking on Open Source Software at night (oh and anyone for an LUG in Swaziland?).


Copyright © 2001, Zwane Mwaikambo.
Copying license https://www.linuxgazette.net/copying.html
Published in Issue 73 of Linux Gazette, December 2001

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]