How to build a custom linux kernel module for OLPC

Wanted to get a Logitech USB webcam working on our Ubuntu + OLPC setup (for zoneminder).

See here for more information on how we setup ubuntu on the OLPC with zoneminder:
http://gctechspace.org/2012/01/zoneminder-on-an-old-olpc-xo-1/

When plugging in the logitech webcam on our ubuntu laptop, we notice the gspca_main and gspca_spca561 modules are loaded automatically. So these are the two we need to build for our OLPC kernel. From here

Grab the OLPC kernel via git:

git clone git://dev.laptop.org/olpc-kernel
cd olpc-kernel 
git checkout origin/olpc-2.6.31   # this bit confused me – git newb here! 

make clean distclean
make xo_1_defconfig
make menuconfig

Now go into the device drivers > media > video > usb gspca webcams and tick the modules you want to build. Then exit out and save the new kernel config when prompted. Now build our new kernel, and modules:

 

mv arch/x86/configs/xo_1_defconfig arch/x86/configs/xo_1_defconfig.original
cp .config arch/x86/configs/xo_1_defconfig # see the dot before config!
make clean distclean
make xo_1_defconfig
make

 

I came across an error and had to do this:

In arch/x86/vdso/Makefile :
replace “-m elf_x86_64” by “-m64” on the line starting with  VDSO_LDFLAGS_vdso.lds
replace “-m elf_x86” by “-m32” on the line starting with  VDSO_LDFLAGS_vdso32.lds

then run “make” again and your kernel should compile.

then run “make modules” and install modules in special tmp folder:

mkdir -p /tmp/xo/lib/modules
INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=/tmp/xo make modules_install
cd /tmp/xo
tar -cf lib.tar lib
scp lib.tar olpc@192.168.0.11:/tmp/ 

 

cd olpc-kernel/drivers/media/video/gspca/

scp gspca_main.ko gspca_spca561.ko olpc@192.168.0.11:/tmp/

Now ssh into the OLPC and place these modules in the right spot:

cd /lib/modules/2.6.31_xo1-20110320.1409.1.olpc.3d8536c28d6c5a1/kernel/drivers/media/video
mkdir gspca
mv /tmp/gspca* gspca/

 

Leave a Reply

Your email address will not be published. Required fields are marked *