yashsingh1/xdaforums huggingface dataset:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Possible New Approach to Custom ROM's on Sony MTK's ??

Hi,

I was wondering :confused: If it would be possible to take a new approach since there appears to be difficulties getting ril working and possibly other things too using these traditional ROM building ways. :(

My thoughts and they are only thoughts are as follows.

1. We use the MTK Kernel from the leaked Android 8.1 source code HERE and add any missing drivers etc.

2. We get any missing binary's from the Nokia 3.1 (mt6755) es2 Sprout dump of Android 8.1 HERE and maybe other sources

3. We try to create a project Treble compatible device by adding a /vendor Partition using the scripts of phhusson. https://github.com/phhusson/treble_experimentations

MTK Ril issues seem to be getting fixed 1 by 1 in the treble community probably because it's got much more dev's helping out. Example Here

There maybe some massive and obvious thing's I have overlooked so feel free to correct me as I am quite happy to learn and be corrected when wrong. :o

EDIT: It seem like fate is taking over :D This guide was posted just yesterday in the Sony Crossdevice dev thread. https://xdaforums.com/crossdevice-dev/sony/treble-build-guidance-based-sodp-t3900596 :good:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
all sensors are fixed..

https://github.com/SonyCustoms/Releases_tuba/releases/tag/180219
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Wait, wasn't 14.1 working fine already except ril?
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
no. ril, nfc, gps, codecs and maybe smth else aren`t working as good as on stock
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Oh, okay. I still haven't tried it because my phone hasn't returned from repair but it's on my to-do list now. This phone needs some revival lol and you took the great step for it.
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
I have got the imei and imei sv information showing up after switching the modem on/off a couple of times using "muxreport"

adb shell

su

cd /system/vendor/bin

muxreport 3

(turns modem off)

muxreport 4

(turns it on again)

Muxreport useage:
RESET_MODE_ASSERT = 1
RESET_MODE_RESET = 2
STOP_MD = 3
START_MD = 4
RESET_MODE_ASSERT_MD2 = 5
RESET_MODE_RESET_MD2 = 6
STOP_MD2 = 7
START_MD2 = 8

Still no signal and no sim card detected though :eek:

EDIT:
[MENTION=7980102]andrw.gldmn[/MENTION]

I have been digging through the source code of the XA1 (Android 8.0) It looks like "cci" probably used the same source to build for both devices at one time so maybe we could use some of the "common" missing blobs from the XA1 to bring up 8.0 on the XA. :fingers-crossed:

I also noticed that sony use misc_ta partition for storing and retrieving some calibration data for hardware and maybe other stuff too.

This is from the "cci" signing tool in the source pretty sure that folder was left in by accident. :laugh: notice the project_name maybe we will get a official 8.0 one day soon :confused:

cd ${REPO_ROOT}

PLATFORM="mt67XX"
CERT_NAME="XXX"
if [[ ${PROJECT_NAME} = "tuba" ]]; then
PLATFORM="mt6755"
CERT_NAME="PLATFORM-MT6755-TEST-88C8"
elif [[ ${PROJECT_NAME} = "smx1" ]] || [[ ${PROJECT_NAME} = "hinoki" ]] || [[ ${PROJECT_NAME} = "redwood" ]] || [[ ${PROJECT_NAME} = "teak" ]]; then
PLATFORM="mt6757"
CERT_NAME="PLATFORM-MT6757-TEST-2B8F"
else
echo "Unsupported platform ${PROJECT_NAME}"
exit 0
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
Holy.. new build is making now.. thx for some new thoughts!
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
WOW :D

I have lots of thoughts and idea's just not got the ability to implement any of them :laugh:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
You should.. no, you MUST tell all of them to me:cyclops:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
Now we have sim registration + IMEI but “no service”..
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Well Done :highfive:

That's a big step forward :D

Have you pushed the build to releases so I can some testing?
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
not yet. now I am gonna test new build and push to releases
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Maybe we need to have /data set to forceencrypted for the signal to work.

It's like that on the Nokia 3 I have. No signal unencrypted full signal forceencrypted :silly:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
new release
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Well this is good news indeed. :D

I got a signal long enough to receive a new voice mail notification and to get a correctly identified network EE

The modem starts and stops repeatedly over and over every few seconds. but a great starting point. :good: :highfive:

See Attached screenshot showing the notification and EE Network identified. :good:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
Now we have crashing rilproxy in new builds. I have also added some sony services to MY new build (not published yet)
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
I have the single sim version so I just edited the build prop to use only one sim and it seems the mapping is inverted

eg: when dual sim is enabled sim one shows correct but when I edit the build.prop for one sim it uses sim slot 2 as default and that does not exist even though it still assigns a imei number to it.

If any of that makes sense :laugh:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
Here is our discussion
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
I am back at work for the next few days so I will not be able to do very much testing and debugging until my next set of days off. :crying:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] yek26119:
RIL is fixed ?
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
no
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Hi,

I was looking at some other sony devices (qcom) and they seem to use/need the ta parts.

eg: taimport and the ta_ccci_service which is the Mediatek equivalent of ta_qmi_service used by qcom devices I think. :confused:

Sony Device nicki Lineage 14.1 init.rc here

Not sure if this helps any. :o
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
I have already added that binaries and their deps. Its helped to detecting sim cards.. but I cant understand what "he" wants: https://gist.github.com/andrwgldmn/842bb5e97e24f6ce55a5a031a75fcab2#file-tad-L31-L39
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
I think all communications between /system and /ta is done via /miscta :confused:

The way I understand it is that the ta sends info to miscta which stores or forwards that info for the system to read it. (The miscta is also used to pass on calibration settings for hardware)

If the system needs something from ta it makes the requests to miscta.

miscta has very limited write permissions to the ta

"updatemiscta" should gather all info from the ta.

Due that miscta needs to be updated I assume the info stored gets wiped and reloaded on each reboot. :eek:

All this is just my own theory's of course so I could and probably are completely wrong. :laugh: :silly:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
good theory but how to implement it or smth?
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
That's the million dollar question. :eek:

Questions we need answering:

1. Sony bootstrap what exactly does it do and how does it do it?

Looking at those logs it seems wait4tad_static is not doing it's job and waiting for tad to come online.

Lots of NVRAM stuff is not fully loaded or is missing bits of info requested by other parts of the OS. This is probably due to tad not filling in the blanks as its not up and running.

Vold does not seem correct as it produces 4 corrupted sdcard on my devices which do not exist. Again could be related to tad not filling in the blanks.

To sum up:

It's almost like nvram is incomplete because sony have moved some parts of it to the /ta and these missing parts only get restored when /ta comms is up and running.

So everything should be halted until tad as done it's job of filling in the missing nvram parts.

Again all just theory based on fresh air :laugh:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
last post
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
I think that I fcked up all perms/groups/id`s for ta/tad/w4t/etc..

If you have free time can you make some magic with stock ramdisk and ramdisk from LOS? I am talking about init.sony_blabla.rc

thx!
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
I will have a look through the .rc's and see if I can spot anything obvious or missing and check the LOS perms against stock ROM perms but it may take me some time. :eek:

I have to say you have done wonders to get the ROM this far with very little assistance and that's a real credit to you and your persistence :highfive:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
`cause If I promised I will do it :)
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Hi just doing a little reading on the sony dev site HERE and noticed on 6.0 > 6.1 > 7.0 they do some patching and reverts of the AOSP code.

I know most are based on qcom hardware and I am unsure if these are sony specific cherry-picks but maybe it could give you some clues although I am pretty sure you will have already spotted them. :o

Example from 6.1 build instructions.

cd frameworks/base
git fetch https://android.googlesource.com/platform/frameworks/base refs/changes/31/229331/1 && git cherry-pick FETCH_HEAD
cd ../opt/telephony
git fetch https://android.googlesource.com/platform/frameworks/opt/telephony refs/changes/52/268352/1 && git cherry-pick FETCH_HEAD
cd ../../../hardware/ril
git fetch https://android.googlesource.com/platform/hardware/ril refs/changes/11/229011/1 && git cherry-pick FETCH_HEAD
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Ok I was digging through some files and compared my Sony L1 (mt6737 Android v7.0) ramdisk files and noticed some extra binary's related to the ta.

Maybe the dev of this Sony L1 was having difficulties also with the ta and radio so produced these system side binary's to assist?

I have pushed the ramdisk to github and pulling the system.img from the phone.

https://github.com/bigrammy/L1-ramdisk

I also notice that on sonyXperiadev device common they moved tad_static to the /system along with some other stuff.

https://github.com/sonyxperiadev/device-sony-common/blob/n-mr0/rootdir/init.common.rc#L240

My bad you already done that :o :silly:

[MENTION=7980102]andrw.gldmn[/MENTION]

It seems the update_ta_info binary file in the L1 is device specific but it seems to use /dev/mtgpio to read info from the TA and compare/set these to the user set values. Maybe most of this info needs to match up with whats on the ta before the radio is allowed to fully start.
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
semcrilextension.jar

Do you know what this for in the stock ROM??
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Joatsaro:
No service :c

Flashed this in Mexico (Hi from here) and now I got NO SERVICE (now that I read all the blog I understand is because of the RIL bug), but have to say it is quite a nice looking WIFI tablet this way!
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Hi and welcome. :highfive:
[MENTION=7980102]andrw.gldmn[/MENTION] has done a great job getting this ROM as far as he has done. :eek:

Fixing the radio fully is probably the final part of this sony mediatek puzzle which has defeated many before so lets hope he can conquer this challenge and reign supreme. :fingers-crossed: :fingers-crossed:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
Ill download the rom & have a look at it for you guys, ive worked with mtk processors quite a bit, also built & ported numerous LOS, CRdroid, RR roms ranging from mt6572 to mt6737m Ril needs the proper asserts aswell as you will find most mtk devices the ril is actually also run through gemini this is mediatek specific & is very tricky to get right, gemini cannot be modified either as it is scattered throught the numerous parts of the build,

Init.rc also wont help you fix the ril all the init.rc does is set the working environment up for boot, and as it was breifly making a connection this signifies that the device path for the ril was already correct. Let me know anyways i dont have one of these phones but i know what im doing :)

## edit

Will also need someone to upload me the

/bin (whole folder)

/etc (whole folder)

/lib ( whole folder )

Also additionally

/vendor/etc if present

/vendor/firmware if present

So i can cross compare the libs between the two also :)
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Thanks Matty. :highfive:

Any help and MediaTek experience would be very much appreciated.

Andy has dumped the Stock ROM HERE

If you want I can upload the individual folders for you if you need them.

Anything else you need?
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
Cheers mate,

Just finished up on another project so ill have a look at the ril and what not some time today :) hopefully i can get it sorted for you guys,

No need to add the folders all good ill just decompile the system img that way i have a full system to make reference from
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
Quick question fellas,

Are your sony XA dual or single sim devices

Also if someone could upload the folders individually for me from stock id aprreciate it my program wont decompile properly :(

# EDIT

gonna upload a test build soonish ive just done a once over think i may have found the problem but need someone to test, ill post link here when im done anyway guys :)
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
Hey everyone,

Heres the link if anyone wants to test it hopefully the ril will now be working for your devices fingers crossed, sorry took so long to get link up nets going slow as google drive took an hour to upload it

#edit link removed non functional rom
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Thanks a freaking ton, Matty!

I'll try this ASAP!

---------- Post added at 01:03 AM ---------- Previous post was at 12:42 AM ----------

I have a dual sim device. You can get the system folder dump from Andrew's SonyCustoms github as well :)
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
[MENTION=9139800]Matty1993[/MENTION]

Just got home from work and downloading your test build now. :fingers-crossed:

Update: [MENTION=9139800]Matty1993[/MENTION]

Stuck on boot logo.

Tried with and without Magisk.

Logcat stops at this point.

03-26 20:32:16.747 650 650 I RadioService: RadioService
03-26 20:32:16.747 650 650 I RadioService: onFirstRef
03-26 20:32:16.747 650 650 E RadioService: couldn't load radio module radio.primary (No such file or directory)
03-26 20:32:16.748 650 650 E SoundTriggerHwService: couldn't load sound trigger module sound_trigger.primary (No such file or directory)
03-26 20:32:16.759 385 385 E FFMPEGSoftCodec: Failed to load FFMPEG plugin: (null)
03-26 20:32:16.796 649 649 D ICU : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
03-26 20:32:16.919 649 649 W art : Before Android 4.1, method double java.util.concurrent.ThreadLocalRandom.internalNextDouble(double, double) would have incorrectly overridden the package-private method in java.util.Random
03-26 20:32:16.919 649 649 W art : Before Android 4.1, method int java.util.concurrent.ThreadLocalRandom.internalNextInt(int, int) would have incorrectly overridden the package-private method in java.util.Random
03-26 20:32:16.919 649 649 W art : Before Android 4.1, method long java.util.concurrent.ThreadLocalRandom.internalNextLong(long, long) would have incorrectly overridden the package-private method in java.util.Random
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Flashes with the resource busy error.

Then stuck at Sony Logo. I thought it was only me.
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Full Logcat

Did a format and install this time the logcat continued.

Too large for pastebin and xda at 2.5mb so uploaded it to Mega HERE.

The phone makes a nice hand warmer after a few minutes so did CTRL C to stop the log :laugh:

Flashes with the resource busy error.

[MENTION=5632627]N'ayam Amarsh'e[/MENTION]

I get that a lot for some reason unmounting system fails.

Needs a reboot to unmount it.
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
lol

Use del.dog to post logs, the official log posting website for devs[emoji23]

How are you taking logs btw? uart?
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
It's available via the normal usb connection when on the sony logo screen.

Never heard of del.dog :laugh:
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Check it out,

https://del.dog

That's what me and other rom devs usually use
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
Troubles with audio hw libs
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
Wow, no booter ill cross reference the logs see where the issue is, id say its more than likely one of the prop asserts ive added possibly, i added roughly 50-60 lines of ro. code so ill see if i cant fix it for you guys
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] andrw.gldmn:
Let me look at this commit plz
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
Hey guys ill have another tester up for everyone,

Ive pulled link to the no booter pervoius build im currently uploading TEST 2 as we speak hopefully this f#$%er boots up for you guys :D

Previous build i migrated the build.prop to the boot.img,

This build ive kept it all in build.prop & done alot of additonal mods and moved some things around for better compatability, ive also made modifications to the boot.img again also,

all asserts that i believe were causing the boot issue have beem fully removed, there may still be some code that will possibly need removing but from the look of it to me it should all work sweet,

Give me 5-10 mins and ill pull open the old boot.img and ill post the props i beleive were breaking the system on boot logcat logs suggest these were somewhat if not most of the problem,

However i have no idea why ligcat was complaining with a fatal error about the CPU ABI's ??? BUT luckily i know how to patch sh#t up lol

## EDIT ##

Ro code props i permanently removed instead of depracting and replacing are as follows

media.stagefright.legacyencoder=1

media.stagefright.less-secure=1

media.sf.omx-plugin=libffmpeg_omx.so

media.sf.extractor-plugin.libffmpeg_extractor.so

ro.mtk_audio_tuning_tool_ver=V1

ro.mtk_audio_ape_support=1

ro.zygote.preload.enable=0

ro.kernel.zio=38,108,105,16

You will find all of my added ro. Code present in the new builds build.prop so you guys can debug also i didnt think of that last night as i always migrate my entire build.prop to the default.prop on all of my builds but if you edit the build.prop be sure to edit the build.prop.bak file in /vendor to mirror the original prop in /system

---------- Post added at 06:27 AM ---------- Previous post was at 06:16 AM ----------

Try this one see if it boots guys,

Man o man i wish i had an XA i hate working blind so badly lol it would be done by now and booting perfect. Oh i decompiled framework-res & changed the wallpaper to something much nicer also for you guys

#edit link removed non functional rom
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Boots.

Asks for launcher, I selected trebuchet.

IMEI is totally empty, SIM not showing.

Status bar impossible to pull down, showing red borders on the screen every 30 seconds(low battery?)

But yeah, RIL doesn't work, the imei is gone too.

I restarted because nothing was opening correctly, stuck in bootloop.
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
No worries ill adjust some more code and upload another build, at least this one boots this time
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Thank you for all your work, Really grateful!
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
All good hopefully i can sort this ril problem out :)
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
Zipping TEST 3 up now so will have link up in about half hour max i think, hopefully this one works lol,

With the red box i was running the build through an emulator to see if i could get it to boot emulated was a no go on that but id forgotten to adjust debug.hw.ui=1 & debug.egl=1 back to =0 my bad shouldnt have that problem in the next build unless ive forgotten it somewhere dont think i did though,

Ive removed the ril-xposes.prop and instead done another work around this time using the volte stacks from /bin as even though VOLTE will never be on AOSP it still runs through a proxy server and does soemwhat connect but only allowing 3 & 4G as ive done it before on an MT6737M device.

Anyhow ill stop talking and get the link up :D
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Sweet, I'm happy to be your QA :D
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] Matty1993:
Heres link to Test 3 hopefully better luck this time

https://drive.google.com/file/d/1IDG1GJ4QPuZ6IO8vDA67FtjFOpjy0wEQ/view?usp=drivesdk
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Fingers Crossed, downloading now
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Just got home from work and will install the ROM asap.

Not sure where your from Matty1993 :confused:

PM me your address and I will ask [MENTION=4196889]DerTeufel1980[/MENTION] if he can forward on the Sony XA I sent him. He does not use it so pretty sure he would not mind. :fingers-crossed:

This should make life a little easier for you.

EDIT:

ROM boots up OK

1. No sim card deteched

2. No Baseband info

3. No imei showing

4. No service (signal)

This is in kmsg and repeats with verious PID numbers

<13>[ 992.499002] (0)[1:init]init: Service 'ril-daemon' (pid 8038) exited with status 255
<13>[ 992.499039] (0)[1:init]init: Service 'ril-daemon' (pid 8038) killing any children in process group

Radio Log here https://pastebin.com/RjNXkSHC
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] N'ayam Amarsh'e:
Same, also the red borders still coming up for some reason.
[Sony Xperia XA ROMs, Kernels, Recoveries, & Other ] bigrammy:
Yes I get those too on test 3 and I did on Andy's builds up until the last one and that only did it very occasionally.

I get 4 corrupt sdcards showing up on all builds for some reason but all this is stuff which is probably easy to fix compared to the ril which is the main issue.

If this phone was a tablet I would be happy with andy's last build. :D