[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ACPI HOWTO (start) and (failed) installation notes



For those of you who are interested, I patched the 2.4.20 kernel from
www.kernel.org (according to the ACPI list the patch will not work without
tweaks to the Makefiles) successfully but none of my modules would
compile/load. When I rebooted my computer NONE of hte ACPI modules were
loaded. No idea what happened but I've taken the discussion over to the
ACPI-support list.

In the mean time, here's the start of a HOWTO that I wrote on the weekend.
At this point it has *every* step that I took trying to get the kernel +
patch working (and some of the error messages). It's a PITA to read as
plain text, I know. But I don't have all my exams marked yet so it won't
get HTMLd until later in the week.

emma

ACPI: Advanced Configuration and Power Interface
About this document
When I first started the switch from APM to ACPI I didn't realize the
kernel needed to be patched. My problem (over-clocked fan) was fixed just
by upgrading to 2.4.20 (Debian package with an earlier patch from
acpi.sourceforge.net). It wasn't until later that I realized I hadn't
actually installed the full(er) capabilities of ACPI. This HOWTO was
written to summarize the process for myself, and hopefully help others who
are also having a hard time finding information about ACPI.

About ACPI
Before ACPI power management was done at the BIOS level with Advanced
Power Management (APM). This was an industry standard and is still used in
many systems. APM is called when the system becomes idle. The longer the
idle period the lower the power consumed (e.g. Screen saver vs. sleep vs.
suspend). In APM the operating system has no knowledge of when the system
is going to change power states.

ACPI was developed by Toshiba, Intel and Microsoft. Unlike APM the new
ACPI (released in 1996) allows control of power management from within the
operating system. ACPI is typically provided an interface: OS-directed
Power Management (OSPM), unlike the old APM where the user often had to
reboot into the BIOS configuration screens. The ACPI defines a variety of
"states" including:
thermal control
motherboard configuration
power states (sleep, suspend)

ACPI has several different software components. A subsystem which controls
hardware states and functions that may have previously been in the BIOS
configuration. A policy manager which is software that sits on top of the
operating system and allows user input on the system policies. Finally the
ACPI also has device drivers that control/monitor(?) devices such as a
laptop battery, SM Bus and EC.[need explanations of what these are]

Why switch?
The biggest reason for me switching from APM to ACPI is quite simple: APM
wasn't supported by my BIOS. Switching to ACPI means longer battery life
and (the most important reason for me) my fan is no longer over-clocked (I
am still not sure if it was a CPU problem or a fan problem).

Installing from scratch
As of this writing the latest stable kernel is 2.4.20 available from
www.kernel.org. ACPI is being re-written and will be released into the
2.5.x version kernels (or possibly not until 2.6). This means all kernels
released before 2.5.x must be patched. The patches are available from
acpi.sourceforge.net. You need to get the patch that exactly matches the
version of the kernel that you are running. Since this is the "install
from scratch" section I will assume you know exactly which kernel you will
be installing.

I'm currently running Debian on my laptop. I upgraded to the 2.4.20 kernel
to try and get ACPI installed. Unfortunately ACPI is not supported in the
2.4.x series. Although Debian has applied an early patch to its kernel
source packages, it is not the full monty. The acpi-support mailing list
has confirmed that the other patches which have been applied to the 2.4.20
Debian kernel-source package will make it impossible for me to compile the
kernel without first modifying some of the Makefiles. This is beyond my
current grasp of reality so I have decided to download a fresh kernel from
www.kernel.org (latest stable release is 2.4.20) and apply the patch to
it. Since my system already runs 2.4.20 I should already have all
necessary packages. Unfortunately I do not have very complete notes on any
additional packages that may have been required when I upgraded from
2.4.18.

For more information on the patches that have been applied to the Debian
2.4.20 kernel source package I scanned through:
	/usr/src/kernel-source-2.4.20/README.Debian
A user on acpi-support confirmed that I shouldn't need any of the
additional patches that have been applied to the kernel. Just in case I'm
going to treat this installation is a completely different kernel and save
my existing (working) kernel in case I run into problems. I will also try
The Debian Way to install this kernel. I will try to give the low-down on
each of The Debian Way steps and how they compare to doing things "the
easy way."

Backup your existing kernel and modules
Files to backup:
/usr/src/linux/System.map
/etc/lilo.conf
/etc/modules
/etc/modutils/aliases
/lib/modules/modules.2.4.20.tar.gz
/usr/src/linux/.config
/usr/src/linux/arch/i386/boot/bzImage
/usr/src/*.deb

Download the kernel and appropriate patch
	cd /usr/src
	mkdir kernel-source-2.4.20-fresh
	cp linux.2.4.20.tar.bz2 /usr/src/kernel-source-2.4.20-fresh
	cd /usr/src/kernel-source-2.4.20-fresh
	tar xjfv linux.2.4.20.tar.bz2
	mv linux.2.4.20.tar.bz2 ../archive
	mv linux.2.4.20 ../linux-2.4.20-fresh
	rm linux (the link to your old kernel)
	ln -s /usr/src/linux-2.4.20-fresh linux	

Patch the old kernel
	cd /usr/src/linux
	cp acpi-20021212-2.4.20.diff.gz    .
	gunzip  acpi-20021212-2.4.20.diff.gz 
	patch -p1 < acpi-20021212-2.4.20.diff
Look for messages like:
	Hunk #1 succeeded at 1609 (offset -4 lines).

Configure the new kernel
	cd /usr/src/linux
	cp /usr/src/kernel-source-2.4.18/.config .config
	make oldconfig (say M to all new options for ACPI)

Compile the new kernel
If you have additional modules that are not part of the main source tree,
you will need to add modules_image when you make your Debian packages.
This is almost inevitable if you're using a laptop. I have three modules
that get installed seperately: my graphics card (nvidia); sound (ALSA);
and my wireless card (pcmcia).
	cd /usr/src/linux
	make-kpkg clean
	make-kpkg --append-to-version=.<date> kernel_image modules_image
This program replaces the following:
	make dep
	make clean
	make bzImage
	make modules

Install the new kernel
	cd /usr/src
	updatedb otherwise the next line won't find
/boot/vmlinuz.<append-to-version>
	dpkg -i kernel-image-2.4.20.030420_10.00.Custom_i386.deb
This program replaces the following:
	make modules_install
	vi /etc/lilo.conf
	lilo -q
	lilo

Errors on install:
debian:/usr/src# dpkg -i kernel-image-2.4.20.030420_10.00.Custom_i386.deb 
Selecting previously deselected package kernel-image-2.4.20.030420.
(Reading database ... 118988 files and directories currently installed.)
Unpacking kernel-image-2.4.20.030420 (from
kernel-image-2.4.20.030420_10.00.Custom_i386.deb) ...
Setting up kernel-image-2.4.20.030420 (10.00.Custom) ...
Hmm. vmlinuz is a directory, which I did not expect.  I am
trying to create a symbolic link with that name linked to 
/ . Since a directory exists here, my assumptions 
are way off, and I am aborting.
dpkg: error processing kernel-image-2.4.20.030420 (--install):
 subprocess post-installation script returned error exit status 29
Errors were encountered while processing:
 kernel-image-2.4.20.030420

	reboot 
	mv /lib/modules/2.4.20.<date> /lib/modules/2.4.20.<date>.bak
	dpkg -i kernel-image-2.4.20.030420_10.00.Custom_i386.deb
	(installed ok)
	decided to ignore lilo stuff and do it by hand because the output
didn't have the correct lines for the CD burner

	reboot
	uname -a to make sure you have the right kernel installed
	acpi -V to make sure you've got all your functions working

None of my modules will load although the kernel boots and the patch for
ACPI has been correctly applied and identified. If I try to load the
modules with dpkg -i I get errors that prevents the packages from loading.
This is true for each of ALSA, nvidia and pcmcia/wireless modules. ACPI
also doesn't "work." The battery, thermal and EC are no longer recognized
under acpi -V. This is probably because the modules aren't loading even
though they are still listed in /etc/modules.

Tried compiling everything again "the easy way." Problem seems to be with
the relationship between the modules and the fresh kernel. (Get problems
on make modules.) e.g.
find kernel -path '*/pcmcia/*' -name '*.o' | xargs -i -r ln -sf ../{}
pcmcia
if [ -r System.map ]; then /sbin/depmod -ae -F System.map  2.4.20; fi
depmod: *** Unresolved symbols in /lib/modules/2.4.20/alsa/snd.o
depmod:         register_sound_special_Rd8a0c281
Switching from APM to ACPI
To select the correct patch you need to know which kernel you're trying to
patch:
	uname -a
will give you the version of your current kernel. Now you need to pick up
this patch from acpi.sourceforge.net

Other things to remember:
don't let apmd and acpid run at the same time. Debian will not check to
make sure only one is running at a time
APM will try to put your system into S3. On the 2.4.x (and before) series
of kernel this will quite probably crash your machine. S3 is not supported
until 2.5.x. Even the patch won't fix this according to one email that is
printed in my binder and that I should look up later.

Using ACPI
There are a few different applications/daemons you will want to install on
your system: acpid (the daemon that will control your hardware states),
acpi (the interface to monitor events and states) are the base install
that you will want. You can use acpi to monitor your system like this:
	acpi -V
The output will tell you about your system. Mine (pre-kernel patch) looks
like this:

Battery
emmajane@debian:~/kernel$ acpi -V
     Thermal 1: ok, 47.1 degrees C
     Thermal 2: ok, 45.1 degrees C
  AC Adapter 1: off-line
AC Adapter plugged in

emmajane@debian:~$ acpi -V
     Thermal 1: ok, 51.1 degrees C
     Thermal 2: ok, 50.1 degrees C
  AC Adapter 1: on-line

-- 
Emma Jane Hogbin
[[ 416 417 2868 ][ www.xtrinsic.com ]]



Reply to: