embedded linux - Cross compile kernel modules using kernel-headers from rootfs of target ARM board -


i have olinuxino board. downloaded archlinux img file (archlinuxarm-2013.02-olinuxino-rootfs.img) , wrote sd card using dd , booted board using card. connected board internet using ethernet , installed gcc , make on using pacman. able build userspace program board o n board.

the archlinux sd card image had kernel headers directory in rootfs (/lib/modules/linux-3.7.2-2-arch/build). , able build loadable kernel modules board on board too.

i have ubuntu 12.04.1 development pc. have installed sourcery codebench lite arm gnu/linux (arm-2012.09-64-arm-none-linux-gnueabi.bin) on it. able cross compile userspace programs olinuxino on development pc , transfer board on sftp , run on board (using console on ttyama0 serial port).

now want cross compile kernel modules olinuxino board. have done earlier custom build imx233 board - in case had configured kernel build system (ltib) leave kernel sources , rootfs intact after building image. way able specify kernel headers build directory cross compiling kernel module , worked.

this time olinuxino don't have build sources copied rootfs (using cp -dr) ubuntu pc , tried cross compiling hello world kernel module specifying kernel headers directory /lib/modules/linux-3.7.2-2-arch/build , threw following error:

anurag@anurag-virtualbox:~/helloks$ make make arch=arm cross_compile=arm-none-linux-gnueabi- -c /mnt/archol/lib/modules/3.7.2-2-       arch/build m=/home/anurag/helloks modules make[1]: entering directory `/mnt/archol/usr/src/linux-3.7.2-2-arch'   cc [m]  /home/anurag/helloks/khello.o /bin/sh: scripts/basic/fixdep: cannot execute binary file make[2]: *** [/home/anurag/helloks/khello.o] error 126 make[1]: *** [_module_/home/anurag/helloks] error 2 make[1]: leaving directory `/mnt/archol/usr/src/linux-3.7.2-2-arch' make: *** [all] error 2 

the fixdep binary in scripts folder precompiled arm, deleted binary , recompiled x86 , placed there. when tried cross compiling kernel module again, similar error thrown complaining executable in scripts folder (this time modpost).

my question how can replace these arm binaries in kernel-header / build folder x86 version? there script in build folder this? can replace scripts folder in copied archlinux scripts folder ubuntu's kernel module build folder? or modify kernel modules's makefile instruct build script rebuild binaries in scripts folder or use different scripts folder binary (i specify) path ubuntu's scripts folder in kernel headers folder? or going wrong way , there better way setup cross compilation board , setup have?

ps. fyi: cross compiler uses libc 2.16 , archlinux img olinuxino has libc 2.17 on it

i've compiled module without kernel sources, kernel headers. used qemu , arm version library files gcc-libs , glibc.

just copy on host's scripts directory override arm one, except mod/modpost program. edit mod/makefile.modpost run modpost program qemu-arm. if don't want change files, can of cause use aufs / overlayfs / bind mount achieve same.

set qemu_ld_prefix arm library files are, make sure qemu-arm .../modpost work. run make you've tried do.

if can read chinese, can read my experience here.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -