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.

  • @Braiam: Please read the complete question and answer below. The linked guide is incomplete for the Xperia ZR kernel tree. Why would I otherwise bother to do it all again? And why did you remove the sony tag? – FriendFX Jan 29 '14 at 3:32

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 toolchain
  • lzopt 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.


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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.