Linux On Laptops

Linux on Dell Latitude D610 using Slackware

Philosophy

I installed Slackware 10.2 with the latest available kernel from
www.kernel.org which was 2.6.14.3.

It is much easier to deal with the small headache of compiling and
configuring the latest kernel then the headache of getting new hardware to
work on an old kernel.  

I also find it is best to be minimalist with your kernel configuration. Turn
off any modules for hardware you do not have (which is most of them). This
makes the kernel compile time very short, so if you miss one, you can just
compile it very quickly when you need it.  This sort of minimalist approach
avoids conflicts and makes troubleshooting much easier.  

One trick along these lines is to boot first to the boiler-plate kernel that
comes with your distribution, then save the output of "lsmod" somewhere.
Then, when you configure your new kernel, you'll know exactly what modules
you need.  

This approach tends to make modules less useful, when I know I have
certain hardware I just compile it into the kernel.

I find it easiest to ignore the network configuration scripts that come with
most distributions.  They are usually a lot of headache to get working for a
laptop which likely has many different configurations.  Although you can
configure "schemes" for this case, I find the setup of the distributions
I've tried to be very cumbersome, non-standard and unreliable.  It is far
easier to just have your own scripts which set things up appropriately
depending on the present situation.

Various configuration files and interesting output:

You can find various configuration files that I use and command output here.

Install Slackware


If you are just upgrading, you don't need a cd.  Just put an entry like this
into lilo.conf:

image    = /boot/vmlinuz-install
  initrd = /boot/initrd-install.img
  root   = /dev/ram0
  label  = linux-install
  read-write
	
where vmlinuz-install and initrd-install.gz are the installation kernel and
initial ram disk.  Run lilo.  Then put the installation media and latest
kernel from www.kernel.org in a non-root portion of your hard-disk.  Then
you can just boot linux_install and go.  No media needed!  You can pre-mount
the partition with the installation files at /mymnt if you like.  

This trick works for other distributions as well.  It's also handy to be
able to boot to ramdisk without finding a cd or floppy on a rainy day.

Don't waste time worrying about X or the network or any ammenities yet.
This is all wasted time until you've installed a recent kernel.  You can
setup X with the setup utilities but don't worry if it doesn't work.   Just
setup the loopback device for the network for now.

If someday after installation, you are wishing to rerun one of the slackware
installation scripts, just run "pkgtool" and select "setup".

Make sure you have a text editor that can work outside of X.  I use "jed"
which has lightweight emacs emulation.  There's also emacs without X.

Upgrade kernel

Do an lsmod and save the output.

Install the kernel source in /usr/src/ and link /usr/src/linux to it.

Cd to /usr/src/linux, and now just do "make mrproper", "make clean",
and you are ready to configure your custom kernel.

You can start with my .config file saved to /usr/src/linux/.config 
which should get you mostly there.  Just touch it up to your liking,
or at least browse though the options, with "make menuconfig".

Another approach is to use "make oldconfig" from the .config file that came
with your old kernel.  But this will have many many modules you don't need
enabled, so I highly recommend following this with "make menuconfig" and
turning unneeded things off ruthlessly.  This is good for the soul, trust me!

Now compile and install the new kernel and modules: "make", "make
modules_install", and "make install".  Edit lilo.conf to your liking, making
absolutely sure you have a way to boot to the original kernel from the
installation, which I call "linux_safe".  This way, if anything goes wrong
with you new kernel, you can boot to linux_safe and fix it!

Get the network up

Now setup your network.  First, get the ethernet working.

I have the following ethernet controller, which I determined from running
"lspci":

02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)

This works out of the box with the tg3 module:

#
# Ethernet (1000 Mbit)
#
# CONFIG_ACENIC is not set
# CONFIG_DL2K is not set
# CONFIG_E1000 is not set
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_R8169 is not set
# CONFIG_SIS190 is not set
# CONFIG_SKGE is not set
# CONFIG_SK98LIN is not set
CONFIG_TIGON3=y
# CONFIG_BNX2 is not set

Since I don't use ethernet by default, I just have a script to set it up
when I need it that I call wired.csh, which assumes you are using dhcp (very
likely for a laptop!):

#! /bin/tcsh

/sbin/dhcpcd -k
rm -f /etc/dhcpc/dhcpcd-eth0.pid
/sbin/dhcpcd -d eth0

That should do it!  Make sure you can ping somewhere, and go check your
e-mail!

Get the wireless network up


Next get wireless up and running.

I have the following wireless network controller, determined by running
"lspci":

03:03.0 Network controller: Intel Corporation PRO/Wireless 2200BG (rev 05)

This module will work out of the box for some future kernel, but for now you will
need the latest ipw2200 module for this to work.  

Just download it from http://ipw2200.sourceforge.net/ and follow the
instructions in README.ipw.

The instructions in README.ipw2200 are nearly perfect. Compile two modules:
ieee80211 and ipw2200.  Put the firmware in /lib/firmware/.

The only pain is that both modules will need to be recompiled and reinstalled
every time the kernel is recompiled.

After following them, the usual iwconfig commands work.

I then use another script to set up my wireless network connection.  You
should tweak this to include the encryption key for your network, or ommit it
if you don't have encryption (gasp!).

/sbin/dhcpcd -k
rm -f /etc/dhcpc/dhcpcd-eth1.pid
/sbin/iwconfig eth1 essid any
/sbin/iwconfig eth1 key "1234-4321-12"
/sbin/dhcpcd -d eth1
/usr/krb-lite/config_kerberos.pl

Get X working


My Dell Latitute D610 uses the Intel Graphics Media Accelerator 900 video
card:

00:02.1 Display controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)

This is a bit of a pain with the D610 as the BIOS has a bug in it which
makes it appear to not support the 1400x1050 screen resolution.  Nice work
Dell!

Fortunately, other people have worked around this.

  -> use the latest i810 driver for X (i810_drv.o).

     There was a precompiled version of this driver for the version of X I
     am running.  You can compile it yourself if needed, but I just put      
     this into /usr/X11/lib/modules/drivers/.
     
  -> Install the 915Resolution tool, and call it every time you boot, i.e.
     in rc.local I have:

        915resolution 3c 1400 1050

     This sets the 1400 by 1050 resolution in the BIOS.
     
     You can check that it worked by listing the modes:
        
	915resolution -l

  -> Install the synaptics driver.
	   
  -> Use the screen settings as detailed in my xorg.conf file.

Now X should work just fine!

Get sound working


The hardest part about configuring sound these days is finding a simple raw
audio file for the simplest first test.  I keep an old raw file
enterpri.raw around for this specific purpose.

I prefer to just figure out what sound device I have and then compile it
into the kernel.  From lspci:

00:1e.2 Multimedia audio controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller (rev 03)

So I have the following kernel configuration:

#
# Advanced Linux Sound Architecture
#
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
# CONFIG_SND_SEQUENCER is not set
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_RTCTIMER=y
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set

#
# Generic devices
#
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_MPU401 is not set
CONFIG_SND_AC97_CODEC=y
CONFIG_SND_AC97_BUS=y

#
# PCI devices
#
# ...
CONFIG_SND_INTEL8X0=y

Now compile and reboot.  Check that the driver finds the hardware:

   dmesg | grep -C 1 ALSA

See something like:

intel8x0: clocking to 48000
ALSA device list:
  #0: Intel ICH6 with STAC9750,51 at 0xdfebfe00, irq 11
  
Then set the volume and pcm settings, query them, and test:

   aumix -v 70 -w 70
   aumix -v q -w q
   cat enterpri.raw > /dev/dsp

Captains Log, Star-Date today:  sound is working.

I turn the audio volume off and headphone volume on by default in rc.local:

aumix -v 0 -w 80 -W 80

You can adjust this using aumix interactively.

Get ACPI working


ACPI works just fine for:

  - battery state, etc.
  - CPU frequency scaling
  - suspend to RAM

I just configured the kernel as follows:

#
# Power management options (ACPI, APM)
#
CONFIG_PM=y
CONFIG_PM_DEBUG=y
# CONFIG_SOFTWARE_SUSPEND is not set

#
# ACPI (Advanced Configuration and Power Interface) Support
#
CONFIG_ACPI=y
CONFIG_ACPI_SLEEP=y
CONFIG_ACPI_SLEEP_PROC_FS=y
CONFIG_ACPI_SLEEP_PROC_SLEEP=y
CONFIG_ACPI_AC=y
CONFIG_ACPI_BATTERY=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_VIDEO=y
# CONFIG_ACPI_HOTKEY is not set
CONFIG_ACPI_FAN=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_THERMAL=y
# CONFIG_ACPI_ASUS is not set
# CONFIG_ACPI_IBM is not set
# CONFIG_ACPI_TOSHIBA is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
CONFIG_ACPI_DEBUG=y
CONFIG_ACPI_EC=y
CONFIG_ACPI_POWER=y
CONFIG_ACPI_SYSTEM=y
CONFIG_X86_PM_TIMER=y
# CONFIG_ACPI_CONTAINER is not set

#
# APM (Advanced Power Management) BIOS Support
#
# CONFIG_APM is not set

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_TABLE=y
CONFIG_CPU_FREQ_DEBUG=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_STAT_DETAILS=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
# CONFIG_CPU_FREQ_GOV_PERFORMANCE is not set
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y

#
# CPUFreq processor drivers
#
# CONFIG_X86_ACPI_CPUFREQ is not set
# CONFIG_X86_POWERNOW_K6 is not set
# CONFIG_X86_POWERNOW_K7 is not set
# CONFIG_X86_POWERNOW_K8 is not set
# CONFIG_X86_GX_SUSPMOD is not set
CONFIG_X86_SPEEDSTEP_CENTRINO=y
CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y
CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
# CONFIG_X86_SPEEDSTEP_ICH is not set
# CONFIG_X86_SPEEDSTEP_SMI is not set
# CONFIG_X86_P4_CLOCKMOD is not set
# CONFIG_X86_CPUFREQ_NFORCE2 is not set
# CONFIG_X86_LONGRUN is not set
# CONFIG_X86_LONGHAUL is not set

#
# shared options
#
# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
# CONFIG_X86_SPEEDSTEP_LIB is not set


For frequency scaling I just put this in rc.local:

  echo "ondemand" >> /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

which increases the cpu frequency as the load increases.

I also installed acpitool so that I can easily see the battery status.

Finally, test if the suspend to RAM works by hand first.  (Read though the
instructions below before starting!)

Sync the hard-disks in case something goes wrong, then try to go to sleep by
hand:

 sync
 echo "mem" >> /proc/power/state
 
You should see some messages about suspending and then the screen goes
blank.  Just pressing the power button should bring everything back.  

If this low level tests works, you are in great shape.  If not, you'll need
to play around and read up more on ACPI.  And you may be just out of luck
and have to get by with hibernation or something.

If it did work, you can configure
ACPID as you like.  I use these files in /etc/acpi to sleep
when the lid is shut or when the sleep button is pressed (Fn Esc).

Eventually, I will set it up to sleep when the battery is low, but I haven't
done that yet.  I also don't have much need for hibernation, as this state
works great.

Get CD burning working


Just use cdrecord.

This works on ATA disks *without* using the IDE-SCSI nonsense, despite what
the documentation says.  Just do e.g.:

   cdrecord -scanbus dev=/dev/hdc

and get the magic numbers e.g.:

# cdrecord -scanbus dev=/dev/hdc
Cdrecord-Clone 2.01 (i686-pc-linux-gnu) Copyright (C) 1995-2004 Jörg Schilling
cdrecord: Warning: Running on Linux-2.6.14.3testing
cdrecord: There are unsettled issues with Linux-2.5 and newer.
cdrecord: If you have unexpected problems, please try Linux-2.4 or Solaris.
scsidev: '/dev/hdc'
devname: '/dev/hdc'
scsibus: -2 target: -2 lun: -2
Warning: Open by 'devname' is unintentional and not supported.
Linux sg driver version: 3.5.27
Using libscg version 'schily-0.8'.
scsibus1:
        1,0,0   100) 'TSSTcorp' 'CDRW/DVD TSL462C' 'DE01' Removable CD-ROM
	1,1,0   101) *
	1,2,0   102) *
	1,3,0   103) *
	1,4,0   104) *
	1,5,0   105) *
	1,6,0   106) *
	1,7,0   107) *

now you are ready to burn eg:
			
   cdrecord -v -speed=2 dev=/dev/hdc:1,0,0 -data cd_image
						
That's it, pretty easy!

USB

USB works just fine.  I use the UHCI and EHCI modules:

mulhearn@mikesheap:/home/root/installed/gphoto2> /sbin/lspci | grep USB
00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #3 (rev 03)
00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #4 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller (rev 03)

I installed gphoto2 and I could download pictures.

Multimedia


The external video output worked perfectly.

Multimedia with mplayer and real audio works great.

...

If you want to save a real audio broadcast for later listening, you can use
mplayer as follows:

Just start playing the real audio file in the usual way. Usually, this
causes a ".ram" file to be saved in /tmp/, which you can find in realplayer.

Just dump the contents of this file to screen:

cat /tmp/myfile.ram

This will usually just contain the address of the rtsp stream.   Just dump
the rtsp into mplayer like this:

mplayer -noframedrop -dumpfile out.rm -dumpstream rtsp://url/to/file.rm

And then when it is done, you can play out.rm whenever you like, or convert
it to other formats...

Don't e-mail me.

I've made this available because it seems silly for people to repeat work
unnecessarily.  But I'm not willing to spend time answering e-mails from
people that want help!  There are many people willing to help you out there!

If you have a concise e-mail with a correction or some such thing, then e-mail
it to "mulhearn" at the first part of this URL but without the "www".