Quantcast
Username/Email:  Password: 

Polishing Your Linux Laptop Setup

 in
In the final installment of this Linux on the laptop series, learn how to go wireless, use ALSA and install ACPI.

In my past laptop oriented articles, I
talked about procedures for installing a
base Linux system
and setting up
GNOME 2.2
. This time around, I discuss a few odds and ends
that did not quite fit those other two articles but definitely
deserve further attention.Wire No MoreWireless networking is an integral advantage to laptop
computing. In my situation, I never would have gotten involved with
Linux on laptops if wireless networking had not become available.
There's nothing quite like browsing the Web from your favorite
chair with a cold beverage nearby, the way all computing should be
done. For this example, I'm going to set up a Lucent Orinoco
802.11b PCMCIA card. There are many new and old standards in the
wireless world, but from what I have seen 802.11b is by far the
most popular. Also, you may find it necessary to implement
different layers of security if you live in a populated area.
Plenty of articles already are written that discuss the complicated
world of WiFi security, so I'm not going to dabble in that arena.
If you'd like to learn more about WiFi security, check out the
Resources at the end of this article, and your questions will be
answered.As with most network device installs, the first thing you
need to do is make sure the kernel module or modules are installed
for the hardware in question. In the case of the Orinoco, you
should have set the following options in your kernel configuration
under Network device support. If you have not set these options,
you now need to recompile and reinstall the kernel.

  • Selected - Wireless LAN (non-hamradio)
  • Module - Hermes chipset 802.11b support
    (Orinoco/Prism2/Symbol)
  • Module - Hermes PCMCIA card support

In my case, I also had to enable ISA Bus support for the 16
bit PCMCIA card. This is done under General setup, and the option
is [*] ISA bus support. As far as I can tell,
this option is new to the 2.4.20 kernel. After reading through many
newsgroups and Web searches, it looks like a lot of people have
problems with Orinoco cards after upgrading to the 2.4.20 kernel.
So make sure that you enable ISA Bus support.With the kernel modifications complete, the next task is to
install the Debian packages needed to access a PCMCIA card. A quick
apt-get install wireless-tools and
apt-get install pcmcia-cs should grab everything
you require. All of the configuration files for PCMCIA can be found
in the /etc/pcmcia directory. The three files that need to be
manipulated are config, network.opts and wireless.opts.Let's start by editing the config file. Scroll down to the
device orinoco_cs section, and make sure it
looks like the following. If any other lines are present in the
device "orinoco_cs" section, comment them
out.

device "orinoco_cs"
  class "network" module "hermes", "orinoco", "orinoco_cs"

Next, open up network.opts and alter the TCP/IP values
beneath the line # Host's IP address, netmask, network
address, broadcast address
. These values are the same as
if you were configuring a traditional TCP/IP network card. Some may
be left null or filled in as needed. As an example, here are the
values I used to configure to my local LAN:

IPADDR="192.168.1.4"
NETWORK="192.168.1.0"
BROADCAST="192.168.1.255"
GATEWAY="192.168.1.1"
DNS_1="192.168.9.47"
DNS_2="192.168.9.48"

Then, open wireless.opts, which contains many options
specific to the wireless connection. To simplify my example, I am
not going to use any security options. This is not recommended if
you live in an urban area, but if you're out in the boonies, I
don't think there is anything wrong with letting the local raccoon
population get some free Internet access. The only things that need
to be changed are two ESSID settings. One of them is under the
section commented by Lucent Wavelan IEEE and the
other is under Generic example. Under both of
these sections, change the ESSID value to
any, so it looks like
ESSID="any".If you haven't rebooted yet, now would be a good time to do
so, to make sure the PCMCIA services are brought up correctly.
During boot you should see something like the following output. If
the boot messages scroll too fast, you can check in
/var/log/syslog.

cardmgr[260]: watching 1 sockets
cardmgr[261]: starting, version is 3.2.2

Once the machine is booted, use tail -f
/var/log/syslog
to watch the syslog and insert the
Orinoco card. If things are set up correctly, you should see
something in the log like the following:

cardmgr[279]: socket 0: Lucent Technologies WaveLAN/IEEE Adapter
kernel: cs: memory probe 0xa0000000-0xa0ffffff: clean.
cardmgr[279]: executing: 'modprobe hermes'
kernel: hermes.c: 5 Apr 2002 David Gibson <hermes@gibson.dropbear.id.au>
cardmgr[279]: executing: 'modprobe orinoco'
kernel: orinoco.c 0.11b (David Gibson <hermes@gibson.dropbear.id.au> and others)
cardmgr[279]: executing: 'modprobe orinoco_cs'
kernel: orinoco_cs.c 0.11b (David Gibson <hermes@gibson.dropbear.id.au> and others)
kernel: eth1: Station identity 001f:0001:0008:0048
kernel: eth1: Looks like a Lucent/Agere firmware version 8.72
kernel: eth1: Ad-hoc demo mode supported
kernel: eth1: IEEE standard IBSS ad-hoc mode supported
kernel: eth1: WEP supported, 104-bit key
kernel: eth1: MAC address 00:02:2D:3A:35:08
kernel: eth1: Station name "HERMES I"
kernel: eth1: ready
kernel: eth1: index 0x01: Vcc 5.0, irq 3, io 0x0100-0x013f
cardmgr[279]: executing: './network start eth1'

When you remove the card you should see

cardmgr[279]: executing: './network stop eth1'
cardmgr[279]: executing: 'modprobe -r orinoco_cs'
cardmgr[279]: executing: 'modprobe -r orinoco'
cardmgr[279]: executing: 'modprobe -r hermes'

At this point you should have a fully functional wireless
laptop. The Orinoco card can be removed and inserted as required
without a need to reboot or to configure any further. If you have
problems, one useful command for troubleshooting PCMCIA issues is
cardctl. Using cardctl, you can verify that your card is what you
think it is. You also can gather information on the state of the PC
card slot in your laptop.Here's one little trick I'm using. In my case I use my laptop
at two primary locations, work and home. When I'm home I use the
WiFi card and when I'm at work I use the integrated NIC. At work I
have no issues, because I keep the WiFi unplugged so the device is
never brought up. But at home, I had a problem: when I used WiFi I
had to manually down the integrated NIC, because some applications
did not like eth0 being up but not connected to anything. It was
not a major issue, but it got to be an annoyance to have to
manually ifconfig down eth0 every time I booted
the laptop at home. What I did to correct this problem was add the
following line to the end of /etc/pcmcia/wireless:ifconfig eth0 downThis script is executed only when the wireless device is
brought up, so it works perfectly. Whenever I insert the Orinoco
card, the integrated NIC is disabled.ALSA SoundThe ALSA project supports a wide variety of sound cards and
chipsets under one common package set. This design makes it much
easier for the end user, because they do not have to look far for a
valid install procedure or for other ALSA users to assist with
issues that may arise. A testament to the overall value of the ALSA
project is its planned integration into future kernel releases. For
now, though, we have to compile and install manually ALSA's
modules.Rather than replicate
the install
documents that already exist
, I'm going to provide a brief
overview of the install process and point out some areas where I
varied from the install docs. Before you start installing ALSA,
make sure your kernel is enabled to use soundcore support. The
soundcore option is selected by choosing Sound card support during
the kernel config process.

Selected - Sound card support

The first part of the install process is typical of any Linux
source install, using the standard ./configure,
make and make install steps.
You have to follow these three steps for each of the three packages
that make up the ALSA sound suite: alsa-driver , alsa-libs and
alsa-utils.Next, you have to create and add some lines to
/etc/modutils/alsa. Rather than create a new file, I added these
lines to the bottom of /etc/modutils/aliases. The lines they
suggest you use are:

# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-intel8x0
# module options should go here
# OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
# card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

In addition, I also added a few off lines to stop some
annoying error messages that would show themselves during boot. So
for my Intel810 chipset, I added the following lines to the bottom
of my /etc/modutils/aliases file.

# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-intel8x0
                                                                                
alias snd-card-1 off
alias snd-card-2 off
alias snd-card-3 off
# module options should go here
                                                                                
# OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0
                                                                                
# card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

After you finish changing the aliases or alsa file, you must
run the command update-modules to make your
alterations final.Putting start/stop scripts in place also is a good idea.
These scripts save your volume settings so the previous volume
settings are restored after a reboot. The primary start/stop script
already exists in /etc/init.d; you simply have to create some
links:.

ln -s /etc/init.d/alsasound /etc/rcS.d/S80alsavolume
ln -s /etc/init.d/alsasound /etc/rc0.d/K02alsavolume
ln -s /etc/init.d/alsasound /etc/rc6.d/K02alsavolume

At this point, you should be ready to start using ALSA sound.
It's a good idea to reboot to make sure all your start scripts are
working properly and the modules are loading up correctly. In
GNOME, you can configure all the system sounds through the Sound
control panel, which can be found on the Desktop preferences
menu.ACPI and YouACPI, which stands for advanced configuration and power
interface, is a power management component eventually set to
replace APM. The current state of ACPI as a whole is marred at
best. Laptop manufacturers often deviate from following any type of
standard when coding certain ACPI-related BIOSes and components.
Rather than follow a standard, they rely on proprietary Windows
drivers to keep things functioning. Unfortunately, in many cases,
this leaves Linux users out in the dark.When ACPI is in place and running 100% correctly, there are
many advantages to its use. It can monitor power-related
components, such as the AC adapter and battery. One of its advanced
features involves processor re-clocking abilities. You can
configure ACPI to drop your CPU frequency when the laptop is idle.
It also can control the system's fans, adding another layer of
monitoring in regards thermal protection. Another, more broad
feature is the ability to monitor certain events that take place on
your laptop. Closing the lid or pressing the power button can be
configured to send the laptop into a sleep or suspend state.I'm not going to lie to you, ACPI can be a beast to setup.
Don't attempt to get ACPI running unless you are comfortable
altering the kernel. The steps are not necessarily complicated, but
if you make an error, you could hose up the kernel pretty seriously
and have to boot from an alternate kernel to repair the damage.
From what I've seen, a vast majority of laptops are not fully ACPI
compliant. Of course, there are exceptions to the rule, but a quick
web search shows users of all laptop manufacturers have problems
with ACPI. This does not mean that ACPI is useless to a Linux user;
even in its impaired state, it can offer more functionality than
APM. And many tweaks and patches are available to help you get it
running. Finding the sources for these tweaks and patches for your
specific laptop can be another battle altogether.Here are some steps to follow, assuming you laptop is
somewhat ACPI compliant. I'm working with the 2.4 kernel for this
example. The 2.5 kernel has the ACPI modules integrated, but for
the sake of a larger audience I'm going to use 2.4.First, you need to put the Linux kernel source in order. In a
previous article, I worked with the 2.4.20 source found in Debian's
Sid package repository. Although this source works fine, I have had
problems getting the ACPI patch to apply to it. To avoid any of
these complications, download the 2.4.20 source from
www.kernel.org. Once
you've downloaded the source, uncompress it in your /usr/src
directory. Then cd into /usr/src, and link linux to the 2.4.20
source with ln -s linux-2.4.20 linux.After the kernel source has been downloaded and linked, you
can get the ACPI patch from
sourceforge.net/projects/acpi.
It is important to use the patch that coincides with your kernel
revision. Move the patch into the /usr/src/linux/ directory and
uncompress it. At this point, you should have a
acpi-something.diff file within the
/usr/src/linux directory. This is the file you will use to patch
the kernel with support for ACPI. Run the following command from
inside the /usr/src/linux" directory to commit the patch. In this
example, I'm applying the latest 2.4.20 ACPI patch.

patch -p1 < acpi-20021212-2.4.20.diff

After the patch has been applied, run make
menuconfig
and configure the kernel. This time, however,
notice the submenu for ACPI Support under the General setup menu.
This is where you choose which ACPI options you would like to use.
If this is your first time using ACPI on the laptop, it can be a
crapshoot figuring out which features will be supported. A couple
important things to remember during this step are to enable Power
Management support but not Advanced Power Management BIOS support.
ACPI does not function correctly with APM enabled, but Power
Management support must be enabled for certain ACPI features to
work.Once the kernel source has been configured to your liking,
compile it, install it, reboot and prepare for some intense ACPI
action. After the machine has booted, log in to a root console and
run dmesg |more. If the ACPI module is having
any problems, they will show up here.
dmesg also is a good tool to use
to find out specifics on how extensively your laptop supports
different ACPI features.If you are lucky, dmesg shows ACPI coming up with no issues.
I ran into a problem with ECDT on my Thinkpad R32, however. After
extensive troubleshooting, I discovered that a bug in the
Thinkpad's ECDT prevents ACPI from coming up. Fortunately, someone
has written a HOWTO on getting the kernel to work with the buggy
ECDT. It can be found
here.In its current state, ACPI is buggy at best. Until laptop
manufacturers iron out some kind of standard, I fear ACPI is going
to be a thorn in every Linux user's side. If APM is functioning
correctly on your laptop or if you do not have tons of extra time
on your hands to troubleshoot, I would not recommend using ACPI.
Hopefully, ACPI support will get better and better with each new
laptop model released. With any luck, in a year or so ACPI Linux
support will be as non-combative as APM support has become.ResourcesThere is no way any Linux user could get anything done
without the community's support. In the course of writing these
Linux laptop articles, I have read countless articles and HOWTOs on
the topic to further my knowledge in the area. Here are some of the
more applicable sites I have come across.ACPI:
Sourceforge hosted project home of the ACPI 2.4.* patch.atitvout:
atitvout is a way to use the svideo out on ATI sound cards. Works
great on my R32's Radeon 7500.Advanced Linux Sound
Architecture
: the home page of the ALSA project.GNOME Support: a
great resource if you need help with GNOME. I recommend browsing
the forum.Linux
Compatible
: a good site for researching the compatibilities
of a Linux laptop's components.Linux on
Laptops
: perhaps the most definitive resource for laptop
setup research.TPB, ThinkPad
Buttons
: home page for the TBP Thinkpad utility for using
the nvram-based volume and Thinkpad keys.TuxMobil: similar to
Linux on Laptops but not quite as many laptop installs to look
through.

email: jay@docherty.com

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Correct way to compile kernel...

Anonymous's picture

... is in your home development subdirectory, logged in as a normal user. It is ONLY when you install the kernel and modules that you need to be root.
There are some good reasons for doing it this way, outlined at http://www.linuxfocus.org/common/src/article240/erratum.html among other places. If you find the reasoning too esoteric, at least acknowledge that this is Linus Torvalds' recommendation. Also, the less you do as root, the less likely you are to have a bad computer day.

root access

damon's picture

However the interested reader may keep in mind that the wholesale demands of separate user level access is an idiosyncrasy of 20th century computing. In this case the article is trying to be simple, contrast technocratic edicts against usability.

Re: Polishing Your Linux Laptop Setup

Anonymous's picture

Regarding the issue with manually bringing the built-in NIC down, one might try ifplugd. Ifplugd is a daemon that detects whether there is a cable connected to the wired NIC or not, and brings up the interface when the cable is inserted, and brings it back down when the cable is removed.

On Debian testing, at least, one can simply do an "apt-get install ifplugd" to get the daemon installed, otherwise go to the web page for more information.

Title indicating this is Debian-specific?

Anonymous's picture

The article does not mention anywhere that it is Debian specific, we have to assume that from the use of apt and the names of the initscripts, and the fact that you actually had to patch your kernel for ACPI.

Maybe in future the author could at least point this out, and also indicate that on other distributions, a lot of these issues are not relevant (many distros default to ALSA on all supported cards and have working ACPI out-the-box if you choose to enable ACPI during installation).

Re: Title indicating this is Debian-specific?

Anonymous's picture

