Hello all,

I'm using linux 2.6.11 on the Triton module (PXA270). This is an ARM architecture processor.

My host machine is running on Debian etch 4.0.
I was able to install arm-linux cross compiler ver. 3.4.3 and build linux kernel, which is now running on the PXA module.
On my host machine I've got access to all modules and source code of this linux.

I'm trying to cross-compile simple program (cam from cam.c), which is using routine from driver implemented as kernel module (this is i2c-dev.ko).

cam.c source code:
#include <linux/i2c.h> // I need -D__KERNEL__ flag to include this header file

int
main ()
{
struct i2c_client camera;

i2c_attach_client(&camera);

return 0;
}

some comments:
struct i2c_client camera; //struct i2c_client is defined in <linux/i2c.h>
i2c_attach_client(&camera); // its implementation is in i2c-dev.c -> from which was build i2c-dev.ko
I was trying to cross-compile it (create static -.a or dynamic - .so library from i2c-dev.c) on the host computer , but I've received :
cam.o(.text+0xc): In function `main':
/home/majess/Praca/TRITON/cam_drv/cam.c:8: undefined reference to `i2c_attach_client'
collect2: ld returned 1 exit status

This means that I'm not able to link the 'i2c_attach_client' function to this program.

Does anybody have any idea how to solve this problem (how to map the function defined at ARM - target linux loadable module (.ko file) to host cross-compilator to compile program)?

Thanks for and reply/hint,
Lukasz Majewski

p.s. I'm a novice , so if it's possible use straight and simple language. )