sidux.com

sidux-Kernelhacking - building a kernel with patches for eeePC

taranaki - May 09, 2008 - 07:38 AM
Post subject: building a kernel with patches for eeePC
I would like to build a new sidux kernel derivative to get rid of an annoying supend/resume problem with my eeePC p701. Enabling USB_PERSIST and including some other patches should do the trick. Without these modifications I am not able to able to resume from suspend (S3) if /home is installed on a SD card (USB device). This feature is absolutely necessary for me.

With the adapted 26.24.2 kernel from http://mbm.openwrt.org/eee/ sidux nyx lite starts fine into KDE but without any screen output till kdm starts. It seems that the text mode is somehow broken which renders this kernel unusable. I am also not sure if an Ubuntu kernel is a good basis for a sidux system. Anyway, suspend/resume works like a charm with my configuration and even the value for screen brightness is preserved during system startup and suspend/resume.

But I was talking about taking the gravel road to a shiny new sidux eee kernel.

As far as I understood I must "simply" alter the kernel sources with some patches provided by Greg Kroah-Hartman:

http://linux.derkeiler.com/Mailing-Lists/Kernel/2008-03/msg04163.html

Needless to say I have no idea how to do this.

After reading the not-up-to-date wiki entry "compiling a kernel the sidux way" I still have several questions:

1) Is apt-get install linux-source-sidux-2.6.25 sufficient or do I need more packages like kbuild...?
2) How to apply the patches mentioned above?
3) Is it advisable to further tweak the .config e.g. by omitting drivers not needed? Can an
4) make fast or make realfast does not work. How can I build kernel image, headers and modules? I tried "make deb-pkg" before which could be only done als root. Only the kernel image was created.
5) what about "kernel headers"? Do I really need headers and modules?

My apologies if some or all of my questions are stupid. I am a complete novice to kernel stuff...

Any help will be greatly appreciated.

Best regards,

taranaki
dibl - May 10, 2008 - 07:47 PM
Post subject: Re: building a kernel with patches for eeePC
taranaki wrote:
I would like to build a new sidux kernel derivative to get rid of an annoying supend/resume problem with my eeePC p701. Enabling USB_PERSIST and including some other patches should do the trick.

I am a complete novice to kernel stuff...



Me too. I have the same model Eee PC, and a 16GB SDHC card. But, I thought this says the bug is fixed in 2.6.25-1, as of 28 APR:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468213

Is it not really fixed, or is it just not included in the sidux/slh kernel?

I did not make /home a separate partition on my setup -- it is still part of the sidux filesystem on the SSD. But, I made a 2.8GB swap space on the SDHC card (I have a 2GB SO-DIMM), so I could use S2RAM. It actually does work, but when I wake it up, the SDHC card is of course not mounted. So, I have to open the console, become root, and issue
Code:
mount -a
and then I'm back in business. It's a little clunky -- it would be great to be able to skip that last little console exercise when resuming the PC.

Good luck - I'd help if I had a clue about compiling kernels, but I don't. Embarassed
ralul - May 10, 2008 - 09:32 PM
Post subject: --- Some hints for building a kernel ---
taranaki wrote:
I am also not sure if an Ubuntu kernel is a good basis for a sidux system. Anyway, suspend/resume works like a charm with my configuration

The .config of an Ubuntu kernel 2.6.24 can harm the configuration making with
make menuconfig
of a knewer kernel 2.6.25 (... so i have heard). My trick was to have two screens in a Kde-konsole with menuconfig of both kernels and looking and changing with shift-left/right constantly.
taranaki wrote:

3) Is it advisable to further tweak the .config e.g. by omitting drivers not needed?

It is not much gain in starting up time with a thiner kernel, and you loose perhaps some functionality when omitting modules. But you gain experience ... And you get a glitch of a grip what you can all manage with the hundreds of options and modules of the new kernel...
taranaki wrote:

4) make fast or make realfast does not work. How can I build kernel image, headers and modules? I tried "make deb-pkg" before which could be only done als root. Only the kernel image was created.

copy the source to ~/src
and the /usr/src/Makefile to ~/src/Makefile
and edit it like my diff output shows you:
Code:

