0

What I need to cross compile is the USB gadget serial driver (g_serial.ko). I have my toolchain installed and checked out the sources from kernel.org. Now what to do to just compile that single module? Thanks in advance!!

tzippy
  • 6,458
  • 30
  • 82
  • 151
  • You know you need to compile kernel once anyway right? – auselen May 13 '13 at 13:42
  • Yeah, I figured I need to run make oldconfig once. But there's a lot of settings and I'm not quite sure about some of them. – tzippy May 13 '13 at 13:47
  • Actually it's the first time Im compiling the kernel. Do I need to run a patch for arm on the kernel because when I run make oldconfig, I can't choose any ARM processors in the "processor family" menu. – tzippy May 13 '13 at 13:53
  • Every device is different, so you need to find some pointers for configuration of your device. A previous built, some web page for the same device. To repeat again, ARM devices are not generic and Linux kernel doesn't have stable API for modules (http://www.kroah.com/log/linux/stable_api_nonsense.html) – auselen May 13 '13 at 14:12
  • 1
    As per [federico](http://stackoverflow.com/users/423795/federico), you need to set **CROSS_COMPILE** and `ARCH=arm` when running `make oldconfig`. If you don't the `make` / the **kbuild** system will default to a *x86-linux-pc* when run from such an environment. – artless noise May 13 '13 at 20:03

1 Answers1

1

From the kernel source directory

make ARCH=arm CROSS_COMPILE=/your/cross/compile/prefix M=path/to/module/directory

or

make ARCH=arm CROSS_COMPILE=/your/cross/compile/prefix path/to/module/directory
Federico
  • 3,782
  • 32
  • 46
  • +1 [How ko is built](http://stackoverflow.com/questions/16511672/how-ko-file-is-built), and others; they are all slight variations of the same principals. – artless noise May 13 '13 at 14:01