Buildroot compiling driver

buildrootcompilingdrivers

I'm using Buildroot for compiling embedded linux. It works well because I have target Makefile configurations, but now I need driver for my usb devices. I manage to compile Qt appilactions(c++) on my host linux to target linux by using buildroots /output/host/usr/bin/arm-none-linux-gnueabi-c++ . Works well.

Now I'm trying to compile c-files for this driver.

I'm calling it like:

/output/host/usr/bin/arm-none-linux-gnueabi-gcc -Wall -D__KERNEL__ -DMODULE -I/home/buildroot-2012.08/output/build/linux-2.6.35.3/include -DMODVERSIONS -include /home/buildroot-2012.08/output/build/linux-2.6.35.3/include/config/modversions.h -I /home/buildroot-2012.08/output/build/linux-2.6.35.3/drivers/usb/serial/ -O   -c -o ftdi_sio.o ftdi_sio.c

I'm getting error:

output/build/linux-2.6.35.3/include/linux/linkage.h:5: fatal error: asm/linkage.h: No such file or directory

  1. How I should configurate the driver compiling?
  2. Is there some other way to do it for target linux. Mayby I'm not doing it the right way.

Best Answer

asm/ is a symbolic link to your target architecture, if it doesn't exist probably you're missing some target in your kernel build directory, configure (if not, maybe just module_headers can make it)

It is not clear from your question if you're using the command line, a custom Makefile, or a Buildroot package (which version of Buildroot are you using).

Your command line is building a C object .o not a kernel module (.o was the extension for kernel modules till the version 2.4, from 2.6 it is .ko)

If you are not sure about the flags increase the verbosity for the build of the kernel modules, build and log, then use the same.

The kernel have its way to build modules and the Buildroot have its way for packages, the best is probably to create a new package to build your module (take a look if there's already some other package that build a module).

This example is a bit old but maybe help.

edit

The ftdi_sio.ko module is generated into the directory /lib/modules/$(uname -r)/kernel/drivers/usb/serial/

But it could be configured as builtin also, so that no .ko is generated, check the symbol USB_SERIAL_FTDI_SIO in your configuration (should be y for builtin m for module).

If it is builtin or inserted there should be a /proc interface at runtime on the target called ftdi_sio, find it.

Related Question