Installation of Debian GNU/Linux Sarge on an AOpen i915GMm-HFS motherboard

This document describes how to install the stable version of Debian GNU/Linux (called Sarge), on a system based on AOpen's i915GMm-HFS motherboard. This motherboard supports the low-power Pentium M processor usually found in notebook systems, and hence is a priori well suited to build a low-power, silent yet powerful desktop system.

Summary and current status

AOpen's i915GMm-HFS features a Silicon Image 3132 Serial ATA 2 controller, and two Marvell Yukon 88E8053 PCI Express Gigabit Ethernet controllers, that make the installation tricky. The system that we have installed has one SATA-2 hard-drive, and one CD-ROM drive on the ATA controller. We have not addressed sound chip issues, etc. since our system is a server.

This document describes how to fully support the Serial ATA 2 controller and the on-board Ethernet controllers under Sarge (which is far from obvious!). Previously, the Ethernet controller required a non-standard Linux driver, that is available as a patch to the Linux kernel from Syskonnect: sk98lin. This patch has been integrated into the standard Linux kernel since version 2.6.16: this is this version of the kernel that this document will guide you to install. However, until the 2.6.16 Linux kernel is running on your box, if you want to do a network installation as described in this document you will need to plug in an additional PCI network card for the time of the installation. A non-network installation is still possible, e.g. using only CD-ROMs, but you will have to download and copy into your system the backported Linux kernel package and its dependencies, by any other means.

Network installation of the base Sarge system

First, on another computer, download the minimal ISO-9660 CD-ROM image for Sarge network installation from the list of downloable images (that image file should be named debian-31r1a-i386-netinst.iso), and burn a CD-R with that image.

On the system to install, boot and immediately enter the BIOS setup program (press DEL). In the BIOS, go into Integrated Peripherals, then OnChip IDE Device, and then On-Chip Serial ATA, and select Combined Mode in the list. Download and check in the motherboard manual if unsure. The Combined Mode makes the Serial ATA controller emulate a legacy Parallel ATA controller, and makes the actual Parallel ATA controller (with our CD-ROM drive) the second PATA controller. This is the only mode that makes the CD-ROM drive recognized by Sarge installer's Linux 2.4.27 kernel, hence this is the only mode that make installation possible. Unfortunately, no mode lets the CD-ROM drive be recognized by the installer's Linux 2.6.8 kernel without crashes, so we are stuck to Linux 2.4.27 for installation.

Now, Debian Sarge can be installed from the CD-ROM. Reboot the system after modifying the BIOS as described above. At the CD-ROM Boot: prompt, just press ENTER, to start installing Sarge using the standard 2.4.27 Linux kernel. Then, install Sarge as usual. This is out of the scope of this document. After rebooting, the installation program upgrades all packages, etc.

Now, install the Linux 2.6.8 kernel package:

root@system> apt-get install kernel-image-2.6.8-2-686

Then, reboot and immediately enter the BIOS setup program (press DEL). In the BIOS, go into Integrated Peripherals, then OnChip IDE Device, and then On-Chip Serial ATA, and select SATA Only in the list. Download and check in the motherboard manual if unsure. The SATA Only mode makes it at least work with Sarge's default Linux 2.6.8 kernel, whereas the Combined Mode mode makes that kernel crash. The SATA Only mode disables the integrated Parallel ATA controller, but this is not important since we will not use the CD-ROM in the rest of the installation process. Then reboot, and in the list of available kernels (in the Grub bootloader), select Linux version 2.6.8-2-686.

Upgrading to Linux 2.6.16

Now, we have a fully functionnal Debian Sarge system running a 2.6.8 kernel. The problem is that disk access is very slow in SATA Only mode. This can be verified using the hdparm utility:

root@system> apt-get install hdparm
root@system> hdparm -T -t /dev/hda

We have to upgrade to a more recent version of the Linux kernel to get better performance.

Installing Linux 2.6.16

Since no Linux version more recent than 2.6.8 is available in Sarge, we have to use a backported package of version 2.6.16, available from a Debian Backports web site.

Add the following line into the file /etc/apt/sources.list:

deb http://www.backports.org/debian/ sarge-backports main

Declare the official Debian Sarge release as the preferred release for this system, by putting the following line into a new /etc/apt/apt.conf.d/10defaultrelease file:

APT::Default-Release "stable";

This gives a better score to Debian Sarge packages (their score is now 990 by default), than any other packages including backported packages (their score is now 500 by default, and we will even explicitly give them a score of 200 by default, see below). Therefore, of several versions of a given package, the version in Sarge will always be selected to be installed by APT. To allow to install and upgrade backports packages, we must then explicitly give a higher score to every backported package that we want to install. That way, no unwanted backported package gets installed unless explicitly allowed, hence the systems remains a mostly clean Debian Sarge system even when upgraded. The scores are specified in /etc/apt/preferences:

Package: *
Pin: release a=sarge-backports
Pin-Priority: 200

Package: linux-image-2.6.16-1-686
Pin: release a=sarge-backports
Pin-Priority: 999

Package: yaird
Pin: release a=sarge-backports
Pin-Priority: 999

And update the locally cached list of available packages (which also update the score of every package):

root@system> apt-get update

Install the backported package for Linux 2.6.16:

root@system> apt-get install linux-image-2.6.16-1-686

Installing this package will also install yaird, used while installing the linux-image-2.6.16-1-686 to generate the newly installed kernel's initial memory disk (initrd). Yaird requires a 2.6 kernel to execute, which is the reason we needed to install Sarge's 2.6.8 kernel in the first place (and hence we needed to setup the SATA controller into SATA Only mode...)!

To let the system clean, remove the added line from the file /etc/apt/sources.list, then update again the locally cached list of available packages:

root@system> apt-get update

Don't reboot yet, this is not over.

Generating a correct initrd

The SATA controller is in SATA Only and is currently managed by module ata_piix by Linux 2.6.8. Hence, the hard drive is seen as device /dev/hda. In addition, since the system was installed with the SATA controller in Combined Mode, the CD-ROM drive was seen as device /dev/hdc at that time (however, it is no more recognized since the controller is currently in SATA Only mode...). However, unlike version 2.6.8, Linux version 2.6.16 can fully supports the controller as SATA, through modules sata_sil and ahci. To enable that, we will have to change the controller mode into Enhanced Mode, see below. But problems are:

  1. the device names will be changed: the hard drive will be seen as device /dev/sda (as a SCSI device), and the CD-ROM drive as device /dev/hda;
  2. the initial memory disk image must be modified to load the sata_sil and ahci modules instead of ata_piix, and to mount the root filesystem from /dev/sda instead of /dev/hda.

An initrd is a compressed filesystem that is loaded early by the Linux kernel. It essentially consists of one or more module files (ending with .ko) and a script (init) that loads the kernel modules and mounts the root filesystem (/). yaird is one the tools that generates an initrd for an installed Linux kernel: it analyzes the currently running system to determine which modules are necessary to mount the root filesystem, and creates the compressed filesystem that contains those modules, and generates an appropriate init script. The problem that when yaird analyzes the system when running a 2.6.8 kernel with the SATA controller into SATA Only mode, it determines that only the ata_piix module is necessary to mount the filesystem, and that the root filesystem is on device /dev/hda: it therefore generates a wrong initrd image for our installed 2.6.16 kernel which contains only the ata_piix module and its dependent modules. We have to modify that generated initrd image.

First, make yaird generate the content of the initrd image into a directory, without compressing it:

root@system> cd /tmp
root@system> yaird -f directory -o initrd 2.6.16-1-686
root@system> cd initrd

In that directory, we have to copy the modules for SATA (Silicon Image's controller driver sata_sil, ahci, and other required SCSI modules):

root@system> mkdir lib/modules/2.6.16-1-686/kernel/drivers/scsi
root@system> cp /lib/modules/2.6.16-1-686/kernel/drivers/scsi/{sata_sil,ahci,libata,sg,sd_mod,scsi_mod}.ko \
    lib/modules/2.6.16-1-686/kernel/drivers/scsi

And the init script must be modified. Just before the mkbdev '/dev/hda' line, add the following lines, to make it load the modules:

/sbin/insmod '/lib/modules/2.6.16-1-686/kernel/drivers/scsi/scsi_mod.ko'
/sbin/insmod '/lib/modules/2.6.16-1-686/kernel/drivers/scsi/sd_mod.ko'
/sbin/insmod '/lib/modules/2.6.16-1-686/kernel/drivers/scsi/sg.ko'
/sbin/insmod '/lib/modules/2.6.16-1-686/kernel/drivers/scsi/libata.ko'
/sbin/insmod '/lib/modules/2.6.16-1-686/kernel/drivers/scsi/ahci.ko'
/sbin/insmod '/lib/modules/2.6.16-1-686/kernel/drivers/scsi/sata_sil.ko'

then modify all the lines that contain hda, to contain sda instead. Notably, modify the mkbdev commands, and the final mount command.

Now, make that directory a true initrd that can be used to boot Linux 2.6.16:

root@system> find . | cpio --quiet -o -H newc > /tmp/initrd.cpio
root@system> gzip -9 < /tmp/initrd.cpio > /tmp/initrd.cpio.gz

Replace the current (wrong) initrd for 2.6.16 by this one:

root@system> cp /tmp/initrd.cpio.gz /boot/initrd.img-2.6.16-1-686
Completely switching to 2.6.16

Reboot, and immediately enter the BIOS setup program (press DEL). In the BIOS, go into Integrated Peripherals, then OnChip IDE Device, and then On-Chip Serial ATA, and select Enhanced Mode in the list. This mode is supported by Linux 2.6.16 with the initrd we just generated above, and is the fastest available mode. Beware that this mode makes 2.6.8 crash: if you need to reboot to 2.6.8 at that point, don't forget to go back to SATA Only mode!

Go on with booting, and in the list of bootable kernels proposed by Grub, select Debian GNU/Linux, kernel 2.6.16-1-686 (recovery mode) (not the usual Debian GNU/Linux, kernel 2.6.16-1-686).

If anything went wrong, reboot, set the controller to SATA Only in the BIOS, and boot the 2.6.8 kernel. Then, restart the procedure above.

If everything went fine, i.e. you get no crash or freeze, and no strange kernel message, you should get a maintainance-mode command prompt. Enter your root password. We now have to modify all configuration files that refer to the /dev/hda device to refer to the /dev/sda device instead (as the currently running 2.6.16 kernel now sees the hard drive). You have to modify /etc/fstab to change any /dev/hda into /dev/sda, and any /dev/hdc into /dev/hda. You also have to modify the line in /boot/grub/menu.lst that starts with # kopt=root=/dev/hda... to become # kopt=root=/dev/sda....

Although this is not necessary, you can make sure that the initrd image is clean, by making yaird re-generate the initrd for the running kernel, under the running kernel:

root@system> dpkg-reconfigure linux-image-2.6.16-1-686

You can also make sure that Grub works with the new configuration:

root@system> update-grub

Now, everything is ok, you can reboot for the last time and select Debian GNU/Linux, kernel 2.6.16-1-686 in the list of available kernels in Grub. You can test that the performance of the hard drive has greatly improved:

root@system> hdparm -T -t /dev/sda

History of this document

  • 2006-05-01: updated to install 2.6.16 kernel; on-board network interfaces now work with this kernel without patching
  • 2006-03-14: better management of backported packages
  • 2006-02-19: corrected typo: Silicom -> Silicon
  • 2006-01-04: modified, to insert the first step with Linux 2.4.27 and the controller in Combined Mode mode, because the SATA Only mode does actually disable the PATA controller which disables our CD-ROM drive and prevents installing
  • 2006-01-03: first version of this document

Copyright

Copyright © 2005-2006 Romain Lenglet.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available from the GNU project web site at: http://www.gnu.org/copyleft/fdl.html.