Cross-Compiling Modules/Drivers for ARM?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

I am trying to build a device driver as a Linux module for an ARM
architecture.  I have the ARM kernel configured and built, a cross-
compiling toolchain to compile, as well as the driver's sources.  The
trouble I am having is specifying the location of the kernel sources
and which compiler to use for the makefile.  Could someone please run
me though the steps (makefile operations) for simply building the
module using the ARM kernel source tree and the cross-compiler
toolset?

Thanks in advance.


Re: Cross-Compiling Modules/Drivers for ARM?

Refer to this chapter by arm-linux official site, which describes full
detailed steps of compiling the kernel. You can find the way to compile
kernel modules too.
http://www.arm.linux.org.uk/docs/kerncomp.php

Also there's various choices of toolchains for use. A brief description
of this can be found at:
http://www.arm.linux.org.uk/developer/toolchain /

Denx's ELDK is a good choice for arm-based cross-compile and development.
The latest release of ELDK is 4.1.See this at:
http://www.denx.de/en/News/WebHome

snipped-for-privacy@gmail.com wrote:

Quoted text here. Click to load it


Re: Cross-Compiling Modules/Drivers for ARM?

Quoted text here. Click to load it

Assuming you are talking about a 2.6.x kernel, the driver
makefile will use the kernel build system.

You'll probably have to look into the makefile to see
where it gets the kernel directory from. You'll see
something like

obj-m := yourdriver.o
...
modules:
        $(MAKE) -C /path/to/the/kernel SUBDIRS=$(PWD) modules

The path_to_the_kernel could be a variable, like $(KERNELSRC),
which may be defined further up in the Makefile. If not, you have
to pass it to make on the command line.

So, to build your driver you do

#> CROSS_COMPILE=arm-linux- ARCH=arm make
or
#> CROSS_COMPILE=arm-linux- ARCH=arm KERNELSRC=/path/to/the/kernel make

Make sure the 'bin' directory of your cross compiler (arm-linux-gcc) is
in your PATH. If your cross compiler is not known as arm-linux-gcc, change
the CROSS_COMPILE variable accordingly.

Kind regards,

Iwo


Site Timeline