Sony Xperia XZ (F8331 / Kagura) Porting



  • I was inspired to try out the porting guide during the live porting session this past weekend:

    I was able to make halium-boot and systemimage once, but the device didn't boot in the end.

    There are a number of challenges with this device:

    1. There is no official lineageos port: I found this possibly working port https://github.com/djselbeck/android_device_sony_kagura/

    2. This is a "tone" device. It might need the SW_binaries_for_Xperia_AOSP_N_MR1_5.7_r1_v08_tone.img from (https://developer.sony.com/develop/open-devices/guides/kernel-compilation-guides/how-to-build-and-flash-a-linux-kernel-for-aosp-supported-devices)

    3. Manifest is a hackjob assuming that since the Lineageos port borrows from the "sumire" device, that copying those parts might work:

    <manifest>
        <project path="device/sony/kagura" name="android_device_sony_kagura" remote="djselbeck" />
        <project path="device/sony/common" name="android_device_sony_common" remote="los" />
        <project path="hardware/sony/timekeep" name="android_hardware_sony_timekeep" remote="los" />
        <project path="kernel/sony/msm8994" name="ubports/android_kernel_sony_msm8994" remote="hal" />
        <project path="vendor/sony" name="proprietary_vendor_sony" remote="them" />
    </manifest>
    

    Adding the remote as well, assuming that it is useful:

    <remote name="djselbeck"
            fetch="https://github.com/djselbeck"
            revision="cm-14.1" />
    
    1. There was no vendor file in https://github.com/TheMuppets/proprietary_vendor_sony
      So, assumed that this might get somewhere:
      copy vendor/sony/sumire to vendor/sony/kagura
      rename sumire-vendor.mk to kagura-vendor.mk

    2. Not sure about this one. It complained the first time, but not in later attempts
      edit device/sony/kagura/BoardConfig.mk to reflect kernel m8994 instead of m8996

    3. There is no kernel config, so... (again maybe a better kernel config somewhere)
      copy sumire kernel config to kernel/sony/msm8994/arch/arm64/config/tone_kanguro_defconfig

    4. When Buiding system image i had to use

    LANG=C make systemimage
    

    However, later attempts didn't make it far. I mistakenly used the "lunch" command the first time, but probably should use "breakfast". Attempts have been unsuccessful.

    Just thought I'd share that and hope that somebody else is interested and has a better idea what to do.

    The device, however, is not very friendly to android roms in general, so expectations are pretty low.



  • Greetings joe,
    I'm trying to build something similar for my F8331 but I don't know where to start as there is no official lineageos for it ?
    don't know if I can build lineage OS first then port it to ubuntu ...... thanks for sharing .



  • @ressan627

    I was thinking the same thing about first building a lineage port.
    This is a working lineageos rom https://forum.xda-developers.com/xperia-xz/development/8-1-lineage-15-1-xperia-xz-t4072083

    However, I haven't been able to find the source. I don't know if you can deconstruct the rom itself.

    I would start here:
    http://docs.ubports.com/en/latest/porting/introduction.html

    And maybe something can be built off of the sumire device if nothign for kagura. I could have missed something in my attempt.



  • @joe
    I managed to make the manifist from the but it gives me

    # breakfast kagura
    including vendor/lineage/vendorsetup.sh
    build/core/product_config.mk:243: *** _nic.PRODUCTS.[[device/sony/kagura/lineage.mk]]: "device/sony/tone/platform.mk" does not exist.  Stop.
    Device kagura not found. Attempting to retrieve device repository from LineageOS Github (http://github.com/LineageOS).
    Repository for kagura not found in the LineageOS Github repository list. If this is in error, you may need to manually add it to your local_manifests/roomservice.xml.
    build/core/product_config.mk:243: *** _nic.PRODUCTS.[[device/sony/kagura/lineage.mk]]: "device/sony/tone/platform.mk" does not exist.  Stop.
    build/core/product_config.mk:243: *** _nic.PRODUCTS.[[device/sony/kagura/lineage.mk]]: "device/sony/tone/platform.mk" does not exist.  Stop.
    
    ** Don't have a product spec for: 'lineage_kagura'
    ** Do you have the right repo manifest?
    
    

    here is my xml file

    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
        <remote name="beidl" fetch="git://github.com/fredldotme" />
        <remote name="tone" fetch="git://github.com/Tone-keep-on-4-4" />
        <remote name="sony" fetch="git://github.com/sonyxperiadev" />
        <remote name="nxp" fetch="git://github.com/NXPNFCProject/" />
        <project path="device/sony/kagura" name="device-sony-kagura" revision="lineage-15.1" remote="tone" />
        <project path="device/sony/common" name="device-sony-common" revision="lineage-15.1" remote="tone" />
        <project path="device/sony/common-init" name="device-sony-common-init" revision="n-mr1-ubports" remote="beidl" />
    
        <project path="external/gpg" name="android_external_gpg" revision="halium-7.1" remote="beidl" />
        <project path="external/libnfc-nci" name="platform/external/libnfc-nci" groups="pdk" remote="aosp" />
    
        <project path="external/toybox" name="android_external_toybox" revision="halium-7.1" remote="beidl" />
    
        <project path="hardware/qcom/audio" name="android_hardware_qcom_audio_aosp" groups="qcom,qcom_audio" revision="halium-7.1" remote="beidl" />
    
    
        <project path="kernel/sony/kagura" name="Kernel" remote="tone" />
    
    
    
        <project path="vendor/nxp/" name="vendor-nxp" groups="device" remote="sony" revision="master" />
        <project path="vendor/nxp/NXPNFCC_FW" name="NXPNFCC_FW" groups="device" remote="nxp" revision="master" />
        <project path="vendor/broadcom/bt-fm" name="vendor-broadcom-bt-fm" groups="device" remote="sony" revision="master" />
        <project path="vendor/broadcom/wlan" name="vendor-broadcom-wlan" groups="device" remote="sony" revision="master" />
        <project path="vendor/qcom/opensource/fm" name="vendor-qcom-opensource-fm" groups="device" remote="sony" revision="master" />
        <project path="vendor/qcom/opensource/location" name="vendor-qcom-opensource-location" groups="device" remote="sony" revision="master" />
        <project path="vendor/qcom/opensource/time-services" name="vendor-qcom-opensource-time-services" groups="device" remote="sony" revision="master" />
        <project path="vendor/qcom/opensource/wlan" name="hardware-qcom-wlan" groups="device" remote="sony" revision="master" />
    
        <project path="vendor/oss/fingerprint"  name="vendor-sony-oss-fingerprint" groups="device" remote="sony" revision="android-7.1.1_r55" />
        <project path="vendor/oss/macaddrsetup" name="macaddrsetup" groups="device" remote="sony" revision="master" />
        <project path="vendor/oss/thermanager" name="thermanager" groups="device" remote="sony" revision="master" />
        <project path="vendor/oss/timekeep" name="timekeep" groups="device" remote="sony" revision="master" />
        <project path="vendor/oss/transpower" name="transpower" groups="device" remote="sony" revision="android-7.1.1_r55" />
        <project path="vendor/oss/json-c" name="json-c" groups="device" remote="sony" revision="master" />
    </manifest>
    

    hope this helps I'll continue tomorrow cuz now it's kind of late 😃 have a nice day



  • @ressan627 Thanks for working on this port.

    It seems that maybe the repository for the device might not be complete:
    git://github.com/Tone-keep-on-4-4 may be missing some files.

    This was the most complete one that I could find:
    https://github.com/djselbeck/android_device_sony_kagura/



  • Hi,
    Don't use the tree on Tone-keep-on-4-4. It is too complex. I already bring up a ubuntu touch tree for Xperia X Performance.
    You only need to rewrite the device tree for kagura. The other trees could use the same as dora.



  • @sjll Thanks for your help. Do links to the tree for Xperia X Performance?



  • @sjll I just realized that I think you made this as well:

    https://forum.xda-developers.com/xperia-xz/development/8-1-lineage-15-1-xperia-xz-t4072083

    This tree would be helpful to make the Ubuntu Touch port I think, but I couldn't find a github link.

    Thank you!



  • I wonder if you can treblize the XZ:
    https://forum.xda-developers.com/xperia-xz/development/f8331-2-project-treble-xperia-xz-t4029421

    Then you might be able to install the Ubuntu Touch GSI:
    https://t.me/ErfanGSI



  • Looks like Konrad has pretty much completed this port!
    https://github.com/konradybcio/device-sony-kagura

    The manifest has been requested to be merged into halium.

    Hoping to build the images and see how it goes...


Log in to reply