Skip to contentSkip to conversation

APM_CONFIG on x86 - Is it possible?

DISCUSSION Yotam Medini 4 participants 11 messages Dec 31, 2010 – Jan 2, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

To an ancient target (my UMAX 530T ActionBook - plz don't laugh...) I am trying to build a lean kernel based on 2.6.32.24 (~ Ubuntu 10.04). Battery monitoring used to be based on /proc/apm.
I believe ACPI is not supported on this old notebook.
Now, it seems that CONFIG_APM_POWER cannot be set, since:

1. The configuration place for APM_POWER is in:
./drivers/power/Kconfig:25:
config APM_POWER
tristate "APM emulation for class batteries" depends on APM_EMULATION

2. The configuration place for APM_EMULATION is in:

    ./kernel/power/Kconfig:201:
    config APM_EMULATION
	    tristate "Advanced Power Management Emulation"
	    depends on PM && SYS_SUPPORTS_APM_EMULATION

3. But the configuration places for the latter - SYS_SUPPORTS_APM_EMULATION
- exists only in:
./arch/powerpc/Kconfig:185:config SYS_SUPPORTS_APM_EMULATION ./arch/sh/Kconfig:120:config SYS_SUPPORTS_APM_EMULATION ./arch/mips/Kconfig:896:config SYS_SUPPORTS_APM_EMULATION ./arch/arm/Kconfig:32:config SYS_SUPPORTS_APM_EMULATION
and none under arch/x86 ! :():

So my bottom line questions are:
+ Am I missing something?
+ What is the 'right way' to configure a 2.6.3m.nn kernel that should support battery monitoring on such ancient laptops.

When replying, please CC: yotam DOT medini AT Gmail DOT c0m regards -- yotam

#1 lore raw
Quoted 29 lines · On Fri, 31 Dec 2010 19:38:58 +0200 Yotam Medini wrote:

Hello,

To an ancient target (my UMAX 530T ActionBook - plz don't laugh...) I am trying to build a lean kernel based on 2.6.32.24 (~ Ubuntu 10.04). Battery monitoring used to be based on /proc/apm.
I believe ACPI is not supported on this old notebook.
Now, it seems that CONFIG_APM_POWER cannot be set, since:

1. The configuration place for APM_POWER is in:
./drivers/power/Kconfig:25:
config APM_POWER
tristate "APM emulation for class batteries" depends on APM_EMULATION

2. The configuration place for APM_EMULATION is in:

    ./kernel/power/Kconfig:201:
    config APM_EMULATION
	    tristate "Advanced Power Management Emulation"
	    depends on PM && SYS_SUPPORTS_APM_EMULATION

3. But the configuration places for the latter - SYS_SUPPORTS_APM_EMULATION
- exists only in:
./arch/powerpc/Kconfig:185:config SYS_SUPPORTS_APM_EMULATION ./arch/sh/Kconfig:120:config SYS_SUPPORTS_APM_EMULATION ./arch/mips/Kconfig:896:config SYS_SUPPORTS_APM_EMULATION ./arch/arm/Kconfig:32:config SYS_SUPPORTS_APM_EMULATION
and none under arch/x86 ! :():

Quoted 8 lines

So my bottom line questions are:
+ Am I missing something?
+ What is the 'right way' to configure a 2.6.3m.nn kernel that should support battery monitoring on such ancient laptops.

When replying, please CC: yotam DOT medini AT Gmail DOT c0m regards -- yotam
--

arch/x86/Kconfig has the kconfig symbol "APM":

menuconfig APM

	tristate "APM (Advanced Power Management) BIOS support"
	depends on X86_32 && PM_SLEEP

=> /proc/apm for battery status information

so as long as your target system is 32-bit X86, you should be OK.

PM_SLEEP depends on SUSPEND || HIBERNATION. PM needs to be enabled, and SWAP has to be enabled for HIBERNATION.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts: http://www.xenotime.net/linux/recipes/

#2 lore raw

Randy,

Thanks for your quick reply.
Sorry, but the subject line should have been:
APM_POWER on x86 - Is it possible?
I do get
CONFIG_APM=m
in the .config, but I am trying to get
CONFIG_APM_POWER=m
as well. So far, I do not see how.

regards -- yotam

Quoted 57 lines · On Fri, 31 Dec 2010 10:33:45 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 29 lines · On Fri, 31 Dec 2010 19:38:58 +0200 Yotam Medini wrote:

Hello,

To an ancient target (my UMAX 530T ActionBook - plz don't laugh...) I am trying to build a lean kernel based on 2.6.32.24 (~ Ubuntu 10.04). Battery monitoring used to be based on /proc/apm.
I believe ACPI is not supported on this old notebook.
Now, it seems that CONFIG_APM_POWER cannot be set, since:

1. The configuration place for APM_POWER is in:
./drivers/power/Kconfig:25:
config APM_POWER
tristate "APM emulation for class batteries" depends on APM_EMULATION

2. The configuration place for APM_EMULATION is in:

    ./kernel/power/Kconfig:201:
    config APM_EMULATION
	    tristate "Advanced Power Management Emulation"
	    depends on PM && SYS_SUPPORTS_APM_EMULATION

3. But the configuration places for the latter - SYS_SUPPORTS_APM_EMULATION
- exists only in:
./arch/powerpc/Kconfig:185:config SYS_SUPPORTS_APM_EMULATION ./arch/sh/Kconfig:120:config SYS_SUPPORTS_APM_EMULATION ./arch/mips/Kconfig:896:config SYS_SUPPORTS_APM_EMULATION ./arch/arm/Kconfig:32:config SYS_SUPPORTS_APM_EMULATION
and none under arch/x86 ! :():

Quoted 8 lines

So my bottom line questions are:
+ Am I missing something?
+ What is the 'right way' to configure a 2.6.3m.nn kernel that should support battery monitoring on such ancient laptops.

When replying, please CC: yotam DOT medini AT Gmail DOT c0m regards -- yotam
--

arch/x86/Kconfig has the kconfig symbol "APM":

menuconfig APM

	tristate "APM (Advanced Power Management) BIOS support"
	depends on X86_32 && PM_SLEEP

=> /proc/apm for battery status information

so as long as your target system is 32-bit X86, you should be OK.

PM_SLEEP depends on SUSPEND || HIBERNATION. PM needs to be enabled, and SWAP has to be enabled for HIBERNATION.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts: http://www.xenotime.net/linux/recipes/

#3 lore raw
Quoted 5 lines · On Fri, 31 Dec 2010 21:28:00 +0200 Yotam Medini wrote:

Randy,

Thanks for your quick reply.
Sorry, but the subject line should have been:
APM_POWER on x86 - Is it possible?

Nope, not on X86.

Quoted 5 lines

I do get
CONFIG_APM=m
in the .config, but I am trying to get
CONFIG_APM_POWER=m
as well. So far, I do not see how.

APM_POWER depends on APM_EMULATION, which is not available on X86. But real APM is available on X86, so why would you need APM_EMULATION instead of APM_FOR_REAL ?

Enabling APM (according to its Kconfig help text) provides /proc/apm battery status information.

Quoted 62 lines

regards -- yotam

Quoted 50 lines · On Fri, 31 Dec 2010 10:33:45 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 29 lines · On Fri, 31 Dec 2010 19:38:58 +0200 Yotam Medini wrote:

Hello,

To an ancient target (my UMAX 530T ActionBook - plz don't laugh...) I am trying to build a lean kernel based on 2.6.32.24 (~ Ubuntu 10.04). Battery monitoring used to be based on /proc/apm.
I believe ACPI is not supported on this old notebook.
Now, it seems that CONFIG_APM_POWER cannot be set, since:

1. The configuration place for APM_POWER is in:
./drivers/power/Kconfig:25:
config APM_POWER
tristate "APM emulation for class batteries" depends on APM_EMULATION

2. The configuration place for APM_EMULATION is in:

    ./kernel/power/Kconfig:201:
    config APM_EMULATION
	    tristate "Advanced Power Management Emulation"
	    depends on PM && SYS_SUPPORTS_APM_EMULATION

3. But the configuration places for the latter - SYS_SUPPORTS_APM_EMULATION
- exists only in:
./arch/powerpc/Kconfig:185:config SYS_SUPPORTS_APM_EMULATION ./arch/sh/Kconfig:120:config SYS_SUPPORTS_APM_EMULATION ./arch/mips/Kconfig:896:config SYS_SUPPORTS_APM_EMULATION ./arch/arm/Kconfig:32:config SYS_SUPPORTS_APM_EMULATION
and none under arch/x86 ! :():

Quoted 8 lines

So my bottom line questions are:
+ Am I missing something?
+ What is the 'right way' to configure a 2.6.3m.nn kernel that should support battery monitoring on such ancient laptops.

When replying, please CC: yotam DOT medini AT Gmail DOT c0m regards -- yotam
--

arch/x86/Kconfig has the kconfig symbol "APM":

menuconfig APM

	tristate "APM (Advanced Power Management) BIOS support"
	depends on X86_32 && PM_SLEEP

=> /proc/apm for battery status information

so as long as your target system is 32-bit X86, you should be OK.

Quoted 7 lines

PM_SLEEP depends on SUSPEND || HIBERNATION. PM needs to be enabled, and SWAP has to be enabled for HIBERNATION.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts: http://www.xenotime.net/linux/recipes/

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts: http://www.xenotime.net/linux/recipes/

#4 lore raw

The .config I ended up with does have:
CONFIG_APM=m
But no CONFIG_APM_POWER setting,
When booting the kernel, I don not have /proc/apm. I do get:

  $ sudo modprobe apm
  FATAL: Error inserting apm 
    (/lib/modules/2.6.32.yumax/kernel/arch/x86/kernel/apm.ko): No such device

Please note that
drivers/power/Makefile:118
has:
obj-$(CONFIG_APM_POWER) += apm_power.o

Also the "/proc/apm" is created in
drivers/char/Makefile:71

    obj-$(CONFIG_APM_EMULATION)	+= apm-emulation.o
  drivers/char/apm-emulation.c:668-670
    #ifdef CONFIG_PROC_FS
	    proc_create("apm", 0, NULL, &apm_proc_fops);
    #endif

As far as I understand, CONFIG_APM is not sufficient for the creation of "/proc/apm".

-- yotam

Quoted 23 lines · On Fri, 31 Dec 2010 11:39:54 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 5 lines · On Fri, 31 Dec 2010 21:28:00 +0200 Yotam Medini wrote:

Randy,

Thanks for your quick reply.
Sorry, but the subject line should have been:
APM_POWER on x86 - Is it possible?

Nope, not on X86.

Quoted 5 lines

I do get
CONFIG_APM=m
in the .config, but I am trying to get
CONFIG_APM_POWER=m
as well. So far, I do not see how.

APM_POWER depends on APM_EMULATION, which is not available on X86. But real APM is available on X86, so why would you need APM_EMULATION instead of APM_FOR_REAL ?

Enabling APM (according to its Kconfig help text) provides /proc/apm battery status information.

Quoted 14 lines · On Fri, 31 Dec 2010 11:25:04 -0800 Avery Pennarun <[email protected]> wrote:
Quoted 8 lines · Yotam Medini יותם מדיני

For a target ancient UMAX-ActionBook 530T, I am trying to compile a Linux kernel that will support apm (/proc/apm)
for battery monitoring.
Alas, it looks like that with current 2.6.3n.* kernels it is not possible to configure CONFIG_APM_POWER on x86(/i386) architectures.

Am I missing something, is there a bypass?

CONFIG_APM still exists and can be enabled in 2.6.36 for me.

Avery

#5 lore raw
Quoted 1 line · Yotam Medini

For a target ancient UMAX-ActionBook 530T, I am trying to compile

...

Quoted 3 lines

The .config I ended up with does have:
  CONFIG_APM=m
But no CONFIG_APM_POWER setting,

I don't think CONFIG_APM_POWER does what you think it does. I don't know exactly what it does, either, but if you just want to use native apm on your machine, you don't need it.

Quoted 1 line

When booting the kernel, I do not have /proc/apm.

Well, you compiled it as a module, so it's not surprising that it wouldn't show up at boot time.

Quoted 5 lines

I do get:

 $ sudo modprobe apm
 FATAL: Error inserting apm
   (/lib/modules/2.6.32.yumax/kernel/arch/x86/kernel/apm.ko): No such device

The output of 'dmesg' might be revealing here. However, it's likely that your PC doesn't actually support APM unless it's *very* old. You might want to try ACPI instead.

Hope this helps.

Avery

#6 lore raw
Quoted 6 lines · On Fri, 31 Dec 2010 13:54:59 -0800 Avery Pennarun <[email protected]> wrote:
Quoted 5 lines

I do get:

 $ sudo modprobe apm
 FATAL: Error inserting apm
   (/lib/modules/2.6.32.yumax/kernel/arch/x86/kernel/apm.ko): No such device  
Quoted 7 lines

The output of 'dmesg' might be revealing here. However, it's likely that your PC doesn't actually support APM unless it's *very* old. You might want to try ACPI instead.

Hope this helps.

Avery

Indeed:

    $ dmesg  | grep -i apm
    [   52.897795] apm: BIOS not found.
I will try to investigate this.

But I clearly remember that a few years ago, I could issue:

    $ cat /proc/apm
and see the battery status.
Then, I believe, the kernel tree used to have arch/i386.

thanks -- yotam

#7 lore raw
Quoted 13 lines · Yotam Medini
Quoted 9 lines · On Fri, 31 Dec 2010 13:54:59 -0800 Avery Pennarun <[email protected]> wrote:
Quoted 5 lines

I do get:

 $ sudo modprobe apm
 FATAL: Error inserting apm
   (/lib/modules/2.6.32.yumax/kernel/arch/x86/kernel/apm.ko): No such device

The output of 'dmesg' might be revealing here.  However, it's likely that your PC doesn't actually support APM unless it's *very* old.  You might want to try ACPI instead.

Indeed:

Quoted 8 lines
   $ dmesg  | grep -i apm
   [   52.897795] apm: BIOS not found.
I will try to investigate this.

But I clearly remember that a few years ago, I could issue:

   $ cat /proc/apm
and see the battery status.
Then, I believe, the kernel tree used to have arch/i386.

arch/i386 is named arch/x86 nowadays.

It might be interesting to try an older kernel and see if you get different results. Since APM is so rare nowadays, I wouldn't be surprised to find out that the kernel has accumulated some bugs there in the intervening years.

Avery

#8 lore raw
In reply to Yotam Medini

Hi,

Quoted 5 lines · On Sat, 1 Jan 2011 00:05:58 +0200 Yotam Medini <[email protected]> wrote:

Indeed:

    $ dmesg  | grep -i apm
    [   52.897795] apm: BIOS not found.
I will try to investigate this.

Try building APM into your kernel instead of as a module and see if that makes any difference.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#9 lore raw
In reply to Yotam Medini
Quoted 15 lines · On Fri, 31 Dec 2010 23:40:10 +0200 Yotam Medini wrote:

The .config I ended up with does have:
CONFIG_APM=m
But no CONFIG_APM_POWER setting,
When booting the kernel, I don not have /proc/apm. I do get:

  $ sudo modprobe apm
  FATAL: Error inserting apm 
    (/lib/modules/2.6.32.yumax/kernel/arch/x86/kernel/apm.ko): No such device

Please note that
drivers/power/Makefile:118
has:
obj-$(CONFIG_APM_POWER) += apm_power.o

Quoted 4 lines

Also the "/proc/apm" is created in
drivers/char/Makefile:71

    obj-$(CONFIG_APM_EMULATION)	+= apm-emulation.o

drivers/char/apm-emulation.c:668-670

Hint: This is not the only place that /proc/apm is created.

Quoted 5 lines
    #ifdef CONFIG_PROC_FS
	    proc_create("apm", 0, NULL, &apm_proc_fops);
    #endif

As far as I understand, CONFIG_APM is not sufficient for the creation of "/proc/apm".

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
desserts: http://www.xenotime.net/linux/recipes/

#10 lore raw

Re: CONFIG_APM_POWER - still possible?

Using the hints I got here, I realized that /proc/apm
is supposed to be created (for x86) by:
apm_init() @ arch/x86/kernel/apm_32.c
I added some debug printk messages in some places I considered related.

Quoted 1 line

From these I learned the following:

1. In setup_arch(...) @ arch/x86/kernel/setup.c:

	apm_info.bios = boot_params.apm_bios_info;
   it has the value:
        apm_info.bios.version == 0

2. In apm_init() @ arch/x86/kernel/apm_32.c:

  if (apm_info.bios.version == 0 || paravirt_enabled() || machine_is_olpc()) {
    printk(KERN_INFO "apm: BIOS not found.\n");
    return -ENODEV;

}

It gets here with

     apm_info.bios.version == 0

This is why 'dmesg' shows:
apm: BIOS not found
and thus /proc/apm is not created.

3. In query_apm_bios() @ arch/x86/boot/apm.c
I added debug puts messages.
But 'dmesg' showed none of them.

Could it be that some boot-command line parameters are not well passed to the kernel?
Is the 'initrd' involved in this? I am not familiar with the 'black art' of constructing 'initrd'. I am using mkinitramfs for this.
The initrd I get does manage to bring up the kernel, the file-systems and a essentially - a running system.

I still have not tried compiling apm directly into the kernel. I may try it later, but I believe the problem lies elsewhere.

Thanks for all the tips -- yotam

Quoted 14 lines · On Fri, 31 Dec 2010 14:23:35 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 9 lines · On Fri, 31 Dec 2010 23:40:10 +0200 Yotam Medini wrote:

....

  $ sudo modprobe apm
  FATAL: Error inserting apm
    (/lib/modules/2.6.32.yumax/kernel/arch/x86/kernel/apm.ko): No such device
....
Also the "/proc/apm" is created in
  drivers/char/Makefile:71
    obj-$(CONFIG_APM_EMULATION)	+= apm-emulation.o
  drivers/char/apm-emulation.c:668-670

Hint: This is not the only place that /proc/apm is created.
....