title: Building kernel module for Android
body: <p>I need to add the FTDI USB module to the Android kernel (Android 2.3.1, Linux 2.6.32), so I got the 2.6.32 kernel and tried to build the module:</p>
  
  <pre><code>make modules ARCH=arm CROSS_COMPILE=arm-none-eabi-
  </code></pre>
  
  <p>But when I tried to do 'insmod ftdi_sio.ko', the error message was</p>
  
  <pre><code>insmod: init_module 'ftdi_sio.ko' failed (Exec format error)
  </code></pre>
  
  <p>In dmesg's output I found this</p>
  
  <pre><code>ftdi_sio: version magic '2.6.32.27 preempt mod_unload ARMv5 ' should be '2.6.32.27 preempt mod_unload ARMv7 '
  </code></pre>
  
  <p>I tried to add 'armv7-a' flag (as I read in Android NDK docs)</p>
  
  <pre><code>make modules ARCH=arm CROSS_COMPILE=arm-linux-androideabi- CFLAGS='-march=armv7-a -mfloat-abi=softfp'
  </code></pre>
  
  <p>Also, I tried following cross-compilers: arm-none-eabi-, arm-eabi-, arm-linux-android-eabi-</p>
  
  <p>Every time result was the same - ARMv5 in the version magic.
  How can I build the module for ARMv7?</p>