diff /usr/src/Makefile ~/src/Makefile
14c14
< all:  fast
---
> all:  realfast
42c42
< realfast: clean oldconfig
---
> realfast: clean
44c44
<               make-kpkg --rootcmd fakeroot --revision ${REV} ${INITRD} --us --uc kernel_image modules
---
>               make-kpkg --rootcmd fakeroot --revision ${REV} ${INITRD} --us --uc kernel_image kernel_headers modules

As you can see i do not like "oldconfig" as i carefully do a "make menuconfig" in
~/src/linux
which is the mandatory symbolic link to
~/src/linux-source-sidux-2.6.25
before i do a "make realfast" in
~/src
taranaki wrote:

5) what about "kernel headers"? Do I really need headers and modules?

I also do install the headers as you can see above ... just in case i want to get rid of the build tree
~/src/linux-source-sidux-2.6.25
------------------------------------------
Some needed packages are:
kbuild
linux-support-sidux-2.6
sidux-modules (you do: tar xjf /usr/src/modul-source in ~/src)
linux-source-sidux-2.6.25 (do as above)
linux-tree-sidux-2.6.25
kernel-package
libncurses-dev
gcc
make
fglrx-kernel-src (or some nvidia stuff)
.... some more ...? If you know the differences of debian upgrades and installs you are allowed to use aptitude for fresh installs of dev-packages. Examine the packages above in aptitude and what other packages depend on them. Then you will see what other packages you need for the job.

Look Five steps to your own kernel at
http://sidux.com/PNphpBB2-viewtopic-t-10533.html
taranaki - May 19, 2008 - 12:24 PM
Post subject: problems with module-assistant
After having a hard time I was finally able to build a kernel (linux-image-2.6.25-4.slh.2-eee.1) and headers where USB_PERSIST actually works. All patches from Greg Kroah-Hartman mentioned in my first post were included. I will post "my way to a eeepc friendly sidux kernel" later on in this thread but there are still some problems to solve:

The kernel, headers and atl2 module install flawlessly on the eeePC, and there is no problem booting into this new kernel. But trying to build the modules for webcam, wlan, acpi fails (using Raider700's script).

Code:
module-assistant prepare

shows no errors.

Here is the outpuf of /var/cache/modass:
Code:

for templ in ; do \
    cp $templ `echo $templ | sed -e 's/_KVERS_/2.6.25-4.slh.2-eee1/g'` ; \
  done
for templ in `ls debian/*.modules.in` ; do \
    test -e ${templ%.modules.in}.backup || cp ${templ%.modules.in} ${templ%.modules.in}.backup 2>/dev/null || true; \
    sed -e 's/##KVERS##/2.6.25-4.slh.2-eee1/g ;s/#KVERS#/2.6.25-4.slh.2-eee1/g ; s/_KVERS_/2.6.25-4.slh.2-eee1/g ; s/##KDREV##/1/g ; s/#KDREV#/1/g ; s/_KDREV_/1/g  ' < $templ > ${templ%.modules.in}; \
  done
dh_clean
/usr/bin/make clean
make[1]: Entering directory `/usr/src/modules/eeepc-acpi'
rm -rf *.o *.ko .*.cmd .*.flags *.mod.c Module.symvers .tmp_versions
make[1]: Leaving directory `/usr/src/modules/eeepc-acpi'
/usr/bin/make  -f debian/rules kdist_clean kdist_config binary-modules
make[1]: Entering directory `/usr/src/modules/eeepc-acpi'
for templ in ; do \
    cp $templ `echo $templ | sed -e 's/_KVERS_/2.6.25-4.slh.2-eee1/g'` ; \
  done
for templ in `ls debian/*.modules.in` ; do \
    test -e ${templ%.modules.in}.backup || cp ${templ%.modules.in} ${templ%.modules.in}.backup 2>/dev/null || true; \
    sed -e 's/##KVERS##/2.6.25-4.slh.2-eee1/g ;s/#KVERS#/2.6.25-4.slh.2-eee1/g ; s/_KVERS_/2.6.25-4.slh.2-eee1/g ; s/##KDREV##/1/g ; s/#KDREV#/1/g ; s/_KDREV_/1/g  ' < $templ > ${templ%.modules.in}; \
  done
dh_clean
/usr/bin/make clean
make[2]: Entering directory `/usr/src/modules/eeepc-acpi'
rm -rf *.o *.ko .*.cmd .*.flags *.mod.c Module.symvers .tmp_versions
make[2]: Leaving directory `/usr/src/modules/eeepc-acpi'
make[1]: Für das Ziel »kdist_config« ist nichts zu tun.
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs lib/modules/2.6.25-4.slh.2-eee1/misc
# build module
/usr/bin/make -C /usr/src/modules/eeepc-acpi KSRC=/usr/src/linux-headers-2.6.25-4.slh.2-eee1
make[2]: Entering directory `/usr/src/modules/eeepc-acpi'
make[3]: Entering directory `/usr/src/linux-headers-2.6.25-4.slh.2-eee1'
/usr/src/linux-headers-2.6.25-4.slh.2-eee1/arch/x86/Makefile:41: /usr/src/linux-headers-2.6.25-4.slh.2-eee1/arch/x86/Makefile_32.cpu: Datei oder Verzeichnis nicht gefunden
make[3]: *** Keine Regel, um »/usr/src/linux-headers-2.6.25-4.slh.2-eee1/arch/x86/Makefile_32.cpu« zu erstellen.  Schluss.
make[3]: Leaving directory `/usr/src/linux-headers-2.6.25-4.slh.2-eee1'
make[2]: *** [all] Fehler 2
make[2]: Leaving directory `/usr/src/modules/eeepc-acpi'
make[1]: *** [binary-modules] Fehler 2
make[1]: Leaving directory `/usr/src/modules/eeepc-acpi'
make: *** [kdist_build] Fehler 2


How can I compile the modules?

For compiling the kernel I used the original parameters from slh for this kernel for .config. Maybe it is due to 686-386 problem. The deb-package reads: "linux-image-2.6.25-4.slh.2-sidux-686-eee.1_1_i386.deb"

I kindly ask for your help (slh?) to solve this issue. Any hints appreciated.


taranaki
taranaki - Jun 12, 2008 - 09:23 AM
Post subject: HOW-TO
All steps can be done on a more powerful machine than the eeepc.


1) download sources
apt-get install
linux-source-sidux-2.6.25
kbuild
linux-support-sidux-2.6
sidux-modules
linux-tree-sidux-2.6.25
kernel-package
libncurses5-dev
qt3-apps-dev
gcc
make
fakeroot

2) prepare directories
as standard user

mkdir ~/src
cd ~/src
tar xjf /usr/src/linux-source-sidux-2.6.25.tar.bz2
tar xjf /usr/src/needed-modul-source-name.bz2 #if needed
ln -s -f ~/src/linux-source-sidux-2.6.25 linux
cp /usr/src/Makefile .

3) adapt Makefile
as standard user

kwrite ~/src/Makefile #edit to your needs
Code:

[...]
.PHONY: fast
fast: clean oldconfig
   cd ${BASE_DIR}/linux && \
      make-kpkg --rootcmd fakeroot --revision ${REV} ${INITRD} --us --uc kernel_image kernel_headers kernel_doc modules kernel_source

.PHONY: realfast
realfast: clean
   cd ${BASE_DIR}/linux && \
      make-kpkg --rootcmd fakeroot --revision ${REV} ${INITRD} --us --uc kernel_image kernel_headers modules kernel_source
[...]


kwrite ~/src/linux/Makefile #edit line4, i.e.: EXTRAVERSION = -sid.[debian version number]-eee[n] [do not use "slh" since it is not longer a plain sidux kernel]


4) apply USB_PERSIST patches
as standard user

Apply the Greg Kroah-Hartman USB_PERSIST patches (http://linux.derkeiler.com/Mailing-Lists/Kernel/2008-03/msg04163.html) by placing the files patch[n],eee in ~/src and typing as user in ~/src/linux
Code:
patch -Np1 -i ../patch[n].eee


5) apply eeepc specfic patches
as standard user

(http://nathancoulson.com/proj_eee.shtml)

Place patch files from Nathan Coulson's site in ~/src

Quote:
* linux-2.6.25-eeepc_ata_piix_fix-1.patch: Kernel patch to allow the onboard SSD Drive to run at full speed. Obtained from http://lkml.org/lkml/2008/4/20/283. Merged upstream since 2.6.26-rc1
* atl2-2.0.4.patch.bz2: Kernel patch for atl2 wired ethernet adapter. Obtained from http://people.redhat.com/csnook/atl2/. As of 2.6.26-rc1, it has not yet been merged into the kernel..
* linux-2.6.25-eeepc_linux-base: It is a platform driver (/sys/devices/platform/eeepc/) which supports: - hotkeys - wlan on/off - camera on/off - cardr on/off. Note that the origional patch from asus used the /proc/acpi/asus location for these values. Obtained from linux-acpi upstream. Merged upstream since 2.6.26-rc1.
* linux-2.6.25-eeepc_linux-backlight: This patch adds a backlight class support to the eeepc_laptop driver patch above. Obtained from linux-acpi upstream Merged upstream since 2.6.26-rc1.
* linux-2.6.25-eeepc_linux-fan-hwmon: This patch adds a hwmon interface to control the fan, to the eeepc_laptop driver patch above. Obtained from linux-acpi upstream. Merged upstream since 2.6.26-rc1.

patch the linux kernel with the atl2 Wired Ethernet patch

* patch -Np1 -i ../atl2-2.0.4.patch

patch the kernel with the eeepc_ata_piix_fix-1 patch

* patch -Np1 -i ../linux-2.6.25-eeepc_ata_piix_fix-1.patch

patch the linux kernel with the eeepc platform drivers

* patch -Np1 -i ../linux-2.6.25-eeepc_linux-base.patch

* patch -Np1 -i ../linux-2.6.25-eeepc_linux-backlight.patch

* patch -Np1 -i ../linux-2.6.25-eeepc_linux-fan-hwmon.patch

Unzip the madwifi r3366 source in ~/src to create ~/src/madwifi-nr-r3366+ar5007. Run the kernel patch program from within the madwifi directory

* cd patch-kernel && ./install.sh ../../linux


Edit the (empty) file ~/src/linux/drivers/net/wireless/madwifi/svnversion.h and insert

Code:
#define SVNVERSION "svn r3366"


All patch files are attached for your convenience

6) build the kernel
as standard user

Use eeepc optimized .config file derived from Nathan Coulson's page and slh's config (see attachement) and place it in ~/src/linux/

make xconfig #OPTIONAL, for additional tweaks

cd ~/src
make fast

drink coffee
drink more coffee

7) installing the new kernel

as super user (on eeepc, of course)

dpkg -i linux-image*.deb
dpkg -i linux-head*.deb

Everything is ready now. Restart your eee to boot into your new kernel.

8 ) Post install fixes

- edit /etc/default/eeepc-acpi-scripts: select "Master" for ALSA, OSD if needed
- change path in acpi-scripts from /proc/acpi/asus to /sys/devices/platform/eeepc
- place "rmmod snd-hda-intel" in /etc/init.d/halt

What works:
- USB persist after suspend/resume
- Wireless (integrated in kernel, r3366)
- Webcam
- Sound
- ACPI
- CPU throttling (?)


To do:
- further .config improvements, if needed
- integrate the new hal driver into the kernel (can be solved by deactivating CONFIG_ATHEROS in .config and compile it as a module
- compile the eee module (I do not really need it)


Any comments and suggestions welcome.
taranaki - Jun 19, 2008 - 11:49 AM
Post subject: RE: HOW-TO
The precompiled kernel image, full source and docs are now ready for download. Kernel headers do not work at the moment (see http://sidux.com/PNphpBB2-viewtopic-t-11109.html) and were therefore omitted.

http://mywebserver.servebbs.com/webspace/taranaki/

Username and Password on request.
wolfsohn - Jul 12, 2008 - 02:33 AM
Post subject:
Workaround for "kernel-package" for working "kernel-headers":

http://sidux.com/PNphpBB2-viewtopic-t-1 ... ckage.html

Have Fun!

wolfsohn
All times are GMT
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits