Open Devices Wide Screen 2.0Open Devices Wide Screen 2.0

Open Devices

For some of the Xperia™ devices, we provide Android™ Open Source Project (AOSP) device configurations on GitHub. This means that the software will be open for you as a developer to use and contribute to. This is a way for us to support the open Android community, and it is also a tool for us to facilitate and verify contributions to AOSP.

How to build and flash a Linux kernel for AOSP supported devices

Why rebuild the kernel?

There can be several reasons for why you want to rebuild and compile a custom kernel. You might, for instance, be a kernel developer, or you might have custom hardware that the standard kernel doesn’t support. Rebuilding a kernel enables you to make modifications to your device that are normally not supported by the manufacturer.

Note: If you’re not an experienced developer, Sony advises you not to rebuild the original kernel, as it is normally not needed. At Sony, we’re proud to deliver great software experiences through our rigorously tested and official software releases.

Prerequisites

This tutorial assumes that you are running Linux or Mac. On the Android Open Source Project website, you can find detailed instructions on how to set up and initialise a Linux build environment. You will probably also want to use a version control system like Git to handle your project. You can download Git from the Git webpage.

Rebuild the kernel

In order to rebuild the Linux kernel for your Sony Xperia device, you need to carefully follow the steps below. All code commands should be entered in the command prompt.

Guides

How to autimatically build the Linux kernel

1Set up the source code and environment

Select one of the Android build guides (see the AOSP build instructions page) and do the following steps of the guide:

  1. Prepare your Java environment
  2. Install the necessary tools to make an Android build
  3. Download Repo tool and set PATH
  4. Initialise the AOSP tree
  5. Add the necessary patches from the AOSP upstream branch

Note: If you already have the environment set then steps 1-3 are optional. This automatically rebuild only works with Android 6.0.1 and newer build guides.

2Prepare the repository for kernel rebuild

3Rebuild the boot image

4Flash the boot image file

How to manually build the Linux kernel for 64 bit devices

1Unlock the boot loader

All the work on building and compiling a kernel is based on you having unlocked the boot loader of your device. Instructions on how to do this can be found in our new and improved unlocking boot loader pages. Please remember that this is only for advanced kernel developers. We recommend standard users not to unlock the boot loader, as it is not needed.

Note: There is no turning back after unlocking the boot loader. You may void the warranty of your device, and you will not be able to revert it back to a locked and original state again.

2Download a cross compiler

3Export the cross compiler

4Download the kernel source from GitHub

5Identify your device’s config file name

In order to configure the kernel, you need first to identify your device’s config file name. Please note that only devices featured in the Sony GitHub release and Sony GitHub unified kernels are shown here.

DeviceConfig file name
Device
Xperia X
Config file name
aosp_loire_suzu_defconfig
Device
Xperia X Compact
Config file name
aosp_loire_kugo_defconfig
Device
Xperia X Performance
Config file name
aosp_tone_dora_defconfig
Device
Xperia XZ
Config file name
aosp_tone_kagura_defconfig
Device
Xperia Z5 Premium
Config file name
aosp_kitakami_suzuran_defconfig
Device
Xperia Z5 Compact
Config file name
aosp_kitakami_satsuki_defconfig
Device
Xperia Z5
Config file name
aosp_kitakami_sumire_defconfig
Device
Xperia Z4 Tablet
Config file name
aosp_kitakami_karin_defconfig, aosp_kitakami_karin_windy_defconfig
Device
Xperia Z3+
Config file name
aosp_kitakami_ivy_defconfig

6Configure the kernel

7Build the kernel and needed modules

8Copy needed binaries to your Android repository

9Download the Fastboot protocol

Fastboot is a diagnostic protocol included in the Android SDK. Make sure you have the Android SDK installed before proceeding. Fastboot will be used to modify the flash file system on your device via a USB connection from the computer. If you unlocked your boot loader in Step 1, you will already have Fastbootinstalled.

10Flash the boot image file

How to manually build the Linux kernel for 32 bit devices

1Unlock the boot loader

All the work on building and compiling a kernel is based on you having unlocked the boot loader of your device. Instructions on how to do this can be found in our new and improved unlocking boot loader pages. Please remember that this is only for advanced kernel developers. We recommend standard users not to unlock the boot loader, as it is not needed.

Note: There is no turning back after unlocking the boot loader. You may void the warranty of your device, and you will not be able to revert it back to a locked and original state again.

2Download a cross compiler

3Export the cross compiler

4Download the kernel source from GitHub

5Identify your device’s config file name

In order to configure the kernel, you need first to identify your device’s config file name. Please note that only devices featured in the Sony GitHub release and Sony GitHub unified kernels are shown here.

DeviceConfig file name
Device
Xperia Z3
Config file name
aosp_shinano_leo_defconfig
Device
Xperia Z3 Compact
Config file name
aosp_shinano_aries_defconfig
Device
Xperia Z3 Tablet Compact
Config file name
aosp_shinano_scorpion_defconfig
Device
Xperia Z2
Config file name
aosp_shinano_sirius_defconfig
Device
Xperia Z2 Tablet
Config file name
aosp_shinano_castor_defconfig
Device
Xperia Z Ultra
Config file name
aosp_rhine_togari_defconfig
Device
Xperia Z1
Config file name
aosp_rhine_honami_defconfig
Device
Xperia Z1 Compact
Config file name
aosp_rhine_amami_defconfig
Device
Xperia E3
Config file name
aosp_yukon_flamingo_defconfig
Device
Xperia M2
Config file name
aosp_yukon_eagle_defconfig
Device
Xperia T2 Ultra
Config file name
aosp_yukon_tianchi_defconfig
Device
Xperia T3
Config file name
aosp_yukon_seagull_defconfig

6Configure the kernel

7Build the kernel and needed modules

8Copy needed binaries to your Android repository

9Download the Fastboot protocol

Fastboot is a diagnostic protocol included in the Android SDK. Make sure you have the Android SDK installed before proceeding. Fastboot will be used to modify the flash file system on your device via a USB connection from the computer. If you unlocked your boot loader in Step 1, you will already have Fastbootinstalled.

10Flash the boot image file