Compiling Your Own G1 Kernel Modules

I promised to talk about building the tethering binaries instead of using mine, so here you go. Most of it is built as part of the Android source build (and all of it comes from the upstream Android sources) so I'm just going to cover the more general case of building kernel modules for the G1.

We'll use bnep.ko as an example, thereby killing 2 birds with one stone. It's pretty simple to do:
- Get the kernel source for the G1 and the Android source
- Get the existing kernel config:

$ adb pull /proc/config.gz config.gz
$ gunzip config.gz
(doesn't require root, although installing the new module later does..)
- edit .config and set the version string: (get it from /proc/version on the phone)
CONFIG_LOCALVERSION="-01843-gfea26b0"
CONFIG_LOCALVERSION_AUTO=n

- Configure the kernel:
$ EXPORT CCOMPILER=$PATH_TO_SOURCES/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
$ make ARCH=arm CROSS_COMPILE=$CCOMPILER menuconfig

** enable BNEP as a module (under Networking -> Bluetooth -> BNEP)
** If you are building a full kernel, enable RFKill (Networking -> Y to RF switch subsystem support)
- Build the new module(s):
$ make ARCH=arm CROSS_COMPILE=$CCOMPILER modules

- Copy your files over and load them:
$ adb remount
$ adb push net/bluetooth/bnep/bnep.ko /system/lib/modules

There you are - you have just compiled and installed a kernel module from scratch. Go grab a beer and enjoy your new modules :)

Trackback URL for this post:

http://www.gotontheinter.net/trackback/4

Comments