Cross Compiling Kernel Modules

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
2lss
Posts: 225
Joined: Sun 20 Sep 2009, 23:54

Cross Compiling Kernel Modules

#1 Post by 2lss »

Ok here is the deal. I've been working on this Dell xps m140 and its almost done, however the backlight refuses to cooperate. After trying everything imaginable, I discovered that I needed some dell userland tools to communicate with the smbios (or something like that :? ). Luckily I found some ubuntu debs with the needed components and installed them without problem, but they require some additional kernel modules to function; dell_rbu and dcdbas. So I downloaded the patched 2.6.30.5 kernel source for puppy 4.3 but I'm a little confused about how to build and install the modules. The machine in question is running a frugal install and doesn't have much horsepower so I figured I would build them on my x86-64 Ubuntu box. I've never actually built a kernel or modules before so I did some searching and found a few sites of interest.
http://www.gentoo.org/proj/en/base/embe ... t=1&chap=4
http://puppylinux.com/development/compilekernel.htm

From my understanding, I need something like.

Code: Select all

make mrproper
make ARCH="i686" CROSS_COMPILE="i686 GNU/Linux-" INSTALL_MOD_PATH="/media/sdb/kernel-src" menuconfig
make bzImage
After selecting the drivers in menuconfig and building bzImage,

Code: Select all

make ARCH="i686" CROSS_COMPILE="i686 GNU/Linux-" INSTALL_MOD_PATH="/media/sdb/kernel-src" modules
Then move flash drive(sdb) to the puppy machine, replace kernel image and then run.

Code: Select all

make modules_install
Before I give this a try, could somebody tell me if I'm on the right path? Or give some pointers? I would hate to go through everything and realize that I did something wrong :x

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#2 Post by tempestuous »

Yes, it's a worthwhile step in your Linux journey to learn how to compile a kernel. Start here -
http://www.puppylinux.com/development/compilekernel.htm

It looks like you're off to an over-complex start. If I understand correctly, you're compiling on x86 architecture for an x86 target, so there's no "cross-compiling" involved.

Here's a quick summary: extract your Puppy-compatible 2.6.30.5 kernel source into /usr/src
then

Code: Select all

cd /usr/src/linux-2.6.30.5
make menuconfig
This will present you with the kernel configuration menu.
Navigate into the "Firmware Drivers" section, and enable "Dell Systems Management Base Driver" (dcdbas) as an external module by pressing "m".

You could also enable "BIOS update support for DELL systems via sysfs" (dell_rbu)
but this sounds scary and unnecessary to me.
Exit the kernel configuration, saving changes. Now

Code: Select all

make bzImage
This will compile the kernle image, but it's unchanged from the normal Puppy kernel, so there's no need to install it.
Now the external kernel modules -

Code: Select all

make modules
make modules_install
Now you will have a new kernel module: dcdbas
This should be used in conjunction with the libsmbios library.

2lss
Posts: 225
Joined: Sun 20 Sep 2009, 23:54

#3 Post by 2lss »

Thank you tempestuous, this clears up some some of my confusion.
If I understand correctly, you're compiling on x86 architecture for an x86 target, so there's no "cross-compiling" involved.
My mistake, I thought that going from x86-64 to x86 was cross compiling.

I will give this a try later and see how it goes.

2lss
Posts: 225
Joined: Sun 20 Sep 2009, 23:54

#4 Post by 2lss »

Success!! The backlight now works!! :D

I followed the instructions and after 'make modules' I transfered the kernel source from my machine to the dell and ran make 'modules_install'. Everything past that was a breeze.

I did notice one problem but I don't know if there is anything I can do about it. 'modules_install' installs every module in the config and thus takes up a lot of room on the pup save file. Is there a way to only build and/or install the single module (dcdbas)?

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#5 Post by jemimah »

You just need to locate the new module and copy it into /lib/modules/2.6.30.5. Then run 'depmod -a'. You can make a pet of it to simplify things in the future and post it in case someone else needs it.

Post Reply