|
I recently got a shiny
new IBM T42 laptop, one of my main
criteria when choosing a laptop was that it
would be Linux friendly. This is
probably one of the most friendly laptops
around, below I outline how I went
about installing Debian on the laptop and
getting everything up and running.
PDF version
OpenOffice Format
Installing Linux (Debian Sarge) on an
IBM T42 Laptop
1.
Introduction
1.1
Purpose
The purpose of this document is to outline
the steps I took to get Debian up and
running on my IBM T42 laptop. For the Linux
savvy this document will not offer any new
juicy insights, it is meant to allow people
new to the Linux world to be able to get
their system up and running.
I would like to also heard feedback from
people if there are any inconsistencies or
mistakes in the following sections, or if
there are any areas people would like to
expand upon.
1.2 IBM
T42
I had my last laptop for over seven years.
It was a Toshiba Satellite a really great
piece of hardware, I still use it today
(mainly because it has a serial port and a
floppy disk, which are both useful when
trying to create a basic embedded system),
but the time had come to upgrade, I was
running Windows 2000 on 32MB of RAM, a
233MHz processor and it was not too happy.
The IBM ThinkPad had caught my attention
because the service personnel at my place of
work use them. These laptops get bashed,
dropped and generally abused and they still
all function, plus I really like the look
and feel of the laptops and they come with a
really nice keyboard. I was mainly looking
for a laptop that was sturdy, fast and
relatively lightweight.
The IBM T42 covered most of those points,
although not the lightest ThinkPad, it is a
great combination of speed and portability.
It also comes with a pretty hefty price tag,
you won't get much change from $3000 if you
add a few bells and whistles, but in my
opinion it is really worth it.
2.
Laptop Specification:
Model: IBM ThinkPad - T42
Processor: Intel Pentium M 1.8GHz
RAM: 768MB
Hard Disk: 60GB
Network Card: Atheros PCI based 802.11abg,
Intel Gigabit Ethernet controller
Graphics Card: ATI Technologies Inc RV350
[Mobility Radeon 9600 M10]
Other: DVD / CD-RW
Screen: 14.1” 1400x1050 TFT
3.
Debian Installation
3.1 About Debian
Debian (www.debian.org)
is one of a number of Linux Distributions.
The job of a distribution is to integrate
and provide many features and Linux tools in
one place. A distribution possibly provides
a nice install tool, although this is
definitely not always the case and the
option to configure what components you want
to install. There are many distros out there
and depending on your level of knowledge and
confidence, you should look around until you
find one that you feel comfortable with,
www.distrowatch.com
is a good place to start.
With Debian there are three main branches of
code, at the time of writing these were
Woody, Sarge and Experimental. Woody is a
codename for the current most stable
release. Sarge is the testing branch and
contains newer versions of common tools,
actually just as I was writing this Sarge
has now been officially released as the
current stable version – after over three
years in development. This is the version I
will be using throughout the installation
process.
3.2 Getting the
installation files
I chose to install Sarge, I did this from a
bootable CD which I created. There are a
number of ISO images you can download then
burn onto CD (http://www.debian.org/CD/http-ftp/).
For a basic install like the one I did you
just need Sarge-1, this has all of the core
libraries, the other ISO images are just
needed if you want to install extra
programs. I like to have a relatively light
installation then install packages as I
require them.
3.3 Installation
steps
These are pretty self explanatory the only
thing I will mention here is the
Partitioning step. This is one of the more
important steps in the process and possibly
the most daunting for a Linux newbie who is
use to only one big partition, normally
provided by an MS Windows installation.
The Debian installation will stop and ask
you about partitioning information. It is
good practice to separate your hard disk
into a number of smaller partitions, the
main reason being that if one of your
partitions becomes corrupted the others will
hopefully remain intact.
I created four partitions in my
installation:
/boot – 30MB (holds boot related files such
as the GRUB boot loader)
/ - 10GB (the location of the root file
system)
/home – 25GB (contains all user data, such
as personal user files)
swap – 600MB (acts as a region to store data
swapped out from main memory)
3.4 Windows
anyone?
The above partitions are roughly 40GB of
space, but the laptop came with a 60GB
drive, so where is the other 20GB? Well
there is a 4GB partition on the laptop which
can be accessed from the BIOS and contains
an image of the hard disk as it shipped
incase you need to recover your computer at
any time. For now I have left that in place,
if I run out of space I will remove it.
I also left my windows partition as a 16GB
partition. Initially when the laptop shipped
the Windows partition was 60GB, taking up
all the space. To resize my drive I actually
install a copy of Linux Xandros (www.xandros.com)
which will resize you Windows partition
whilst installing itself. I did this because
I was interested to try out this distro. I
found it to be a nice useable system,
definitely good for Linux beginners and it
is based upon Debian, but ultimately I
prefer the vanilla Debian system. If you
don't want to install Xandros, you can
resize you Windows partition using something
like Partition Magic or you can use GNU
Parted (http://www.gnu.org/software/parted).
If you are feeling very adventurous then you
might even delete your Windows partition :-)
I kept the windows partition because I like
to use iTunes, and at the moment I don't
think it is possible to use it on Linux.
Also I like to have a backup plan incase I
ever need to use a Windows based piece of
software, plus I already paid for the
Windows license when I bought the laptop, so
I don't really feel like erasing a hundred
odd dollars for nothing :-)
4. System
Configuration
4.1 X
Windows Resolution configuration
Hopefully the rest of the installation is
pretty self-explanatory and installed
correctly. The first step after installing
Debian was to get the X Windows system to
recognize my shiny new 1400x1050 screen
resolution.
This was done by modifying the
/etc/X11/XF86Config-4 file, to include the
following inside the screen section:
Section "Screen"
Identifier "Default Screen"
Device "Generic Video Card"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1400x1050" "800x600"
EndSubSection
The 1400x1050 screen on the IBM T42 is
absolutely gorgeous and I would highly
recommend anyone who is purchasing a new
ThinkPad to upgrade to this option, it is
definitely worth it.
4.2
Installing/updating software packages
Debian uses APT, Advanced Package Manager,
to install and manage new software. The
system keeps a local database on your
computer of all the currently installed
packages, easily allowing you to install,
upgrade or uninstall any packages for the
Debian distribution. The neat thing about
APT is that it also knows about any
dependencies a package requires, and will
install those so that you don't end up with
a broken install.
The first thing you will have to do in your
new install is to tell APT where to look for
packages. This is done by modifying the
/etc/apt/source.list file, to include at
least the following lines:
deb
http://http.us.debian.org/debian
sarge main
deb
http://security.debian.org/
testing/updates main contrib
APT stores a local database on the hard disk
which it refers to for all package
information, any time after changing the
sources.list file you will need to update
these local databases. This can be done
using the following command:
apt-get update
Next we want to upgrade all of our installed
packages, this can be done by typing the
command:
apt-get upgrade
Once that is complete, you can use APT to
install new software on your Debian
distribution. An example of how easy APT is
to use, if you want to install Firefox (www.firefox.com)
because it is your preferred web browser,
you would just type:
apt-get install mozilla-firefox
APT will download all the required files
plus install any other packages that Firefox
depends upon which are not already installed
– SIMPLE and sweet.
4.3 Compiling the
latest kernel
The main reason you will need to compile the
Linux kernel is to get the required files
for the MadWifi network driver (see the next
chapter), but also compiling the latest
kernel code allows you to install updates
and also tailor your kernel more
specifically to the exact hardware you are
using.
You can obtain the latest kernel source from
www.kernel.org.
Unpack this somewhere into your home
directory, the kernel can be configured and
compiled completely as a normal user, you
only need to have root privileges when you
need to install the kernel.
Next you will need to make sure you have the
libncurses5-dev package installed on your
system, a quick:
dpkg -l | grep libncurses5-dev
will display if you already have the package
installed or not, if not just run:
apt-get install libncurses5-dev
This package is required to show the kernel
menu based configuration. If you just
unpacked the latest source code then you are
ready to configure, otherwise run:
make clean
to make
sure that you remove any files from a
previous compile which may cause a build to
fail. To configure the kernel, change
to the directory where you extracted the
kernel source to and type:
make menuconfig
You will see a menu screen appear, here is
where you need to choose which options to
install. For this screen you will need to go
through all of the various options, either
checking to build the option straight into
the kernel or choosing to build the option a
kernel module. A kernel module can be
dynamically loaded into the kernel as needed
whilst the kernel is running, this is really
the preferred method.
Once you have defined all your kernel config
options and saved your configuration, you
may possibly need to modify some variables
in the Makefile. If you open the Makefile
you will see something like the following:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 11
EXTRAVERSION = 10
The numbers you see many be different
depending on what version of the kernel you
downloaded. Once the kernel is built it will
be installed into the following location:
/lib/modules/VERSION.PATHLEVEL.SUBLEVEL.EXTRAVERSION
so you can
change the value of the Extraversion field
to make the build unique so that you do not
install over the top of an existing kernel
install. After you have chosen all of
the configuration options, type the
following command to build the kernel image:
make bzImage
This takes about 5 minutes on my 1.8GHz
Pentium M laptop. This will build the kernel
image. If you get any errors during
compilation you will have to go back to the
kernel menu screen and include other options
which are missing and causing the kernel to
fail during compilation. This may take a few
iterations of trial and error to get
everything you need.
Once the image builds we then need to build
all of the kernel modules, this is done by
entering the command:
make modules
Finally to install the modules into the
correct place we need to issue the following
command:
make modules_install
This will move all of the modules and
various header files (as required by
MadWifi, into the directory which was
specified above).
A final stage you may need to perform is to
create an initial RAM disk. Basically when
the kernel boots up it needs to have all of
the correct drivers available to it to be
able to read the root file system, now if
the modules that allow it to read the root
fs were not install directly into the kernel
then there is a problem because they must be
on the root fs but they are needed to read
the root fs – see the problem. The initial
RAM disk is used to load all of the required
modules into RAM so that they can be
accessed by the kernel to enable it to load
the root fs. To make a ramdisk you need to
enter the following command:
mkinitrd -o/boot/initrd-<kernel_version>.img
<kernel_version>
i.e. mkinitrd
-o/boot/initrd-2.6.11.10.img
2.6.11.10
This will create the ram disk and move it
into the boot directory. It is a good idea
to include the kernel version in the name of
the ramdisk image file so that you do not
overwrite any existing files.
Next we need to move the kernel image into
the boot directory, from inside the
extracted Linux directory type:
cp /arch/i386/boot/bzImage
/boot/bzImage-<kernel_version>
4.4 Configuring
GRUB (Bootloader)
The final stage of the setup procedure is to
configure the bootloader to use the new
kernel image. Debian installs GRUB by
default, which is a very capable bootloader.
You need to add an entry into the GRUB
config file to tell it to look for the new
kernel, this can be done by modifying the
/boot/grub/menu.lst file to include
statements like the following:
title
2.6.11.10
kernel (hd0,6)/bzImage-2.6.11.10
root=/dev/hda8
initrd (hd0,6)/initrd-2.6.11.10.img
savedefaults
boot
You would obviously change the names of the
files and the drive names. GRUB's naming
convention is to use hd0 to specify the
master hard disk on the first controller,
then moving up to hd1, hd2 etc. Partitions
are numbered starting from zero.
To figure out what you need to enter into
the GRUB config file, type:
mount
at the terminal and search for an entry like
the following:
/dev/hda7 on /boot type ext3 (rw)
this tells us that the boot directory is
mounted onto hda7, we care about this
because this is where we copied our new
kernel and ramdisk image to. This translates
to (hd0,6) in grub terminology, obviously if
you did not create a seperate partition for
your boot directory, then you will use the
root partition as your starting point.
4.5 Running as
root – BE WARNED
There are a lot of administrative tasks that
require you to log into the system as root
(or at a safer level by executing sudo). Be
warned though when logged in as root you can
cause some serious damage, I should know
because I did it recently. I basically
logged in as root to change some config
files in the system, I then changed to be
inside the /lib directory since I was
copying some lib files to an embedded
project I was creating. The next command I
typed was to delete a bunch of files on the
floppy drive, or so I thought, I typed:
rm * /mnt/floppy/lib
when what I actually meant:
rm /mnt/floppy/lib/*
well I managed to delete the whole contents
of the lib directory, not a pretty site,
things started going downhill from that
point on very quickly. Fortunately enough
this was a pretty new laptop so I did not
have much data so I decided to reformat the
whole drive and reinstall Linux again (there
were a couple of things I wanted to change
so this was a good opportunity to do that).
Another critical area this points to is that
you should always make backups – I lost a
lot of work twice because I didn't make
backups, well the normal saying is “Once
bitten, twice shy”, well I was “Once bitten,
twice – doh not again, third time no way” so
now I make sure I have a backup plan to
regularly copy all of my important files,
and you should too, don't think it won't
happen to you because it most likely will at
some time.
4.6 Network Card
Configuration
The network card install on my IBM T42 is an
Atheros 5212 802.11abg card. A really good
open source driver for this card is MadWifi.
The main project site can be found at
sourceforge:
http://sourceforge.net/projects/madwifi/.
A really excellent Q&A page about the driver
is provided and maintained on a website by
Matt Foster at
http://www.mattfoster.clara.co.uk/madwifi-faq.htm.
Some people do not like MadWifi because of
HAL – Hardware Abstraction Layer. This is a
closed source binary API that allows user
software to interact with the hardware. The
main reason it is closed source is because
people are not suppose to be able to play
with the power of the signal from their card
or the frequency, so the driver is closed, I
believe this is to comply with FCC
regulations. If you can't live with this
then you will have to find another driver, I
do not have any suggestions here.
Sources from the CVS repository are backed
up daily to:
http://madwifi.otaku42.de/
in a tared gz or bz2 format, for those who
don't want to get the source from CVS.
4.6.1 Required
files for building the Madwifi driver
The driver requires certain makefiles and
header files from the kernel that is running
on your computer, in order to successfully
compile the driver. It is for this reason
that you need to build your own kernel, as
described in the previous chapter, please
make sure you have done this too otherwise
you will not be able to build this module.
Once you have downloaded the code, extracted
it and run the following commands to compile
and install the driver:
make
make install
Once the driver has built, you need to load
the module into the kernel, this is done by
the command:
modprobe ath_pci
If everything is successful, you should see
something like the following when you type
lsmod (which lists all of the currently
loaded kernel modules):
ath_pci 54176 0
ath_rate_onoe 7048 1 ath_pci
wlan 108892 4
wlan_wep,ath_pci,ath_rate_onoe
ath_hal 146896 2 ath_pci
4.6.2 Configuring
the driver for use
An excellent page on how to configure the
MadWifi driver on a Debian system is
detailed at:
http://madwifiwiki.thewebhost.de/wiki/Ath0OnDebian.
The basic idea is that you need to add an
entry into the /etc/network/interfaces
file to enable the driver to be activated
(as specified in the previous link). I
entered the following into my file (I am
connecting to an 802.11b wireless router,
using DHCP. Your settings may be different
if you are using a different configuration):
iface ath0 inet dhcp
pre-up /sbin/iwpriv ath0 mode 2
pre-up /sbin/iwconfig ath0 essid
"XXXXXXX" mode managed rate 11Mb key
YYYYYYYYYY enc on
Obviously you will need to replace the
XXXXXXX and YYYYYYYY with the SSID of your
wireless base station and the YYYYYYYYY is
the WEP key.
I am using an 802.11b base station, which is
why you need the line:
“pre-up
/sbin/iwpriv ath0 mode 2”, mode 1 -> a,
mode 2 -> b and mode 3 -> g
You will need to change this to fit your
hardware. Finally after you have modified
your interfaces file you need to run the
command:
ifup ath0
to initialise the interface (this has to be
done either as root or using the sudo
command). I had noticed that I needed to
take down my eth0 interface (i.e. ifdown
eth0) before bringing up my ath0 interface,
otherwise I could not connect to my wireless
base station, I am not sure if this is a
normal operation for Linux? Maybe someone
can shed some light on this for me.
5. TODO
When I get some more free time I would like
to optimize my Linux configuration for
maximum speed and efficiency. With my
current configuration I am pretty sure I
have not got the best setup for the
hardware, i.e. maximizing battery life etc.
If anyone knows of any good software that
allows you to optimize or benchmark your
Linux system I would be pleased to hear from
you at
mark@markdawson.org
6.
Conclusion
The IBM ThinkPad series are serious pieces
of hardware. There are extremely well
manufactured and fell tough and sturdy
during use. Support from Linux for the
installed hardware is excellent and this has
to be one of the top choices for any Linux
user who is searching for a new laptop.
Although the laptops are pricey I am more
than happy with my new purchase, especially
getting the 1400x1050 resolution, which
makes the screen a joy to look at.
Mark Dawson
mark@markdawson.org
06-06-05
|