Regarding ACPI in other distros, they don't have better support for buggy ACPI-implementations than debian. This is a hardware/kernel issue, that applies equally well to any distribution.

Although many distributions ships with distributionspecific patches applied, I don't think they have a patch for every buggy ACPI implementation in a laptop out there. And there are _many_, check out the mailing lists on http://acpi.sf.net to see the magnitude of it.

The problem most often is not in the kernel but in buggy ACPI code in bios, as others have pointed out.

ibook/powerbook

Anonymous's picture

Just get a mac laptop. Much better hardware, much better linux support.

Re: ibook/powerbook

Anonymous's picture

Agreed to both and I did, once.

I had to sell & get an x86 only because s/w support sucks. Most commercial vendors port to only x86 linux, not PPC.

Re: Polishing Your Linux Laptop Setup

Anonymous's picture

This is what makes me stay away from Linux on my laptop. It's Compaq 17XL and all flavors of Win have had no problem. The latest RH or SuSE are powerless with ACPI. The author is quick to blame manufacturers, but if OS from '98 can handle it how come ones from 2003 based on Linux stumble - and it's not Compaq's fault.

Re: Polishing Your Linux Laptop Setup

Anonymous's picture

Prolly cause Microsucks convinced them to implement this into the bios so that it could "Again" get an advantage over any and all competition.
Microsoft designed ACPI to work with "Their" software.
And to say that "it's not Compaq's fault" is entirely FALSE. Each manufacturer was given a general guidline as to implementing ACPI into their bios' and "NONE" of them follow these guidlines. ACPI is far from being "standardized" and untill it is Linux users will continue to have to "deal with it".

Re: Polishing Your Linux Laptop Setup

Anonymous's picture

Yeah, the ACPI option is borked for my laptop running SUSE 8.1. However, it is VERY easy to disable acpi. My boot using LILO is:

image = /boot/vmlinuz
label = linux
root = /dev/system/root
initrd = /boot/initrd
append = "acpi=off"

Works just fine!!

Re: Polishing Your Linux Laptop Setup

Anonymous's picture

Why the h**l are you claiming that the OS (calling w32 an OS is an
exaggeration but anyway) is handling this ?
I would suggest that they (w32) have got nothing whatsoever to
do with this matter at all. I also would suggest that you stick with
your beloved w32 and stop wasting your and our energy by posting.

Re: Polishing Your Linux Laptop Setup

Anonymous's picture

well, not having to do anything due to hw people at
different companies licking your ass helps a lot.

Re: Polishing Your Linux Laptop Setup

Anonymous's picture

The author is quick to blame manufacturers, but if OS from '98 can handle it how come ones from 2003 based on Linux stumble - and it's not Compaq's fault.

Hmm... let's see -- it was DESIGNED to work with Windows, the manufacturer explicitly planned Windows support and has probably not cooperated at all with the Linux folks trying to support it by providing docs, much less by actually writing the appropriate software that would allow Linux to use it. So, yes, it IS Compaq's fault.

I get so sick of people complaining "Linux doesn't support XXX" -- you've got it wrong. Vendor XXX doesn't support Linux. It isn't a technical limitation on behalf of Linux -- it's a decision by the manufacturer to support only one choice in the market.

Re: Polishing Your Linux Laptop Setup

Anonymous's picture

Because the manufacturer provides special drivers for Win9x, Win2k, WinXP to work with their non-standards-compliant hardware? (But the manufacturer doesn't do the same for Linux.)

That's what the author says at least... And that makes sense to me...
Then, of course, there's most likely a whole bunch of other problems that can arise.

Myself, I'm running Linux on my HP Omnibook 6100... flawlessly...

isn't intel itself coding ACPI for linux ?

Anonymous's picture

Or are they just pretending to, appearing to be close to GPL zealots but at the same time stroking m$ by sabotaging linux at every opportunity.

I see no reason for intel to help linux - if windows becomes irrelevant then so does intel - linux runs on many platforms.

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.
  • Use to create page breaks.

More information about formatting options