Building on and motivated by this great guide for installing the Android SDK on Ubuntu, I would like to collect instructions for installing all necessary tools and sources for compiling (and potentially developing) kernels for the Sony Xperia ZR phone.
Install the following packages (I use Synaptic package manager from the Ubuntu Software Repository, but you could do that on the command line via
sudo apt-get install <package>):
gitfor downloading the ARM toolchain
lzoptwhich is required for building the kernel
Download the open source archive for the phone from the Sony website, the direct link is http://dl-developer.sonymobile.com/code/copylefts/10.4.B.0.569.tar.bz2
Extract the archive which contains the three subdirectories
vendor, I put them into
Download the pre-built ARM toolchain binaries from the android Git repository using the following command:
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
I did that in my
~/ directory, where a
arm-eabi-4.6 subdirectory was created.
To configure the build, I basically followed the instructions given in the
~/10.4.B.0.569/kernel/README_Xperia file. With the directory structures I used, this comes down to the following sequence of commands:
$ cd ~/10.4.B.0.569/kernel $ export ARCH=arm $ export CROSS_COMPILE=/home/<USER>/arm-eabi-4.6/bin/arm-eabi- $ make fusion3_dogo_defconfig
fusion3_dogo_defconfig is for the Xperia ZR and should be replaced if you want to build for a different device (the
~/10.4.B.0.569/kernel/README_Xperia lists the
Tablet Z and
Tablet Z SGP311/SGP312 variants). Also the
<USER> needs to be changed to your Ubuntu user name.
Now we are ready to build the kernel by simply running
make in the
~/10.4.B.0.569/kernel/ directory. This will take some time and if it worked correctly, should result in a
Unfortunately, I haven't found a way yet to generate a ramdisk or boot image to run or flash the kernel, so I created this related question on Stackoverflow about that.