LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 04-19-2007, 10:05 AM   #1
paradoxdruid
Member
 
Registered: Sep 2003
Distribution: Kubuntu 6.10 Edgy
Posts: 37

Rep: Reputation: 15
Question Patching kernel for Acer Travelmate C100


I finally got around to pulling my old Acer Travelmate C100 (an original Tablet PC!) out of storage and installing Kubuntu 6.10 on it, and it works like a charm, tablet functionality and all.

The problem is, the battery status doesn't work-- it says no battery is even connected. I'm apparently not the only person with this problem. On the Acer Travelmate C100 page on the Gentoo wiki, someone said:
Quote:
It was a hard fight to let the kernel accept ACPI support for my C100, it seems that its RSDP checksum is invalid and the kernel refuses to enable ACPI support because of this. Dean Townsley provided a patch forcing the kernel to use a more sophisticated routine to detect the ACPI data tables (it seems that there are two different functions existing) and voila - it works. While Ubuntu 6.06's Live CD accounts for this ACPI problem, an actual installation remains ignorant of the matter.
(emphasis mine) This is exactly what I encountered as well-- it worked on the Live CD, so I assumed it would on the install.

The patch they list to fix it is pretty short, but targeted against an older kernel.

What would be the easiest way to apply a similar fix to a 2.6.17 kernel? I'm good enough at linux to follow the howtos (like this one) to compile my own kernel, but not good enough to author a new diff file.


If anyone can help or has other ideas, I'd love to hear it. Thank you!

--
Paradoxdruid
 
Old 04-19-2007, 10:52 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
Quote:
Originally Posted by paradoxdruid
What would be the easiest way to apply a similar fix to a 2.6.17 kernel? I'm good enough at linux to follow the howtos (like this one) to compile my own kernel, but not good enough to author a new diff file.
--
Paradoxdruid
Well, as the patch seems not compatible; either you try on a mailing list related to acpi.
Or ubuntu as you seem to have tracked an easy way?
Or you author a new diff file...
The patch doesn't seem THAT complicated (I know it's relative but here you want to add linux support to something that has windows initially.. it is called hacking.. challenging) If you have a bit of experience in C, it should be possible; the hardest part has been done.
Print the patch, study it. Print the current arch/i386/kernel/acpi/boot.c and see how you can inject the patch in this file.
If you have no experience in C, you need to learn C.
Also you need to understand patch format (not hard at all).
-- means lines removed
++ means lines added
other ones are lines so that patch can resynchronise on fix lines.

Otherwise, keep your running kernel?

Last edited by nx5000; 04-19-2007 at 10:53 AM.
 
Old 04-19-2007, 11:02 AM   #3
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,714
Blog Entries: 1

Rep: Reputation: 221Reputation: 221Reputation: 221
Why not just use a 2.6.11 kernel and patch that?

You could try the patch against the 2.6.17 kernel. If the line numbers in the diff file don't match, patch scans both forwards and backwards for a set of lines matching the context given in the hunk. Maybe you'll get lucky and you've got nothing to lose.

The patch is pretty small, you could probably apply it by hand without much problem. This part tells you which file is affected
Code:
+++ linux-2.6.11/arch/i386/kernel/acpi/boot.c
This line tells you which lines in the original file are affected. Lines 506-533 beginning at line 506 in the original file becomes lines 506-512 in the new file. In other words, there were 21 lines removed from the original file.
Code:
@@ -506,27 +506,6 @@
The - shows the lines that were removed from the original file and the + shows what was added.

If you are successful at making the changes to the 2.6.17 kernel code, this will create a new patch that you can then share with the community
Code:
diff -Naur [old_file...] [new_file...] > [patch_name...].patch
 
Old 04-19-2007, 11:11 AM   #4
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
Hummm
Try it but I'm pessimistic...


I ignored a bit this part
Quote:
This is exactly what I encountered as well-- it worked on the Live CD, so I assumed it would on the install.
Make a copy of your problematic /boot/vmlinuz... and /lib/modules/2.6xxx
Copy the vmlinuz and /lib/modules/2.6xxx from the CD to the disk.
Pray & Reboot
 
Old 04-19-2007, 11:21 AM   #5
paradoxdruid
Member
 
Registered: Sep 2003
Distribution: Kubuntu 6.10 Edgy
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Arow
You could try the patch against the 2.6.17 kernel. If the line numbers in the diff file don't match, patch scans both forwards and backwards for a set of lines matching the context given in the hunk. Maybe you'll get lucky and you've got nothing to lose.
No luck, unfortunately. Many of the hunks fail.

Quote:
The patch is pretty small, you could probably apply it by hand without much problem. This part tells you which file is affected
Code:
+++ linux-2.6.11/arch/i386/kernel/acpi/boot.c
This line tells you which lines in the original file are affected. Lines 506-533 beginning at line 506 in the original file becomes lines 506-512 in the new file. In other words, there were 21 lines removed from the original file.
Code:
@@ -506,27 +506,6 @@
The - shows the lines that were removed from the original file and the + shows what was added.
Thanks for the help. I know most of the diff schema, but I didn't understand the @@ markers. I'll try applying it by hand.

Side note, I double-posted this thread to the Ubuntu subforum because I wasn't sure where the best fit was. A moderator closed that thread, so I can't apologize there. But I didn't mean to forum spam!

Thanks for all the help so far, everyone!
 
Old 04-19-2007, 12:09 PM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
Quote:
Originally Posted by paradoxdruid
A moderator closed that thread, so I can't apologize there. But I didn't mean to forum spam!
Standard rule. They can't differenciate between spam and non-spam..
I thought posting an an ubuntu-only forum. Probably that there are more ubuntu gurus overthere..
An idea (if I understood well that one kernel works)
If you take my debian source kernel, it comes like this:
vanilla kernel
+
list of patches

Try to get the source package of your working kernel, maybe you get the patch already done?



Have fun!
 
Old 04-22-2007, 05:48 PM   #7
paradoxdruid
Member
 
Registered: Sep 2003
Distribution: Kubuntu 6.10 Edgy
Posts: 37

Original Poster
Rep: Reputation: 15
I did it!

I manually applied the patch that Dean Townsley wrote (from the Gentoo Hardware Wiki) to the linux-source-2.6.20 from the Ubuntu repositories.

After making my kernel packages and installing them, it works like a charm-- now I see battery status, and I can control the dynamic CPU frequency changes.

So I followed your instructions to turn my changes into a patch file to share with the community, attached below. I'll see if I can get it to the Acer Travelmate C100 pages across the web.

Quote:
--- linux-source-2.6.20/arch/i386/kernel/acpi/boot.c 2007-04-12 10:15:46.000000000 -0700
+++ linux/arch/i386/kernel/acpi/boot.c 2007-04-22 10:21:34.000000000 -0700
@@ -600,24 +600,7 @@

EXPORT_SYMBOL(acpi_unregister_ioapic);

-static unsigned long __init
-acpi_scan_rsdp(unsigned long start, unsigned long length)
-{
- unsigned long offset = 0;
- unsigned long sig_len = sizeof("RSD PTR ") - 1;

- /*
- * Scan all 16-byte boundaries of the physical memory region for the
- * RSDP signature.
- */
- for (offset = 0; offset < length; offset += 16) {
- if (strncmp((char *)(phys_to_virt(start) + offset), "RSD PTR ", sig_len))
- continue;
- return (start + offset);
- }
-
- return 0;
-}

static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
{
@@ -753,21 +736,11 @@

unsigned long __init acpi_find_rsdp(void)
{
+ struct acpi_pointer addr;
unsigned long rsdp_phys = 0;

- if (efi_enabled) {
- if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
- return efi.acpi20;
- else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
- return efi.acpi;
- }
- /*
- * Scan memory looking for the RSDP signature. First search EBDA (low
- * memory) paragraphs and then search upper memory (E0000-FFFFF).
- */
- rsdp_phys = acpi_scan_rsdp(0, 0x400);
- if (!rsdp_phys)
- rsdp_phys = acpi_scan_rsdp(0xE0000, 0x20000);
+ if (!ACPI_FAILURE(acpi_find_root_pointer(ACPI_PHYSICAL_ADDRESSING,&addr)))
+ rsdp_phys=addr.pointer.physical;

return rsdp_phys;
}


--- linux-source-2.6.20/arch/i386/mach-es7000/es7000plat.c 2007-04-12 10:15:46.000000000 -0700
+++ linux/arch/i386/mach-es7000/es7000plat.c 2007-04-22 10:25:08.000000000 -0700
@@ -35,6 +35,7 @@
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/acpi.h>
+#include <linux/efi.h>
#include <asm/io.h>
#include <asm/nmi.h>
#include <asm/smp.h>
@@ -91,6 +92,52 @@
ioapic_renumber_irq = es7000_rename_gsi;
}

+
+ static unsigned long __init
+ es7000_acpi_scan_rsdp (
+ unsigned long start,
+ unsigned long length)
+ {
+ unsigned long offset = 0;
+ unsigned long sig_len = sizeof("RSD PTR ") - 1;
+
+ /*
+ * Scan all 16-byte boundaries of the physical memory region for the
+ * RSDP signature.
+ */
+ for (offset = 0; offset < length; offset += 16) {
+ if (strncmp((char *) (start + offset), "RSD PTR ", sig_len))
+ continue;
+ return (start + offset);
+ }
+
+ return 0;
+ }
+
+
+ unsigned long __init
+ es7000_acpi_find_rsdp (void)
+ {
+ unsigned long rsdp_phys = 0;
+
+ if (efi_enabled) {
+ if (efi.acpi20)
+ return __pa(efi.acpi20);
+ else if (efi.acpi)
+ return __pa(efi.acpi);
+ }
+ /*
+ * Scan memory looking for the RSDP signature. First search EBDA (low
+ * memory) paragraphs and then search upper memory (E0000-FFFFF).
+ */
+ rsdp_phys = es7000_acpi_scan_rsdp (0, 0x400);
+ if (!rsdp_phys)
+ rsdp_phys = es7000_acpi_scan_rsdp (0xE0000, 0xFFFFF);
+
+ return rsdp_phys;
+ }
+
+
/*
* Parse the OEM Table
*/
@@ -166,7 +213,8 @@
int i;
struct acpi_table_sdt sdt;

- rsdp_phys = acpi_find_rsdp();
+ /* FIXME -- can we use the general acpi_find_rsdp() ? */
+ rsdp_phys = es7000_acpi_find_rsdp();
rsdp = __va(rsdp_phys);
if (rsdp->rsdt_address) {
struct acpi_table_rsdt *mapped_rsdt = NULL;
Not really much work at all-- the only reason that Dean's patch wouldn't still work is that the context cues in his patch file aren't current enough for patch to deduce where to make the changes.

Thanks for the help, all!
 
Old 04-22-2007, 08:06 PM   #8
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,714
Blog Entries: 1

Rep: Reputation: 221Reputation: 221Reputation: 221
Told ya'. Thanks for helping the community.
 
Old 04-23-2007, 05:20 AM   #9
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
Thumbs up

Well done!
 
  


Reply

Tags
acer, acpi, battery, compile, kernel, laptop, patch, travelmate, ubuntu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best os for Acer C100 tonycampos Linux - Laptop and Netbook 14 04-09-2011 02:54 AM
acpi and acer travelmate c100 chopp Linux - Laptop and Netbook 3 10-30-2006 11:02 PM
Mandriva 10.0 on Acer Travelmate 2413WLMin(travelmate 2410 series). Wireless... apolishch Linux - Laptop and Netbook 2 06-05-2006 08:03 AM
config xorg for Acer c100 tablet device bb002 Linux - Software 1 10-03-2005 01:50 AM
Acer TravelMate 3201XMi inglor Linux - Laptop and Netbook 0 02-13-2005 03:42 PM


All times are GMT -5. The time now is 08:03 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration