Skip to content

[device-port] [suzu] Sony Xperia X #98

@fredldotme

Description

@fredldotme

Tree: halium-7.1

  • Create manifest suzu: Add manifest for Sony Xperia X halium-devices#116
  • Boot image and system image build successfully
  • Device boots into rootfs, usb: Manufacturer: GNU/Linux Device appears in dmesg on host.
  • LXC container starts and does not crash
  • libhybris tests
    • test_gps
    • test_hwcomposer
    • test_lights
    • test_vibrator
    • test_wifi
    • test_sensors
    • test_audio
    • test_camera
    • test_input
    • test_nfc
    • test_recorder

The EGL_PLATFORM=hwcomposer environment variable is required for test_hwcomposer to succeed.

Kernel Support

This Halium abstraction uses a 4.4 kernel provided by Sony and CodeAurora,
thus has the benefit of taking advantage of upstream kernel patches
and follows Ubuntu's Xenial kernel series for AppArmor updates.
This opens the door for potentially decade-long support of kernel patches.
The Halium suzu device platform is determined to support Snap packages
and is well positioned to do so long term.

Areas of improvements

Usability:

Fix Android init service start issues related to:

  • vold

Possible improvements through use of FLOSS-compliant components

Upstreaming:

  • halium-devices
  • lxc-android

Build instructions

Build tests (even if you don't have the device) are welcome!
The resulting image is arm64 and armhf multilib compatible.

Tested on Ubuntu 18.04 inside an LXD container:

# Install build prerequisites for Halium
PROJECT_ROOT=$HOME/Projects/Halium-7.1
DEVICE=suzu
BREAKFAST_DEVICE=aosp_f5121-userdebug
HALIUM_VER=halium-7.1

export LC_ALL=C

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install git gnupg flex bison gperf build-essential \
  zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw-w64-i686-dev tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool \
  repo liblz4-tool bc lzop wget libssl-dev imagemagick

# Fetch & build
mkdir -p $PROJECT_ROOT
cd $PROJECT_ROOT

repo init -u https://github.com/Halium/android -b $HALIUM_VER --depth=1
repo sync

# Setup local_manifest repo xml
$PROJECT_ROOT/halium/devices/setup $DEVICE
repo sync --force-sync

# Optional workaround
# For some reason, sometimes the environment doesn't pick up the prebuild compiler.
# TL;DR: Try this if building fails
#
# Setup build environment using prebuilt compiler (uncomment exports to use the workaround):
# export CC=$PROJECT_ROOT/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/bin/x86_64-linux-gcc
# export CXX=$PROJECT_ROOT/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/bin/x86_64-linux-g++
# export LD=$PROJECT_ROOT/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/bin/x86_64-linux-ld
# export CXX_INCLUDE_PATH=$PROJECT_ROOT/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/include
# export C_INCLUDE_PATH=$CXX_INCLUDE_PATH

# Boot and system image creation
source build/envsetup.sh
breakfast $BREAKFAST_DEVICE
mka halium-boot && mka systemimage

Flashing images

Prerequisites:

The OEM binaries need to be flashed onto the oem partition:

sudo apt install unzip android-tools-fastboot || true
unzip SW_binaries_for_Xperia_AOSP_N_MR1_5.7_r1_v08_loire.zip
if [ -f SW_binaries_for_Xperia_AOSP_N_MR1_5.7_r1_v08_loire.img ]; then
fastboot flash oem SW_binaries_for_Xperia_AOSP_N_MR1_5.7_r1_v08_loire.img
fi

Flashing boot and system images:
Edit 2018-09-13: switch to xenial-edge UBPorts rootfs
Edit 2019-05-16: switch to xenial (devel) UBPorts rootfs

PROJECT_ROOT=$HOME/Projects/Halium-7.1
HALIUM_INSTALL_ROOT=$HOME/Projects/Halium-7.1/halium/halium-install
DEVICE=suzu

rm -r $HALIUM_INSTALL_ROOT || true
git clone https://github.com/JBBgameich/halium-install.git $HALIUM_INSTALL_ROOT

# Fetch latest successful armhf rootfs build
cd $PROJECT_ROOT
wget https://ci.ubports.com/job/xenial-rootfs-armhf/lastSuccessfulBuild/artifact/out/ubports-touch.rootfs-xenial-armhf.tar.gz

# At this point the device is expected to be in recovery mode
$HALIUM_INSTALL_ROOT/halium-install -p ut $PROJECT_ROOT/ubports-touch.rootfs-xenial-armhf.tar.gz $PROJECT_ROOT/out/target/product/$DEVICE/system.img
adb reboot bootloader
fastboot flash boot $PROJECT_ROOT/out/target/product/$DEVICE/halium-boot.img
fastboot reboot

Post-installation steps

The most current xenial rootfs (devel) build from ci.ubports.com is used in the following steps (2019-05-16).
This shouldn't be needed anymore, keeping for reference.

# Mount rootfs read-write
sudo mount -o remount,rw /

sudo apt install pulseaudio-modules-droid-24

sync && sudo mount -o remount,ro / && sudo reboot

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions