2010-12-31 17:38:58

by Yotam Medini

[permalink] [raw]
Subject: APM_CONFIG on x86 - Is it possible?

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


2010-12-31 18:33:49

by Randy Dunlap

[permalink] [raw]
Subject: Re: APM_CONFIG on x86 - Is it possible?

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 ! :():
>
> 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/

2010-12-31 19:28:00

by Yotam Medini

[permalink] [raw]
Subject: Re: APM_CONFIG on x86 - Is it possible?

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

On Fri, 31 Dec 2010 10:33:45 -0800
Randy Dunlap <[email protected]> wrote:

> 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 ! :():
> >
> > 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/

2010-12-31 19:39:59

by Randy Dunlap

[permalink] [raw]
Subject: Re: APM_CONFIG on x86 - Is it possible?

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.

> 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.


> regards -- yotam
>
> On Fri, 31 Dec 2010 10:33:45 -0800
> Randy Dunlap <[email protected]> wrote:
>
> > 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 ! :():
> > >
> > > 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/
> --
> 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/

2010-12-31 21:40:08

by Yotam Medini

[permalink] [raw]
Subject: Re: APM_CONFIG on x86 - Is it possible?

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


On Fri, 31 Dec 2010 11:39:54 -0800
Randy Dunlap <[email protected]> wrote:

> 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.
>
> > 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.
>

On Fri, 31 Dec 2010 11:25:04 -0800
Avery Pennarun <[email protected]> wrote:

> On Fri, Dec 31, 2010 at 4:09 AM, Yotam Medini יותם מדיני
> <[email protected]> wrote:
> > 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

2010-12-31 21:55:22

by Avery Pennarun

[permalink] [raw]
Subject: Re: APM_CONFIG on x86 - Is it possible?

On Fri, Dec 31, 2010 at 1:40 PM, Yotam Medini <[email protected]> wrote:
> For a target ancient UMAX-ActionBook 530T, I am trying to compile
...
> 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.

> 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.

> 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

2010-12-31 22:05:52

by Yotam Medini

[permalink] [raw]
Subject: Re: APM_CONFIG on x86 - Is it possible?

On Fri, 31 Dec 2010 13:54:59 -0800
Avery Pennarun <[email protected]> wrote:

> > 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

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

2010-12-31 22:11:10

by Avery Pennarun

[permalink] [raw]
Subject: Re: APM_CONFIG on x86 - Is it possible?

On Fri, Dec 31, 2010 at 2:05 PM, Yotam Medini <[email protected]> wrote:
> On Fri, 31 Dec 2010 13:54:59 -0800
> Avery Pennarun <[email protected]> wrote:
>> > 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:
> ? ?$ 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

2010-12-31 22:23:38

by Randy Dunlap

[permalink] [raw]
Subject: Re: APM_CONFIG on x86 - Is it possible?

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
>
> 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.


> #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/