Sony Xperia 5 V

I guess that would be hard for many! Did you already have the device tree ? If not you might experiment with creating your own with reference to Create Lineage device tree for android using aospdtgen

1 Like

Thanks for your reply. No I haven’t tried it, might give it a shot.
I saw the pdx234 (XQ-DQ72) which is the Xperia 1 V is officially supported by lineageOS and downloaded all sources from it and tried to adapt pdx237 from pdx234 device trees (GitHub - LineageOS/android_device_sony_pdx234) and also (GitHub - LineageOS/android_kernel_sony_sm8550).
After these changes I ran extract-files.sh, but it gave me errors that the commands are not found or something like that. I know I made mistakes somewhere but again, I’m a total noob so I don’t really know where the problem was

Edit:
I completely reinstalled ubuntu again and synced lineageos-21 successfully and downloaded pdx234 specific device tree.

When I try to use aospdtgen, I get the message down below.
I installed python3 with sudo apt-get install python-is-python3
My python version is when i type this command
python --version
Python 3.12.3

$ pip install aospdtgen
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

I installed aospdtgen with pipx install aospdtgen

Now i’m stuck in what to do next and how to actually use aospdtgen because its not clear to me

OK, that would be fine if you intended to build pdx234 as a dummy run – seems a good idea to demonstrate to yourself that you have a good working environment. (Adding for clarification, the purpose of the device tree is to populate roomservice.xml in .repo/local_manifests/)

First impression, looking at that error, when you started your “new device tree” project I would assume that you start a new folder away from your LineageOS build ?

Did you manage to find a source of the pdx237 stock ROM?

I think the instruction was pip3 install aospdtgen

1 Like

Yea when i type in pip3 install aospdtgen, it gave me the same error as above.

But I came across to this site:

and then found this one:

Now I don’t know if that would support the work

Edit:
Okay I managed to somehow use aospdtgen now
What would be the next step and how do I actually use this tool?
And does the dump of the website above matter or help it?

I really don’t know how to work with this tool.
I cloned the dump given in the website above and made it into a .zip file.
then I used dumpyara and I got a new folder with “working” inside the dumpyara folder.

I typed in terminal and got this.

python3 -m aospdtgen -o dump_path /home/on15/dumpyara/working/pdx237
Android device tree generator
Version 1.1.1

[INFO] Figuring out partitions scheme
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/on15/.local/lib/python3.12/site-packages/aospdtgen/__main__.py", line 11, in <module>
    main()
  File "/home/on15/.local/lib/python3.12/site-packages/aospdtgen/main.py", line 31, in main
    dump = DeviceTree(args.dump_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/on15/.local/lib/python3.12/site-packages/aospdtgen/device_tree.py", line 36, in __init__
    self.partitions = Partitions(self.path)
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/home/on15/.local/lib/python3.12/site-packages/sebaubuntu_libs/libandroid/partitions/partitions.py", line 27, in __init__
    assert PartitionModel.SYSTEM in self.partitions
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

So now I just tried to generate the device tree with aospdtgen, I inserted the boot.img into the dumped folder and got an output. With that I moved it to the lineage/vendor/sony folder and change the files inside the pdx234 folder and renamed everything for my pdx237 device. inside the sm-8550-commong folder I also add the device specific name and saved it.

then i just tried to compile it and got this:

[100% 1167/1167] analyzing Android.bp files and generating ninja file at out/soong/build.lineage_pdx237.ninj
FAILED: out/soong/build.lineage_pdx237.ninja
cd "$(dirname "out/host/linux-x86/bin/soong_build")" && BUILDER="$PWD/$(basename "out/host/linux-x86/bin/soo
ng_build")" && cd / && env -i  "$BUILDER"     --top "$TOP"     --soong_out "out/soong"     --out "out"     -
-soong_variables out/soong/soong.lineage_pdx237.variables -o out/soong/build.lineage_pdx237.ninja --globList
Dir lineage_pdx237 --globFile out/soong/globs-lineage_pdx237.ninja -l out/.module_paths/Android.bp.list --av
ailable_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used.lineage_pdx237
.build Android.bp
Killed
20:13:49 soong bootstrap failed with: exit status 1
ninja: build stopped: subcommand failed.

#### failed to build some targets (03:55 (mm:ss)) ####

Okay I give up, no chance

This device is now included in the Sony Open Devices Program. It might be useful to start by usig their documentation to first build AOSP for this device. But note the comment at the bottom of that page:

Note: Both devices are in their early stage of development and there are still multiple functions that need to be implemented.

2 Likes

Well done for trying @xShottaZx ! I have not used aospdtgen before. I did have a quick run though late last night but got no useful result. My comments below are therefore based that and “What I might try next” !

I did not manage so far to collect a copy of Android Dumps / sony / pdx237 · GitLab it is marked “protected” I got no complete download and could not login.

This source appears to be a ROM dump already (but it is unknown if produced as required in instructions by)

Android stock ROM dump (made with dumpyara).

Had I managed to collect that download I would have added it to my working environment as dump_path with no further modification.

  • (My understanding is that one would apply dumpyara to an actual pdx237 stock ROM, rather than an already dumped product.)

Now looking at the usage instructions

usage: python3 -m aospdtgen [-h] [-o OUTPUT] dump_path

My intention had been to run the command as

python3 -m aospdtgen -o my-device-tree-product pdx237_download

Maybe your collected .zip (substituted as pdx237_download or dump_path) would produce a different result like this ? (you might experiment with the .zip or the extracted contents).

I don’t know your previous experience with ROM building so I hesitate to give entry level tips … but …

Liberating a new phone is no easy job, congratulations on where you got (even if it seems disappointing so far !).

Better than my suggestions … follow @Petefoth’s suggestion and build AOSP, here vendor blobs are already supplied, no need for extract.files.sh. The output of this build could be quite interesting to you. (You might during the course of this look for a stock ROM for your phone so that you have a known path to return if your build installs but is unsatisfactory for daily use. Might be found here ? Xperia Stock ROM - Database of Sony Xperia Firmware)

1 Like

Thank you for the useful information. And I appreciate all the help from you guys so far!
Okay I will try build AOSP again first. But I need to completely reinstall ubuntu because I have broken my build enviroment and could not repo sync AOSP…

One other qestion is, when I do repo sync (doesn’t matter if LOS or AOSP) after a while ubuntu crashes, closes every task and I need to login again (as if I do a reboot of the system)
What can be the problem? I’m on Ubuntu 24.04 LTS.

I go step by step with their instructions everything is up-to-date and do a repo sync -c -j4

I notice that Sony AOSP build instructions | Developer World only asks for Ubuntu 20.04 LTS and Lineage (for pdx234) says “these instructions are only tested using Ubuntu 20.04 LTS, so we recommend going with that.”

I had to work around early build difficulties (kernel I think) with Debian 12.

You could change to -j 1 to see how much does it slow things down; for repo sync my download speed is always the throttle, 3.5 - 4.5 G/hour. With my nproc=8 and 32G RAM I did my latest recorded repo sync at -j 5; often use 3 or 1 though!

1 Like

If you do try that, note that the latest LineageOS for microG build for this device failed a couple of hours ago. I haven’t had a chance to investigate the build failure yet. I hope it’s transitory but if you try a build and it fails, it may not be your fault :slight_smile:

Okay so I’m on it … again…
But this time on ubuntu 20.04
I did everything spot on and step by step thats given here
https://developer.sony.com/open-source/aosp-on-xperia-open-devices/guides/aosp-build-instructions/build-aosp-android-14/

and this time ubuntu didnt crash, so I assume it was the version of ubuntu that really has to be 20.04…
but where it kind of fails is the this part:
source build/envsetup.sh && lunch

On their website they say: " 2. When prompted, pick the number corresponding to your device in the list displayed and press enter."

But all I get is this

~/android$ source build/envsetup.sh && lunch

including vendor/qcom/opensource/core-utils/vendorsetup.sh

You're building on Linux

Warning: Cannot display lunch menu.

Note: You can invoke lunch with an explicit target:

  usage: lunch [target]

Which would you like? [aosp_cf_x86_64_phone-trunk_staging-eng]
Pick from common choices above (e.g. 13) or specify your own (e.g. aosp_barbet-trunk_staging-eng): In file included from build/make/core/config.mk:380:
In file included from build/make/core/envsetup.mk:51:
build/make/core/release_config.mk:145: error: No release config found for TARGET_RELEASE: trunk_staging. Available releases are: ap2a.
21:04:56 dumpvars failed with: exit status 1

I kinda solved it with these commands:

. ./build/envsetup.sh
export TARGET_RELEASE=ap2a
build_build_var_cache
lunch

Only then I get the list:

on15@51NO:~/android$ export TARGET_RELEASE=ap2a
on15@51NO:~/android$ build_build_var_cache
on15@51NO:~/android$ lunch

You're building on Linux

Lunch menu .. Here are the common combinations:
     1. aosp_akita-trunk_staging-userdebug
     2. aosp_arm-trunk_staging-eng
     3. aosp_arm64-trunk_staging-eng
     4. aosp_bluejay-trunk_staging-userdebug
     5. aosp_cf_arm64_auto-trunk_staging-userdebug
     6. aosp_cf_arm64_phone-trunk_staging-userdebug
     7. aosp_cf_riscv64_phone-trunk_staging-userdebug
     8. aosp_cf_x86_64_auto-trunk_staging-userdebug
     9. aosp_cf_x86_64_auto_mdnd-trunk_staging-userdebug
     10. aosp_cf_x86_64_foldable-trunk_staging-userdebug
     11. aosp_cf_x86_64_only_phone_hsum-trunk_staging-userdebug
     12. aosp_cf_x86_64_pc-trunk_staging-userdebug
     13. aosp_cf_x86_64_phone-trunk_staging-userdebug
     14. aosp_cf_x86_64_tv-trunk_staging-userdebug
     15. aosp_cf_x86_phone-trunk_staging-userdebug
     16. aosp_cf_x86_tv-trunk_staging-userdebug
     17. aosp_husky-trunk_staging-userdebug
     18. aosp_oriole-trunk_staging-userdebug
     19. aosp_raven-trunk_staging-userdebug
     20. aosp_ripcurrent-trunk_staging-userdebug
     21. aosp_shiba-trunk_staging-userdebug
     22. aosp_slider-trunk_staging-userdebug
     23. aosp_whitefin-trunk_staging-userdebug
     24. aosp_x86-trunk_staging-eng
     25. aosp_x86_64-trunk_staging-eng
     26. aosp_xqas52-eng
     27. aosp_xqas52-userdebug
     28. aosp_xqat51-eng
     29. aosp_xqat51-userdebug
     30. aosp_xqat52-eng
     31. aosp_xqat52-userdebug
     32. aosp_xqau51-eng
     33. aosp_xqau51-userdebug
     34. aosp_xqau52-eng
     35. aosp_xqau52-userdebug
     36. aosp_xqbc52-eng
     37. aosp_xqbc52-userdebug
     38. aosp_xqbq52-eng
     39. aosp_xqbq52-userdebug
     40. aosp_xqbt52-eng
     41. aosp_xqbt52-userdebug
     42. aosp_xqcc54-eng
     43. aosp_xqcc54-userdebug
     44. aosp_xqcq54-eng
     45. aosp_xqcq54-userdebug
     46. aosp_xqct54-eng
     47. aosp_xqct54-userdebug
     48. aosp_xqdc54-eng
     49. aosp_xqdc54-userdebug
     50. aosp_xqde54-eng
     51. aosp_xqde54-userdebug
     52. aosp_xqdq54-eng
     53. aosp_xqdq54-userdebug

Which would you like? [aosp_cf_x86_64_phone-trunk_staging-eng]
Pick from common choices above (e.g. 13) or specify your own (e.g. aosp_barbet-trunk_staging-eng): 50

Invalid lunch combo: aosp_xqde54-eng
Valid combos must be of the form <product>-<release>-<variant>

I pick 50. aosp_xqde54-eng, but it fails so I add ap2a before the -eng

lunch aosp_xqde54-ap2a-eng

It’s selected and the rest i get is this where at the end it just fails

on15@51NO:~/android$ lunch aosp_xqde54-ap2a-eng

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=14
PRODUCT_INCLUDE_TAGS=com.android.mainline mainline_module_prebuilt_nightly
TARGET_PRODUCT=aosp_xqde54
TARGET_BUILD_VARIANT=eng
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.15.0-113-generic-x86_64-Ubuntu-20.04.6-LTS
HOST_CROSS_OS=windows
BUILD_ID=AP2A.240605.024
OUT_DIR=out
============================================
on15@51NO:~/android$ make
21:09:22 ************************************************************
21:09:22 You are building on a machine with 15.4GB of RAM
21:09:22 
21:09:22 The minimum required amount of free memory is around 16GB,
21:09:22 and even with that, some configurations may not work.
21:09:22 
21:09:22 If you run into segfaults or other errors, try reducing your
21:09:22 -j value.
21:09:22 ************************************************************
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=14
PRODUCT_INCLUDE_TAGS=com.android.mainline mainline_module_prebuilt_nightly
TARGET_PRODUCT=aosp_xqde54
TARGET_BUILD_VARIANT=eng
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.15.0-113-generic-x86_64-Ubuntu-20.04.6-LTS
HOST_CROSS_OS=windows
BUILD_ID=AP2A.240605.024
OUT_DIR=out
============================================
[100% 1/1] analyzing Android.bp files and generating ninja file at out/soong/bui
FAILED: out/soong/build.aosp_xqde54.ninja
cd "$(dirname "out/host/linux-x86/bin/soong_build")" && BUILDER="$PWD/$(basename
 "out/host/linux-x86/bin/soong_build")" && cd / && env -i  "$BUILDER"     --top 
"$TOP"     --soong_out "out/soong"     --out "out"     --soong_variables out/soo
ng/soong.aosp_xqde54.variables -o out/soong/build.aosp_xqde54.ninja --globListDi
r aosp_xqde54 --globFile out/soong/globs-aosp_xqde54.ninja -l out/.module_paths/
Android.bp.list --available_env out/soong/soong.environment.available --used_env
 out/soong/soong.environment.used.aosp_xqde54.build Android.bp
error: device/sony/common/hardware/health/Android.bp:1:1: "android.hardware.heal
th@2.0-service.sony" depends on undefined module "android.hardware.health@2.0-im
pl".
Or did you mean ["android.hardware.health@2.1-impl"]?
error: device/sony/common/hardware/health/Android.bp:1:1: "android.hardware.heal
th@2.0-service.sony" depends on undefined module "libhealthservice".
Or did you mean ["libartservice"]?
error: device/sony/common/hardware/health/Android.bp:1:1: "android.hardware.heal
th@2.0-service.sony" depends on undefined module "libhealthstoragedefault".
Or did you mean ["healthfitness-ui-statsd"]?
fatal errors encountered
21:09:35 soong bootstrap failed with: exit status 1

#### failed to build some targets (14 seconds) ####

I’m not certain what Sony call your phone in this environment: is it pdx237 ?

I would try this:

. ./build/envsetup.sh
breakfast pdx237
brunch pdx237

for an eng build.

If pdx237 is wrong name, any clue in .repo/local_manifests/roomservice.xml.

Also vendor/qcom/opensource/core-utils/vendorsetup.sh will be informative to read to see how AOSP / Sony are working.

1 Like

Yes, pdx237 is the right device
It says that breakfast command is not found
same with brunch

I thought maybe its because I have only 16G RAM which is why I created a swap file, but I don’t know if thats correct

on15@51NO:~/android$ sudo swapon --show
NAME      TYPE SIZE USED PRIO
/swapfile file  32G   0B   -2

There is no roomservice.xml in local_manifests folder but devices.xml. My device i also listed there:

<!--sm8550-->
<project path="device/sony/yodo" name="device-sony-yodo" groups="device" remote="sony" revision="u-mr1" />
<project path="device/sony/pdx234" name="device-sony-pdx234" groups="device" remote="sony" revision="u-mr1" />
<project path="device/sony/pdx237" name="device-sony-pdx237" groups="device" remote="sony" revision="u-mr1" />

</manifest>

Inside the vendorsetup.sh file I have this:

#!/bin/bash
# Copyright (c) 2018, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above
#       copyright notice, this list of conditions and the following
#       disclaimer in the documentation and/or other materials provided
#       with the distribution.
#     * Neither the name of The Linux Foundation nor the names of its
#       contributors may be used to endorse or promote products derived
#       from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE US

export QTI_BUILDTOOLS_DIR=$(dirname ${BASH_SOURCE[0]})

That happens when source /build/envsetup.sh has not been run or you are not correctly in your working environment.

I copied you with

. ./build/envsetup.sh

perhaps just try

source /build/envsetup.sh
breakfast pdx237

Otherwise I would have to search online if AOSP is “different”!

Just a guess the lunch command might be

lunch aosp_pdx237-userdebug

16G RAM should be sufficient, especially with the added swap.

So that vendorsetup.sh is simply not being used. In local_manifests/ any_name.xml will work !

1 Like

lunch aosp_xqde54-ap2a-(eng/user/userdebug)

seems to be the only 3 options I can choose for my specific device.

ap2a because the build of android 14 is ap2a as stated in their website:

security revision: 2024-06-05
build: AP2A.240605.024
branch: android-14.0.0_r50

so if I enter the lunch option above I can do
make
and it checks the Android.bp but some device/sony/common/hardware/health/Android.bp:1:1: thingy as above leads to errors.

My first reaction, with my first coffee is that repo sync did not complete.

Did you keep a trace of all the early steps, any chance of any error before repo sync?

If you run repo sync now does it report complete?

So it seems to me that Sony are calling the device xqde54 although pdx237 appears in device.xml. Just my own AOSP newbie question, can you see where xqde54 is set as an alias for pdx237?

Edit, self answering, seen in https://github.com/sonyxperiadev/device-sony-pdx237/blob/master/aosp_xqde54.mk PRODUCT_NAME := aosp_xqde54 | PRODUCT_DEVICE := pdx237

This thread https://xdaforums.com/t/lunch-failed.4665348/ however at Post #18 says

The latest Android 14.0.0-r50 revision made changes to the build process and configuration. They are deprecating certain releases and features of Android T and older (13). It will default to Android (U) specific Build IDs.

If you’re unsure about your device’s lunch options, refer to its product makefile.

1 Like

Yes I did everything exactly carefully like its written in their build guide. There were no errors and I got repo synced succefully message. Yea thats the thread I have the lunch commands from where I can see all the options listed after that.
When I get home I will continue experimenting.

My guess is, that my device pdx237 is only meant for android 13 aosp builds. Because the api level is 34 for 14, and I’ve red somewhere in a file that something with 33, but I could be wrong.
Need to check that out next

Edit: Okay so in here there are the lunch options

But when i enter one of these in terminal, it says this:

Invalid lunch combo: aosp_xqde54-eng
Valid combos must be of the form <product>-<release>-<variant>

So thats why I added ap2a as like this aosp_xqde54-ap2a-eng
And when i do anything else besides ap2aI get this error:

build/make/core/release_config.mk:145: error: No release config found for TARGET_RELEASE: ap1a. Available releases are: ap2a.
17:02:52 dumpvars failed with: exit status 1

So ap2a works, but it can’t make it.

There has to be something faulty on sony’s behalf, or because android 14.
I can’t build for ANY device i’ve tested it on several ones and nothing worked.
Maybe I will try android 13 to see if thats the problem

Okay!
There is a bug as stated in several bug reports on their github. They all have the same issue.
Thats means I have to go back and try to build lineageos first. That will be hard though

@xShottaZx did you realise that proposed fixes are already in branches of dev forks?

@MarijnS95
Please help me do so if you have the opportunity …
and has never been tried on an actual device yet!

Maybe just try manual edit these 6 files hardware/health: Upgrade to `2.1` via `libhealth2impl` · MarijnS95/device-sony-common@1c38227 · GitHub

1 Like

Hey, I’m back after a little break and actually no I didn’t realise it! Thank you for the information I will definetly implement this and try again.

1 Like

Tried it out, I still can’t compile it. This time it doesnt give me any logs and cancels the process.

At this point I thank you for your help but I give up, its a request thread not a tutorial or “how can I build aosp thread”.
I hope there is someone that can build /e/OS or at least LOS for xperia 5 v sometime in the future but until then i have to shut it down and use my old s10e…