Post-Installation Configuration of a Dell Laptop

by Salman Ahmed

In my last article, I discussed the installation of Debian GNU/Linux on my Dell Latitude C800 laptop, as well as the installation and configuration of XFree86 4.1.0. But I left out a lot of other configuration issues. In this article, I will discuss further configuration of this laptop, including:

  • kernel compilation using Debian's make-kpkg scripts, and configuration and installation of a 2.4 kernel

  • setting up sound on the C800

  • setting up a FrameBuffer console

  • conversion of ext2 partitions to the ext3 journalled filesystem

Setting up, Configuring and Installing a 2.4 kernel

Currently, there are two main series of 2.4 kernels. The Linus kernel series are the kernels released by Linus Torvalds, and they have version numbers like 2.4.7, 2.4.8, etc. The Alan Cox kernel series kernels are maintained and released by Alan Cox. They have version numbers like 2.4.8-ac3, 2.4.9-ac2, etc.

One of the major differences between the two kernel series is that ext3 has been integrated into the -ac (Alan Cox) kernels for quite some time, while the Linus kernels require a version-specific patch to add in ext3 support.

Another recent major difference is that with the 2.4.10 kernel release, Linus introduced a new VM system while Alan Cox has continued to stick with the previous VM. A consequence of this VM change in the Linus kernels since 2.4.10 is that there have been stability issues with the ext3 layer, not all of which have been resolved at of the time of writing this article.

However, the ext3 patches integrated into the -ac kernels are considered very stable. Based on this knowledge, and on my e-mail exchanges with Andrew Morton, one of the two ext3 maintainers, I will compile the current latest -ac kernel, which at the time of this writing happens to be 2.4.12-ac3.

If you are wary of trying out an -ac kernel and prefer to stick with a Linus kernel, I recommend the 2.4.7 Linus kernel. I have run this kernel along with the specific ext3 patch for it for some time on a desktop system and encountered no problems. Caveat: YMMV (your mileage may vary).

Downloading the 2.4.12-ac3 Kernel Source

Having decided to go with the above kernel, we need to download the source code. I always like to keep kernel sources in /usr/src, with /usr/src/linux as a symlink to the currently installed kernel's source directory.

First, we will download the full source to kernel-2.4.12 using wget (apt-get install wget, if you haven't installed it). As root, type::

    cd /usr/src/
    wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.12.tar.gz

Alan Cox kernels are distributed as patches that have to be applied against the specific Linus kernel for which they are meant. So, let's download the -ac3 patch to kernel-2.4.12. While still in the /usr/src directory, enter:

    wget http://www.kernel.org/pub/linux/kernel/people/alan/linux-2.4/2.4.12/patch-2.4.12-ac3.gz 
Preparing the Kernel Source

Now that the 2.4.12 kernel and -ac3 patch sources have been downloaded, extract them as follows, again from the /usr/src directory.

tar zxvf linux-2.4.12.tar.gz

To apply the -ac3 patch, enter

 cd linux
 gzip -dc ../patch-2.4.12-ac3.gz | patch -p1

And then fix up the source directory permissions, the name and set up the symlink:

   
 cd ..
 chown -R root:src linux
 mv linux linux-2.4.12-ac3
 ln -s linux-2.4.12-ac3 linux

Your /usr/src directory should now appear as follows:

matrix:/usr/src# cd /usr/src/
matrix:/usr/src# ls -alF
total 30516
drwxrwsr-x    4 root     src          4096 Oct 21 20:32 ./
drwxr-xr-x   16 root     root         4096 Oct 18 23:19 ../
lrwxrwxrwx    1 root     src            16 Oct 21 20:32 linux -> linux-2.4.12-ac3/
drwxr-xr-x   14 root     src          4096 Oct 21 20:29 linux-2.4.12-ac3/
-rw-r--r--    1 root     src      28459381 Oct 11 02:59 linux-2.4.12.tar.gz
-rw-r--r--    1 root     src       2729744 Oct 15 17:45 patch-2.4.12-ac3.gz
drwxr-xr-x    7 root     root         4096 Oct 19 19:31 rpm/
Installing Packages Necessary to Configure and Build Kernels

The following packages are needed to build kernels on Debian:

  • make, gcc, libc6-dev (pretty obvious)

  • kernel-package (to build kernels the Debian way)

  • bin86

  • tk-dev (needed for the xconfig GUI kernel configuration)

  • libncurses5-dev (needed for the menuconfig curses-based kernel configuration)

If you like to configure kernels using the GUI xconfig method, you don't need to install the libncurses5-dev packages. Likewise, if you like to configure kernels using the menuconfig method, you don't need to the tk-dev package.

Even though I like to configure kernels using the GUI kernel configuration tool, I will install libncurses5-dev just in case:

apt-get install make gcc libc6-dev kernel-package bin86 tk-dev libncurses5-dev

Apt will take care of installing all required dependencies for the above packages.

Configuring the Kernel

Now that we have the kernel sources extracted and prepped and have installed all tools required for kernel configuration and building, let's start with the kernel configuration.

I am going to launch the GUI kernel configuration tool, invoked with "make xconfig". Instead of going through all the kernel options one by one, I will discuss only the major ones needed for the C800 laptop.

I am assuming that you have logged in through an X display manager, either as a non-root user or as root, and are invoking these commands from an X terminal emulator program like xterm or rxvt. You have to be in order to run the GUI kernel configuration program. Without starting and logging into an X session, you will only be able to use the cursor-based menuconfig configuration tool.

If you logged into X as a non-root user and used su to get to root from a program like xterm or rxvt, you will not have permissions to connect to the X server and will get errors like:

    Xlib: connection to ":0.0" refused by server
    Xlib: Client is not authorized to connect to Server
    Application initialization failed: couldn't connect to display ":0.0"

when trying to start or launch GUI programs. To solve this problem, type xauth merge ~user/.Xauthority.

To launch the GUI kernel configuration tool, type (as root):

    cd  /usr/src/linux
    make xconfig

Once the tk-based kernel configuration GUI appears, we will select the following kernel options (for kernel options not explicitly mentioned below, it is okay to accept the default values):

  • Code maturity level options

    • Prompt for development and/or incomplete code/drivers: Y

  • Processor type and features

    • Pentium-III/Celeron(Coppermine) Processor family

    • MTRR (Memory Type Range Register) support: Y

    • Symmetric multi-processing support: N

  • General setup

    • Support for hot-pluggable devices: N

    • BSD Process Accounting: Y

    • Power Management support: Y

      • Advanced Power Management BIOS support: Y

      • RTC stores time in GMT: Y

  • Plug and Play configuration

    • Plug and Play support: Y

    • ISA Plug and Play support: N

    • PNPBIOS support (EXPERIMENTAL): N

  • ATA/IDE/MFM/RLL support: Y

  • IDE, ATA and ATAPI Block devices

    • CMD640 chipset bugfix/support: N

    • RZ1000 chipset bugfix/support: N

    • Generic PCI IDE chipset support: Y

    • Sharing PCI IDE interrupts support: Y

    • Generic PCI bus-master DMA support: Y

    • Use PCI DMA by default when available: Y

    • Intel PIIXn chipsets support: Y

    • PIIXn Tuning support: Y

  • SCSI support: N

  • Ethernet(10 or 100Mbit): Y

    • 3Com cards: Y

    • 3c590/3c900 series (592/595/597) "Vortex/Boomerang" support: Y

  • File systems

    • Ext3 journalling file system support (EXPERIMENTAL): Y

  • Console drivers

    • VGA text console: Y

    • Video mode selection support: Y

    • MDA text console (dual-headed)(EXPERIMENTAL): N

  • Frame-buffer support

    • Support for frame buffer devices (EXPERIMENTAL): Y

    • VESA VGA graphics console: Y

  • Sound

    • Sound card support: Y

    • ESS Maestro3/Allegro driver (EXPERIMENTAL): Y

If you intend to use PCMCIA devices on your laptop, you must select Y at Support for hot-pluggable devices. The Ethernet options have been enabled for the C800's internal miniPCI 10/100 NIC.

With all those options selected (whew!), select "Save and Exit" to exit the GUI configuration tool and write out the kernel configuration file.

Compiling the Kernel

Once you have exited the GUI kernel configuration tool, you will notice the kernel configuration file, .config, in /usr/src/linux.

Debian's "kernel-package" package provides a script, make-kpkg, that makes building kernels very easy. Once a kernel configuration file (.config) has been created, this script can be invoked with the appropriate arguments. It will build the binary kernel image and all modules as selected in the configuration. Once completed, the script w ill generate a Debian package (.deb) containing all the related binaries, files, etc. for the newly compiled kernel.

This kernel .deb package can then be installed using the dpkg command. When this Debian kernel package is being installed, all necessary symlinks in / and /boot will automatically be setup for the new kernel. In addition, all modules (as selected in the kernel configuration) will be automatically installed in /lib/modules/<kernel version>

Using Debian's make-kpkg greatly simplifies kernel building and installation and automates most of the intermediate tasks that normally have to be performed when compiling and installing kernels the traditional way (i.e., make dep && make clean && make bzImage && make modules && make modules_install).

So, let's begin with the kernel compilation by typing (as root in the /usr/src/linux directory):

    make-kpkg clean
    make-kpkg --revision=786:MatrixCustom2.4.12ac3 kernel_image

The argument supplied to make-kpkg via the "--revision" argument is a custom Debian revision number for the Debian kernel package that will be generated, based on my hostname and the kernel version that I am compiling. The number, 786, that the revision string starts out with is an Epoch. Read the make-kpkg and the kernel-pkg.conf man pages, along with the documentation in /usr/doc/kernel-package/, for more information on Debian's kernel-package utilities for building kernels.

Once the kernel build has completed successfully, a .deb Debian kernel package will have been generated in /usr/src:

matrix:/usr/src/linux# ls -alF ../
total 31532
drwxrwsr-x    4 root     src          4096 Oct 21 22:34 ./
drwxr-xr-x   16 root     root         4096 Oct 18 23:19 ../
-rw-r--r--    1 root     src       1036082 Oct 21 22:34 kernel-image-2.4.12-ac3_MatrixCustom2.4.12ac3_i386.deb
lrwxrwxrwx    1 root     src            16 Oct 21 20:32 linux -> linux-2.4.12-ac3/
drwxr-xr-x   15 root     src          4096 Oct 21 22:34 linux-2.4.12-ac3/
-rw-r--r--    1 root     src      28459381 Oct 11 02:59 linux-2.4.12.tar.gz
-rw-r--r--    1 root     src       2729744 Oct 15 17:45 patch-2.4.12-ac3.gz
drwxr-xr-x    7 root     root         4096 Oct 19 19:31 rpm/

Note that the Debian kernel package generated is named based on the revision argument passed to make-kpkg above.

We are now ready to install the kernel package. Since this kernel package is simply a Debian package, it can be installed using the dpkg command as follows (in /usr/src/linux):

dpkg -i../kernel-image-2.4.12-ac3_MatrixCustom2.4.12ac3_i386.deb

As the kernel package is being installed, you will be asked a few questions:

  1. Would you like to create a boot floppy now?

  2. Install a boot block using the existing /etc/lilo.conf?

If you answer "No" to question (1), you will have to answer "Yes" to question (2); otherwise you have no way to boot the system using the new kernel.

If you answer "Yes" to question (1), you will have a boot floppy which can be used to boot your system using the new kernel if you choose to answer "No" to question (2).

Of course, if you answer "Yes" to both questions you can boot your system using the new kernel by either using the boot floppy created or using the hard-disk. In this case, I will answer "Yes" to both questions.

Once the kernel package has been installed, we need to reboot the system. To reboot, type (as root) reboot.

Depending on what you answered to questions (1) and (2) above, you may or may not want to leave the boot floppy just created in the floppy drive. I will boot from the hard disk.

Once the system has booted and started, you will want to log in to X as you had earlier.

As the system boots up, you should notice different bootup messages from the kernel. That is to be expected. Once you have logged in, take a look at the output of the dmesg command.

For starters, you should notice that your 2.4 kernel has recognized the IDE hard-disk in the laptop at the correct ATA/UDMA speed:

hda: 62506080 sectors (32003 MB) w/1874KiB Cache, CHS=3890/255/63, UDMA(66)

Since my laptop's HD (/dev/hda) is an UDMA66 model, we see that it has been 'recognized' by the kernel's IDE driver appropriately.

The laptop's internal 3Com miniPCI 10/100 NIC has been found and initialized thusly:

3c59x: Donald Becker and others. www.scyld.com/network/vortex.html
02:06.0: 3Com PCI 3c556 Laptop Tornado at 0xe800. Vers LK1.1.16

The sound card in the laptop has also been found and initialized:

es1371: version v0.30 time 23:32:50 Oct 21 2001
maestro3: version 1.22 built at 23:32:53 Oct 21 2001
PCI: Found IRQ 5 for device 02:03.0
maestro3: Configuring ESS Maestro3(i) found at IO 0xEC00 IRQ 5
maestro3:  subvendor id: 0x00a31028
ac97_codec: AC97 Audio codec, id: 0x8384:0x7609 (SigmaTel STAC9721/23)
Setting up Audio

For each user who needs to access the sound card on this laptop, add the user-id to the "audio" group by editing the /etc/group file.

To allow a user to play audio CDs using the laptop's DVD-ROM (or CD-ROM) drive, first add that user to the "cdrom" group by editing the /etc/group file. Then, type (as root):

   
 chgrp cdrom /dev/hdb
    ln -s /dev/hdb /dev/cdrom
    chgrp cdrom /dev/cdrom
Setting up a Framebuffer Console

To setup a framebuffer console, reboot the system and pass the following parameter to Linux at boot time:

vga=XYZ

where XYZ is a decimal number corresponding to one of the kernel mode numbers listed in /usr/src/linux/Documentation/fb/vesafb.txt. In my case, I have chosen vga=792 which corresponds to a 1024 x 768 framebuffer console at 24bpp color depth. This is indicated thusly in the kernel's bootup messages:

vesafb: framebuffer at 0xe8000000, mapped to 0xd0800000, size 32768k
vesafb: mode is 1024x768x24, linelength=3072, pages=13
vesafb: protected mode interface info at c000:60ae
vesafb: scrolling: redraw
vesafb: directcolor: size=0:8:8:8, shift=0:16:8:0
Console: switching to colour frame buffer device 128x48
fb0: VESA VGA frame buffer device

Once you are satisfied with your framebuffer console setting, you can make it permanent by editing /etc/lilo.conf and changing the line that reads:

vga=normal

to

vga=792

or whatever framebuffer console mode you have selected. Make sure to run /sbin/lilo -v to update LILO's config, and also read the VESA fb documentation (/usr/src/linux/Documentation/fb/vesafb.txt) for more details.

Converting Ext2 Partitions to Ext3

You have probably heard of ext3 by now. It is one of a number of journalling (or journalled) filesystems available for Linux. I am not going to go into details of ext3's design or implementation (but will instead provide Resources for more reading on it), but I will say that one of the big advantages of ext3 is backwards compatibility with ext2. This is due to the fact that ext3 makes use of a journal for each partition in order to keep track of filesystem transactions, while retaining the ext2 filesystem format. This allows for easy migration of hard-disk partitions from ext2 to ext3, as only the journal has to be created to convert an ext2 partition to ext3. No reformatting is required.

Normally, ext3 is distributed as a specific patch against a Linus kernel since it is not currently included in the Linus 2.4 kernels. However, ext3 has been integrated and included in the Alan Cox kernels. Earlier in this article, we had already selected ext3 filesystem support in the kernel configuration, so our kernel is ready.

Andrew Morton (one of the ext3 maintainers) has written an excellent document (see Resources) discussing all the steps needed to use ext3 with 2.4 kernels. Instead of rehashing details from that page, I will quickly go over the steps that you have to take to complete the conversion from ext2 to ext3:

First, make sure you are running the appropriate version of the e2fsprogs, mount and util-linux packages:

e2fsprogs-1.25-1    (check by typing e2fsck -V)
mount-2.11l-2       (check by typing mount -V)
util-linux-2.11l-2  (check by typing mkfs -V)

The above versions of those packages (from Debian unstable) are just fine.

Second, create journals for each partition you want to convert from ext2 to ext3. I am going to convert all my partitions to ext2 in one shot:

matrix:~# for i in /dev/hda1 /dev/hda6 /dev/hda7 /dev/hda8 /dev/hda9 /dev/hda10;
> do                    
> /sbin/tune2fs -j $i
> done

Third, edit /etc/fstab to change the filesystem type for those partitions from ext2 to ext3. The latest version of mount (mount-2.11l) recognises ext3 and can automatically choose the ext3 filesystem type, depending on whether or not the current kernel has support for ext3. If the filesystem type for a partition is listed as "auto" in /etc/fstab, the latest version of mount will autodetect the type of the filesystem and mount it appropriately. So, I will change the fs types for /, /tmp, /var, /home, /usr/ and /usr/local to "auto" in /etc/fstab.

Fourth, reboot the system for the changes to take effect. Note that a reboot is not really required for mount points like /tmp, /var, /home, etc. as the system can be switched to runlevel 1 and these non-root mount points can be remounted as ext3. Rebooting is required only to mount the root filesystem (/) as ext3.

When Linux starts, you should see messages indicating that ext3 filesystem partitions are being mounted. Congratulations, you have now successfully converted your ext2 partitions to ext3.

Resources

Ext3 home page

"Using the ext3 filesystem in 2.4 kernels", by Andrew Morton

A good article explaining the benefits of using ext3

Salman Ahmed is a Toronto-based independent consultant specializing in object-oriented software development, and all things Linux.

Load Disqus comments

Firstwave Cloud