Customizing the Xoom kernel / modules to add hardware support

This tutorial will show you how to customize, compile and install a kernel on your rooted xoom.
My goal here is to be able to use extra hardware from the USB port.

For the sake of the example and to link back to forensics I gonna show you how to add support for a "more versatile" USB wifi dongle.

- an OTG (On The Go) cable to be able to connect your device. I bought one of those on ebay and it worked perfectly.
- a working cross-compilation environment (first part of the article) and/or a chrooted gentoo on the xoom
- a good, working recovery rom (clockworkmod or eq.) where you can specify a .zip to flash.
- the guts to possibly make your xoom unbootable and recover from it with the recovery rom

This is quite an advanced procedure, if you have no clue about what I am doing here, just don't do it.
Also, please understand I am not responsible for any damages caused by this, you have to understand the experimental of the procedure and acknowledge that stuff can go wrong.

let's go

Here, as a base, I used the Tiamat customized kernel but you can also use more stock ones or other alternatives.

First, install the compiled Tiamat kernel and boot image from the procedure described here.
Keep a copy of the boot image, you will need it further down the tutorial.

When everything is ok and you are able to run this custom kernel, we can customize it further.

From your PC with crossdev installed or from your chrooted xoom, go to your favorite folder to develop kernels (I use /usr/src) and checkout a kernel.

cd /usr/src
git clone https://github.com/Tiamat-AOSP/Tiamat-Xoom.git

It takes a whole bunch of time to copy the git tree, be patient.

Recover the configuration from your running kernel from the xoom running the kernel you want to customize. If you are doing this from within the chrooted environment it is easy :

cd /usr/src/Tiamat-Xoom
gunzip -c /proc/config.gz >.config

Make sure the config is squared out:
make oldconfig

Then fire up the configuration menu:
make menuconfig

If you are compiling if from a cross dev environment adb pull the file and adjust the cross compilation prefix :
General / Cross-compiler tool prefix (armv7a-hardfloat-linux-gnueabi-)

If you are compiling if from the chrooted xoom, remove completely the prefix as you are pure native.
General / Cross-compiler tool prefix ()

Now add the support for the hardware you want : here I add the support for rt2x00 matching the wifi device I want to support.
Networking Support/Wireless/Cfg80211 & Generic IEEE802.11 NEtworking stack 
Networking support/ RF switch subsystem support/Power off on suspend [x] # it is needed for the stack above
Device Drivers / Networking device support / wireless lan / Ralink driver support / rt2800 (USB) 
... / rtxx [x]
... / unknown [x]

Once you are done, build your kernel, from the crossdev, (adapt the j parameter for the number of cores you have of course) :
make -j8

From the xoom :
make -j2
make modules_install

Unzip the tiamat kernel zip update you downloaded earlier:
take a kernel update zip you used before as reference from tiamat and unzip it, for example:
mkdir custom_update
cd custom_update
unzip ../Tiamat_Xoom-

It create a structure where you need to overwrite some files :
First the kernel itself (adapt it along the lines of this)
cp /usr/src/Tiamat-Xoom/zImage kernel/

The modules :
rm system/lib/modules/*.ko
find /usr/src/Tiamat-Xoom/ -name *.ko -print -exec cp {} system/lib/modules/ \;

Ok, now repack deployment !
zip -r ../Custom_Tiamat.zip *

You just need to flash this and insmod / modprobe the modules from your android command line / chroot.

Enjoy !

No comments:

Post a Comment