T-Virus - Infect your Nokia 8 with Project Treble (2019-07-02)

Search This thread

Shabbirkt

Member
Jan 30, 2018
45
5
Hello, it seems to be noob question but i'm kinda confuse on how to flash NOST on my device, i have unlock bootloader (not critical). Help will be appreciated.:eek:
 
Aug 16, 2019
7
1
Hello, it seems to be noob question but i'm kinda confuse on how to flash NOST on my device, i have unlock bootloader (not critical). Help will be appreciated.:eek:

when you're unlocking bootloader instead of fastboot flashing unlock use fastboot flashing unlock_critical

---------- Post added at 09:19 PM ---------- Previous post was at 08:48 PM ----------

I'll try to create a flashable zip or will just dump my vendor partition and share it.
No idea regarding battery usage though, sorry. On Havoc myself, didn't notice any drain.

Patched T-Virus 20190703 Vendor image
* `sensor_def_qcomdev.conf`, `sensors_calibrate.so` and `sensors.ssc.so` files from stock 515D
* framework vendor overlay for autobrightness and some settings from stock

Unpack the 7z archive and flash image file to the vendor partition. If something goes wrong, flash the original, unpatched vendor image.
I don't provide any support for this, as I have close to no knowledge on all of this.

are there any more differences between 5150 and 515D?
if there are, then can you please make a patch for it?
F.Y.I MSM Xtended GSI shows this message every time I reboot,
"Android system: your vendor image doesn't match the system. please flash the PQ3A.190801.002 vendor image for your device"
and I believe it needs 515D vendor image because PQ3A.190801.002 is august security patch I think
so far I used:
Havoc 2.8, it was ok (issues: flashing backlight buttons, high battery usage).
Oxygen os(phone hangs up and never gets up after restart or shut down, should use vol+, power for almost 1 min to get phone restarted and after many trials took me a whole damn day to get the phone to recovery to flash another GSI.
and MSM Xtended XP9 Release v18 with the highest compatibility I think, no flashing buttons, smooth as butter, so far so good
 

oaid

Member
Sep 18, 2012
39
28
Limerick
when you're unlocking bootloader instead of fastboot flashing unlock use fastboot flashing unlock_critical

---------- Post added at 09:19 PM ---------- Previous post was at 08:48 PM ----------



are there any more differences between 5150 and 515D?
if there are, then can you please make a patch for it?
F.Y.I MSM Xtended GSI shows this message every time I reboot,
"Android system: your vendor image doesn't match the system. please flash the PQ3A.190801.002 vendor image for your device"
and I believe it needs 515D vendor image because PQ3A.190801.002 is august security patch I think
so far I used:
Havoc 2.8, it was ok (issues: flashing backlight buttons, high battery usage).
Oxygen os(phone hangs up and never gets up after restart or shut down, should use vol+, power for almost 1 min to get phone restarted and after many trials took me a whole damn day to get the phone to recovery to flash another GSI.
and MSM Xtended XP9 Release v18 with the highest compatibility I think, no flashing buttons, smooth as butter, so far so good

not many differences, from what I see comparing the vendor images. Anyway, I've updated the vendor image to be based on 515D. Not sure if that boot message is gone, though, as I use the SafetyPatch Magisk module and I get a message on boot. Using MSM-X.
Somehow I suspect the high battery usage on Havoc is related to the flickering hw buttons.
 
  • Like
Reactions: Reza7Sicherheit

KonikoO

Senior Member
Sep 8, 2015
86
24
The biggest issue I've ran into was the obvious lack of bluetooth functionality and camera did tend to freeze from time to time and lock up when Camera2API was active.
Personally I haven't had a battery issue/drain on HavocOS - the performance and battery life was overall even better than stock.
 

oaid

Member
Sep 18, 2012
39
28
Limerick
The LiveBokeh mode on HMD Camera 86.9.1130.91 has a bug where it doesn't handle an exception well, which results in the app crashing out. It tries to update the Media Provider database to set the imagetype column, which only exists in the Media Provider found in the stock ROM.
I tried replacing the Media Provider apk and while the camera worked fine, I got lots of issues with Play Store and other apps. So I decided to see what's in the stock Media Provider and extracted an SQL script that adds the missing columns to the files table:

Code:
ALTER TABLE files ADD COLUMN socail_facerect_left TEXT;
ALTER TABLE files ADD COLUMN socail_facerect_top TEXT;
ALTER TABLE files ADD COLUMN socail_facerect_right TEXT;
ALTER TABLE files ADD COLUMN socail_facerect_bottom TEXT;
ALTER TABLE files ADD COLUMN social_contactid TEXT;
ALTER TABLE files ADD COLUMN social_faceid TEXT;
ALTER TABLE files ADD COLUMN social_face_num INTEGER;
ALTER TABLE files ADD COLUMN social_face_orientation TEXT;
ALTER TABLE files ADD COLUMN social_isscanned INTEGER;
ALTER TABLE files ADD COLUMN imagetype INTEGER;
ALTER TABLE files ADD COLUMN isfavorite INTEGER;

DROP VIEW IF EXISTS images;
CREATE VIEW images AS SELECT _id,_data,_size,_display_name,mime_type,title,date_added,date_modified,description,picasa_id,isprivate,latitude,longitude,datetaken,orientation,mini_thumb_magic,bucket_id,bucket_display_name,width,height,socail_facerect_left,socail_facerect_top,socail_facerect_right,socail_facerect_bottom,social_contactid,social_faceid,social_face_orientation,social_face_num,social_isscanned,isfavorite,imagetype FROM files WHERE media_type=1;

This needs to be run on /data/data/com.android.providers.media/databases/external.db (I also ran it on internal.db, just for consistency, but not sure if it's needed).
Maybe someone can create a flashable zip to include this?
 

rashazad

Senior Member
Mar 3, 2011
165
30
Nokia 8
Hey everybody
Can anybody explain or provide any answer to the question what are differences of booting a ROM using GSI and flashing it from recovery or apps like NOST?
Thanks for the method btw.
 

MDV106

Senior Member
Jan 4, 2019
475
169
It would be nice if those who have tried these custom roms to post some screenshots? I am tempted but my Nokia 8 is my daily driver so I cant just take the plunge just yet.
 

KonikoO

Senior Member
Sep 8, 2015
86
24
Is there any hope that the Bluetooth audio will work in a future version?

I highly doubt. THSMP no longer owns Nokia 8 and is not intrested in developing it anymore and Project Treble forum's not helpful as well when it comes to even providing some more information than laughable Google tier documentation left behind about it.
 

Babakkardan

Senior Member
Hello I am planning to get a used nokia 8 (for its sd835 cpu) and make it treble compliant to flash Android gsi's.
Once I fully unlock the bootloader and flash your. qlz through NOST, will the phone have the full power of the chipset? Will there still be performance issues like on the Nokia rom?
Can I then flash magisk through twrp to obtain root?
Thank you
 

marceldossantos91

Senior Member
Jan 17, 2011
949
393
Hello I am planning to get a used nokia 8 (for its sd835 cpu) and make it treble compliant to flash Android gsi's.
Once I fully unlock the bootloader and flash your. qlz through NOST, will the phone have the full power of the chipset? Will there still be performance issues like on the Nokia rom?
Can I then flash magisk through twrp to obtain root?
Thank you

I can confirm that yes, it works with some GSIs, not android 10 gsi's though as op clearly mentioned, yes there are bugs, check through the post, BT audio not working, hardware keys flash on some GSIs, etc. But i can confirm however im running msm extended GSI and for the most of it works well, definitely beats stock, and yes, its rooted and can pass safetynet with the patch, but be aware that this isnt an official treble supported device, so dont expect a bug free experience, but im running on Pie and thanks to this mod its given new life to our nokia 8, just dont expect further updates as other users mentioned the OP no longer owns the device.
 
  • Like
Reactions: Babakkardan

Babakkardan

Senior Member
I can confirm that yes, it works with some GSIs, not android 10 gsi's though as op clearly mentioned, yes there are bugs, check through the post, BT audio not working, hardware keys flash on some GSIs, etc. But i can confirm however im running msm extended GSI and for the most of it works well, definitely beats stock, and yes, its rooted and can pass safetynet with the patch, but be aware that this isnt an official treble supported device, so dont expect a bug free experience, but im running on Pie and thanks to this mod its given new life to our nokia 8, just dont expect further updates as other users mentioned the OP no longer owns the device.

Great, just the fact that some Gsi's are functional is a great achievement. I realize there will be bugs but if the full potential of the cpu and gpu are there then it's well worth it.
 

marceldossantos91

Senior Member
Jan 17, 2011
949
393
Great, just the fact that some Gsi's are functional is a great achievement. I realize there will be bugs but if the full potential of the cpu and gpu are there then it's well worth it.

Hopefully this convinces you :) (fyi, stock scores about the same)
 

Attachments

  • IMG_20190921_194537.jpg
    IMG_20190921_194537.jpg
    174.6 KB · Views: 558
  • Screenshot_AnTuTu_Benchmark_20190921-195444.png
    Screenshot_AnTuTu_Benchmark_20190921-195444.png
    241.7 KB · Views: 557

marceldossantos91

Senior Member
Jan 17, 2011
949
393
Thanks for this. Do you think using L-Speed and kernel adiutor on stock rooted Pie, it is possible to tweak the performance so it's close to the gsi rom's?

Stock and gsi perf is closely related, while the gsi ui feels way more "snappy" than stock, stock in nokia devices is already a mostly debloated rom already and gsi's wont offer much performance gain, in my personal experience - those tweaks help maybe 5-10% and might make things feel better but wont give the major improvement you looking for, one module i used was fde.ai, it helped with battery and a slight perf boost, but nothing to brag about,

Best way ive found personally to improve performance is - use as little magisk modules as possible, xposed is especially a huge culprit in performance, which i did use to get custom features on stock,

Minimize using overlays, they also slow things down.

Remove as much system/user apps as possible, and keep storage at least above 15% left, this is how i got the best performance on stock, out of the box benchmarks are the same, the only real improvement gsi's offer in terms of custom roms is the fact that you dont need modules/tweaks to get the same results, this is where a GSI offered me major improvement, ive let go of xposed and a ton of modules/tweaking apps, and removed as much apps as i possibly could remove, hope this helps.
 
  • Like
Reactions: Babakkardan

dt_matthews

Senior Member
Jan 9, 2006
362
31
Attached are the device log and radio log captured when trying to connect Bluetooth headphones - anyone have the knowledge to investigate the BT pairing issue?

Cheers
 

Attachments

  • logs-2019-09-29-13-43-46.zip
    300.2 KB · Views: 42

MDV106

Senior Member
Jan 4, 2019
475
169
Here are the screenshots of the Android 10 GSI successfully boosted on Nokia 8.
had to run:
Code:
adb shell
setprop persist.sys.phh.mainkeys 0  # brings back the 3 button navigation bar since the hardware keys dont work.
 

Attachments

  • Screenshot_20191001-233054.png
    Screenshot_20191001-233054.png
    203.5 KB · Views: 356
  • Screenshot_20191001-233256.png
    Screenshot_20191001-233256.png
    160.8 KB · Views: 355
  • Screenshot_20191001-233309.jpg
    Screenshot_20191001-233309.jpg
    135.1 KB · Views: 347
  • Screenshot_20191001-232725.png
    Screenshot_20191001-232725.png
    169.1 KB · Views: 330

Top Liked Posts

  • There are no posts matching your filters.
  • 25
    Code:
    #include <std_disclaimer.h>
    
    /*
     * Your warranty is now void.
     *
     * I am not responsible for bricked devices, dead SD cards,
     * thermonuclear war, or you getting fired because the alarm app failed. Please
     * do some research about modifying your android system before flashing this! 
     * YOU are choosing to make these modifications, and if you point the finger at 
     * me for messing up your device, I will laugh at you. Hard. A lot.
     */
    (if you expected the Resident Evil references to stop, you just got gnomed)

    What is this?
    T-Virus (for treble-virus) is a tool that takes a stock Nokia 8 firmware and "infects" it with various parts from the Nokia 8 Sirocco firmware, generating a firmware bundle that is compilant with Project Treble and that can be flashed to a Nokia 8 using NOST.

    Firmware Sources
    The base of T-Virus is the stock Nokia 8 firmware image (5150 / April Security patch at the time of writing). When being run, the build script takes those files and replaces the partition table with the one from Nokia 8 Sirocco. This required for creating a vendor partition that the stock Nokia 8 does not have. The vendor image is taken from the Sirocco firmware as well. During the build, the vendor image is mounted as rw, and various files are copied over from the stock Nokia 8 system image, or get patched to properly support the minor hardware differences between the two phones. Those actions are defined through very basic scripts inside of the vendor folder in the repository.
    The boot image is a modified version of my umbrella kernel, which has support for early mounting vendor. It also includes a TWRP build with full support for Project Treble.

    SELinux Hell
    Because Android does some very weird stuff with SELinux contexts, you cannot launch a service file when it has an unknown context. We have to fix that by force-setting the SELinux context manually, but due to how SELinux works, this is only possible on a Linux system without SELinux. This means, that you cannot build this on a distribution with SELinux (Fedora in my case). I fixed the problem by building the images in a Ubuntu VM.

    How to build?
    First you have to download the latest firmware image from https://tmsp.io/fs/xda/nb1/firmware, and the exdupe tool from https://www.quicklz.com/exdupe
    Extract the firmware into a folder and then clone the repository, like this:
    Code:
     $ mkdir firmware 
     $ ./exdupe -R ~/Downloads/NB1-5150-0-00WW-B03.qlz firmware/ 
     $ git clone https://github.com/resident-nokia/t-virus 
     $ cd t-virus
    The build script has two options you have to set: a version and the path to the extracted firmware. This means you have to run it like this:
    Code:
     $ ./build.sh --version v0.1 --firmware ../firmware
    Leave it running and when it asks you, enter your sudo password. This is required to mount the Android ext4 partitions and edit the files that are only accessable by the (Android) root user, and retain their permissions.
    When the script has finished the flashable firmware image will be inside of the out folder. You can optionally package this as a .qlz file again using exdupe.

    What works?
    • It boots
    • Data decryption in recovery
    • Flashing GSIs / OpenGApps in recovery
    • WiFi
    • Mobile Data
    • Bluetooth
    • Sound
    • Vibration
    • Calling
    • Hardware buttons
    • Fingerprint
    • Camera
    • GPS
    • NFC
    • SDCard
    • Multi SIM
    • 4k Video

    What doesn't work, or isn't tested
    • Haptic feedback for Hardware buttons
    • Bluetooth headphones don't get registered properly
    • Nokia OZO audio support is missing
    • Fingerprint sensor is reported as being on the back of the phone
    • There might be issues with USB transfer under Windows
    • VoLTE (untested)

    How to install?
    WARNING: This might not be useable as a daily driver. Continue only if you are able to troubleshoot things if neccessary (bootloops, bricking the phone, causing the alarm app to declare nuclear war)

    You can download the latest release from the releases page on the repository. It is a .qlz firmware, so you will have to flash it through NOST. You will need a completely unlocked bootloader. When flashing, make sure to select the "Erase Userdata" option, not doing this will most certainly bootloop the phone.
    After the installation completed, your phone will reboot into phh's AOSP GSI. If you want to use a different GSI (you most likely will), follow these steps:

    • Download your favorite GSI
    • Unpack every form of compression, so you end up with a .img file
    • Boot into recovery
    • Copy the .img to the internal storage of your phone, or to your SDCard
    • Select "Install" -> "Install .img", select the image file you copied and flash it to your system partition
    • Then install OpenGApps or any other modifications you like.
    • Wipe /data to allow the new system image to boot properly and then reboot
    To update to a newer version without having to erase userdata, download the zipped vendor image from the release page, and flash the image inside in TWRP.
    If you want to go back to stock, simply download the 5150-revert firmware and flash it with NOST, with the "Erase Userdata" option enabled. It will revert all changes T-Virus made to your phone. Firmwares from https://tmsp.io/fs/xda/nb1 will not work.

    Links?

    What if I have a bug?
    • Upload a proper bugreport. This means logcat and dmesg. If you don't know how to get them, google it. Also, describe the issue and provide steps to replicate it. Everything else will be ignored.
    • I don't daily drive this phone anymore. I am doing this just because it is an interesting technical challenge. I don't have as much motivation to fix bugs than someone who daily drives it.
    I want to say thank you!
    I usually don't do this, but since this involved a lot of work on my side, I would be grateful if you would want to say thank you by buying me a coffee (or two): https://paypal.me/thmsp
    3
    What about ozo audio config?

    yeah, I'd like that, too, also fully working camera, i.e. with dual-camera.
    Just lack the knowledge on how to determine which libs and configs are needed for that.

    The credits for the compass fix actually should go to @kosmatyj :good:
    3
    Hi THMSP:

    May I ask if you would port the Android 10 from Nokia 8 Sirroco to Nokia 8, just as what you did on Android 9?
    Also, will you release the rom for this build as well ?

    For that there would have to be an Android 10 update for Sirocco first. And that probably won't happen for some time. So I am going with a definitive maybe.

    In theory, you can use Android 10 with the Android 9 vendor already. But there is a problem with that approach: The binaries that had to be added to the Sirocco vendor were taken from the Nokia 8 firmware, and therefor never setup to work with Treble. They reference libraries that are stored on the system partition directly. And this means that they use APIs that existed in Android 9 but that were removed / changed in Android 10. If they would use the Treble APIs for that, it wouldn't be an issue, but they don't. This is the reason why if you flash an Android 10 GSI the hardware buttons, and the camera won't work.

    The only "easy" solution to that would be to update those binaries to the newer APIs. But since Nokia 8 won't get Android 10, those blobs will never see an update to the new APIs either. You might be able to rip the Goodix stuff (hardware buttons) out of another phone that has Treble / A10, but that will most likely not work for the camera at all. And since all of that is proprietary, closed source stuff we can't update it ourselves.

    So it will probably be totally impossible to ever run something thats not Pie with T-Virus. At least if you want camera and button support. Unless someone who is more involved into this than I am has an idea how to solve it.

    And no, please don't go: "So HMD has to update Nokia 8 to Android 10 so we can fix T-Virus.". That ship has sailed. If you want Android 10 anytime soon, get a different phone. Sorry.
    2
    Ok. After the flashing we have a phone "infected" by the Project Treble. But what it gives to end-user? What is profit of this?
    The ability to install GSIs (Generic System Images). Basically everything from here: https://forum.xda-developers.com/project-treble/trebleenabled-device-development
    2
    Yes I solved partically the compass error. But seems it is partically because it sloooowly rotates clockwise. Trying to find another solution. So it was preambula. Now what I did: I got sensor_def_qcomdev.conf file from Android 8.1 for Nokia 8 and copied it to /system/vendor/etc/sensors (root access required) and set rights -rw-r-r just like it was on original. After that compass seemed to be fixed. Bu as I said befor - it is only first look. Than it ran away. But you may be mor lucky with it! Try and you`ll see if it helped.

    Yes buttons are flickering twice and then they go out. I dont pay attention to it.

    Since the compass was fixed with June update (?), I compared the .conf file from current T-Virus vendor and the 515D stock and there were two lines that were different: in `platform nb1` section, Mag Y and Mag Z are negative values in 515D, so I changed them (see attached image).
    I also copied over two .so files to both lib and lib64 in /vendor, just in case (they had different hashes).
    After reboot and calibration it seems like it shows the correct direction.