old-www/LDP/LG/issue73/mwaikambo.html

342 lines
12 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>Installing Linux on Root Devices Unsupported by Your Distribution LG #73</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<CENTER>
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/lglogo.png"
WIDTH="600" HEIGHT="124" border="0"></A>
<BR>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="mauerer.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue73/mwaikambo.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="okopnik.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
<P>
</CENTER>
<!--endcut ============================================================-->
<H4 ALIGN="center">
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Installing Linux on Root Devices Unsupported by Your Distribution</font></H1>
<H4>By <a href="mailto:zwane@linux.realnet.co.sz">Zwane Mwaikambo</a></H4>
</center>
<P> <HR> <P>
<!-- END header -->
<P> 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.
<P> The key here is that the hardware is not distro supported. Most of the time you'll
may find that the most recent kernels <EM>do</EM> 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).
<P> 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 <CODE>dmesg</CODE>). 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.)
<PRE>
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
</PRE>
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.
<PRE>
# 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
</PRE>
An rdev isn't required because syslinux passes the appropriate root device (ie
initrd)
<PRE>
# umount bootdisk
# dd if=boot.img of=/dev/fd0
</PRE>
Lets compare sizes for this particular kernel build.
<PRE>
Original installation kernel : 652k
Custom installation kernel : 632k
Custom "normal" kernel : 951k
</PRE>
We obviously wouldn't be able to fit in a full-featured kernel onto our
bootdisk.
<P> 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.
<PRE>
# rdev bzImage /dev/sda1
# dd if=bzImage of=/dev/fd0
</PRE>
(Use your actual root device instead of /dev/sda1.)
<P> 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.
<PRE>
# cd /usr/src/linux-2.4.10-ac11
# cp /home/zwane/config-2.4.2-2 .config
# make oldconfig
</PRE>
Answer the prompted questions, then go through menuconfig to check the final
configuration before compilation:
<PRE>
# make menuconfig
# make dep bzImage modules modules_install
</PRE>
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.
<PRE>
# rdev /boot/vmlinuz /dev/sda1
</PRE>
You should be able to reboot now and enjoy the fruits of your labour!
<!-- *** BEGIN bio *** -->
<SPACER TYPE="vertical" SIZE="30">
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Zwane Mwaikambo</H4>
<EM>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?).</EM>
<!-- *** END bio *** -->
<!-- *** BEGIN copyright *** -->
<P> <hr> <!-- P -->
<H5 ALIGN=center>
Copyright &copy; 2001, Zwane Mwaikambo.<BR>
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 73 of <i>Linux Gazette</i>, December 2001</H5>
<!-- *** END copyright *** -->
<!--startcut ==========================================================-->
<HR><P>
<CENTER>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="mauerer.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue73/mwaikambo.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../faq/index.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="okopnik.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
</CENTER>
</BODY></HTML>
<!--endcut ============================================================-->