## page was renamed from minato Bring-up of Sony Xperia line of devices based on AOSP 5.1.1 tree. Tested on Z1, Z2 tablet, Z3 Tablet Compact, Z5, Z5 Compact but not limited to. == Useful key combinations == Before you attempt flashing an Ubuntu image to your device, these key combinations should help you switch between phone modes. * Vol UP pressed + insert USB cable -> fastboot mode * Vol DOWN pressed + insert USB cable -> flash mode (used by Sony tools) * Vol UP + POWER, both pressed during 30 seconds -> hard reboot * Vol DOWN + POWER, no USB cable, stop pressing POWER after vibration -> recovery mode when it has been enabled and has a proper image (see below) * Small red button next to SIM, press it for a few seconds (you need a clip) until you get 3 vibrations -> power off == Current images == Built images ready to flash on a device are [[http://people.canonical.com/~okubik/minato/|here]]. Ensure you download the boot.img and ubuntu.img files and then follow the flashing instructions below. == Flashing Ubuntu == 1. Unlock the boot loader [[http://developer.sonymobile.com/unlockbootloader/unlock-yourboot-loader|following Sony's instructions]] 2. Make sure that you have Android 5.1.1 in your Z1. Otherwise, flash it using the [[http://developer.sonymobile.com/services/flash-tool/how-to-download-and-install-the-flash-tool/|Sony official tools]] or [[http://www.flashtool.net/index.php|unofficial tools]] that run in Ubuntu. 3. After that you can use {{{fastboot}}} to flash the images, by running these commands on the terminal: {{{ sudo fastboot -S 256M flash boot boot.img sudo fastboot -S 256M flash system ubuntu.img}}} == Compiling from scratch == Alternatively, in addition to the ready-made images, if you want to contribute to development or modify those images, you can build them yourself following these instructions. These assume you've got knowledge of building software and you are familiar with the Ubuntu and Android source code. Current source tree is compatible with Sony’s binary blobs version 19a {{{#!highlight bash Download Sony binaries (current tested version is AOSP L v19a) repo init -u https://code-review.phablet.ubuntu.com/aosp/platform/manifest -b personal/w-ondra/xperia-5.1.1_r36 -g all,-darwin,-qcom_msm8x26,-qcom_msm8x27,-qcom_msm8x74,-x86,-omap3,-omap4,-omap4-aah,-manta,-grouper repo sync . build/envsetup.sh lunch -> Select desired target e.g Z5 aosp_e6653-userdebug make -j8 this is optional step, if you want to use specific channel to build ubuntu root from, for example . ubuntu/prebuilts/prepare-ubuntu-packages-for-build -d generic -c rc-proposed/ubuntu-pd make ubunturootfsimage -j8 -> build will downloads ubuntu rootfs and custom packages for default channel rc-proposed/ubuntu channel }}} Optional steps: Use custom channel to build Ubuntu rootfs from: after step 6 run: . ubuntu/prebuilts/prepare-ubuntu-packages-for-build -d generic -c rc-proposed/ubuntu-pd For 64bit devices (Z5, Z5c, Z4 tablet) custom build of libhyrbis needs to be used, to fix GPU crash Run following after step 6 {{{#!highlight bash git clone https://code-review.phablet.ubuntu.com/ubuntu/libhybris-prebuilt ubuntu/libhybris-prebuilt -b personal/w-ondra/phabket-5.x-kitakami mmm ubuntu/libhybris-prebuilt/ make snod }}} == Port status == The port is in its early steps and feature set differs between devices, there are many things that do not work. Some of the stuff that does work is: || '''Device''' || '''what is working''' || '''known issues''' || || Z1 (honami) || Unity8/wifi/SMS/data/audio || Power handling/BT/camera/MHL/phone calls || || Z Ultra (togari) || Unity8/wifi/SMS/data/audio || Power handling/BT/camera/MHL/phone calls || || Z2 Tablet(castor) || Unity8/audio || Power handling/BT/camera/MHL || || Z3 Tablet compact(scrorpion) || Unity8/audio || Power handling/BT/camera/MHL || || Z5 (sumire) || Unity8/wifi/SMS/data/audio || Power handling/BT/camera/MHL/phone calls || || Z5 compact (suzuran) || Unity8/wifi/SMS/data/audio || Power handling/BT/camera/MHL/phone calls || == Generic known issues == * Power handling. * Device does not power off completely. When usb cable is plugged and unplugged, power button fails to switch off screen. * suspend does not works properly * MHL does not work * Camera does not work and eventually crashes device * phone calls do not work * generic stability == Development tips == * (re)building boot image {{{#!highlight bash $ make bootimage - repackage boot image without rebuilding dependencies $ make bootimage-nodeps }}} * (re)build recovery image {{{#!highlight bash $ make recoverytimage - repackage boot image without rebuilding dependencies $ make recoveryimage-nodeps }}} * repackage android ramdisk. !! Android ramdisk is contained in Android system image {{{#!highlight bash $ make ramdisk-nodeps }}} * rebuild Android part without checking dependencies {{{#!highlight bash $ make snod }}} * Build Ubuntu image ( this will download latest rootfs and custom adds local Android image and packs all in image) {{{#!highlight bash $ make ubunturootfsimage }}} * re-build Ubuntu image without checking dependencies, use this to create image with local changes {{{#!highlight bash $ make ubunturootfsimage-nodeps }}} * build device package {{{#!highlight bash $ make device package - without checking dependencies $ make devicepackage-nodeps }}} * rebuilding Ubuntu image, with new changes contained in Android image {{{#!highlight bash - build changes in Android code $ make - copy updated Android image so it is picked when we are repacking Ubuntu image $ cp out/target/product//system.img out/target/product//ubuntu/rootfs/var/lib/lxc/android/system.img - repack Ubuntu rootfs without checking dependencies $ make ubunturootfsimage-nodeps }}} * rapid development with adb sync When doing changes on Android side, sometimes there is need for quick iterations, for this case best is to use adb sync feature. You will have to make sure to use eng build, as you will need to run adb daemon as root. You will also have to make sure to have enough spare space in Android system image. {{{#!highlight bash Preconditions: - Preparation: prepare Android system image with 30MB padding space $ BOARD_SYSTEMIMAGE_PARTITION_PADDING=3145728 make -j8 or without dependencies $ BOARD_SYSTEMIMAGE_PARTITION_PADDING=3145728 make snod -j8 - Create Ubuntu image with new Android system image $ cp out/target/product//system.img out/target/product//ubuntu/rootfs/var/lib/lxc/android/system.img $ make ubunturootfsimage-nodeps -j8 - Flash device with new Ubuntu image. - once device is booted, using adb add following two files: $ touch /userdata/.writable_image $ touch /userdata/.writable_device_image - reboot - once device is booted, check that '/' and '/android/system' are mounted as 'rw' Iterating through changes: - restart adb as root $ adb root - make and compile changes in Android, you do not need to run make in root, to recreate Android system image - e.g. $ mmm frameworks/av/media/libmedia - sync all changes with device. Be careful if you change is executable can you restart it, if it's shared lib, can you make system reload it, if it's config file can you make system reload it? Ultimately reboot is always safest option if you do not know $ adb sync }}}