View Single Post
Posts: 85 | Thanked: 29 times | Joined on Jan 2008
#8
Hi,

I've set up a development environment in order to compile the apple module for the kernel.

A couple of observations:

In the wiki it is said that for external kernel modules, kernel headers will suffice:
Code:
[sbox-MaemoKernel: ~/maemo_kernel] > fakeroot apt-get install kernel-headers
However, this package cannot be found.

So I resorted to compiling the module against the full source. Let's get the source.

Code:
[sbox-MaemoKernel: ~/maemo_kernel ] > apt-get source kernel
Now let's configure the source tree.

Code:
sbox-MaemoKernel: ~/maemo_kernel ] > cd kernel-2.6.28
[sbox-MaemoKernel: ~/maemo_kernel/kernel-2.6.28] > make EXTRAVERSION=-omap1 rx51_defconfig
Let's grab the latest hid-apple.c and the latest hid-ids.h form the kernel gitweb, adapt the Makefile:

Code:
# Makefile for building the hello kernel module outside the kernel tree

KERNELDIR := /usr/src/maemo_kernel/kernel-2.6.28

obj-m := hid-apple.o

# default build target (uses kernel build (kbuild) system)
all:
	$(MAKE) -C $(KERNELDIR) M=`pwd` EXTRAVERSION=-omap1 modules

# target for cleaning up
clean:
	$(RM) *.o .depend .*.cmd *.ko *.mod.c Module.symvers modules.order
	$(RM) -R .tmp_versions
Compiling the module is OK. Now let's put it on the device and do a :

Code:
Nokia-N900-42-11:/home/user# insmod hid-apple.ko 
insmod: error inserting 'hid-apple.ko': -1 Invalid module format
Not good. Let's go back to scratchbox and strip the version info in case the problem stems from a slight version mismatch:

Code:
[sbox-FREMANTLE_ARMEL: ~/maemo_kernel/apple-module] > objcopy --strip-debug \ 
-R .modinfo -R __versions apple-hid.ko
And on the device:

Code:
Nokia-N900-42-11:/home/user# insmod hid-apple.ko 
insmod: error inserting 'hid-apple.ko': -1 Unknown symbol in module
Any advice?

Thanks, Ulysses
 

The Following 3 Users Say Thank You to Ulysses For This Useful Post: