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.
1 Answer
Step 1
Follow the Complete Installation Guide for Android SDK on Ubuntu.
Step 2
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>
):
git
for downloading the ARM toolchainlzopt
which is required for building the kernel
Step 3
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 external
, kernel
and vendor
, I put them into ~/10.4.B.0.569
.
Step 4
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.
Step 5
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
Note that 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 Z
, ZL
, ZR
, Tablet Z
and Tablet Z SGP311/SGP312
variants). Also the <USER>
needs to be changed to your Ubuntu user name.
Step 6
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 ~/10.4.B.0.569/kernel/arch/arm/boot/zImage
file.
EDIT:
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.
sony
tag?