yashsingh1/xdaforums huggingface dataset:
[Galaxy Note 4 Original Android Development] Phil3759:
[MENTION=2638973]bigbiff[/MENTION]

Hi,

I recently tested TWRP 3.0.2.0 for Note 4 and I am amazed of the work you have done on it, everything seems perfect now.

I have a small spare time again for a few weeks and wanted to compile it my self and try to implement samsung crypto back maybe on the 6.0 branch. Current version won't handle encryption on Note 4 with Android M.

However, I don't see recent device tree or kernel for trlte. Omni git has no official support to trlte.

Teamwin repos are at 5.1

I am used a bit to TWRP sources, but to spare my time, I was looking for the 6.0 device and kernel repos you build against omni 6.0 repo sources.

If anyone can help provide actual repos it would be great.

Obviously, any change I would do will be committed to official omni gerrit. I have no plans to contribute to any other recovery as I consider TWRP the ultimate viable solution.
[Galaxy Note 4 Original Android Development] bigbiff:
For note4 repos, you can search for trlte. [MENTION=5672995]jcadduono[/MENTION] has been doing some work to get encryption working on klte and hlte. Please see our repositories on https://github.com/TeamWin
[Galaxy Note 4 Original Android Development] jcadduono:
I have only just taken the previous Samsung crypto code from 2.8.x.x and applied it to the newer 3.0.x base, and you can find a patchset for getting started on working Samsung encryption here: https://gerrit.omnirom.org/#/c/17308/

As for Note 4 TWRP sources.... https://github.com/TeamWin/android_device_samsung_trlte does have an android-5.0 branch but you can simply git checkout -b android-6.0 from that and build it in omni-6.0 instead.

I think Note 4 could use quite a few fixes at this point however. It looks like that branch is lacking MTP, UMS, exFAT, F2FS, and AOSP encryption support, and might be hackily running off a stock kernel?
[Galaxy Note 4 Original Android Development] Phil3759:
thanks both

[MENTION=2638973]bigbiff[/MENTION]: I just wanted to be sure that the device and kernel repos from the https://github.com/TeamWin git are the ones you built against the official TWRP 3.0.2.0.

This would give me a good start point for clean builds and avoid spending time on fixing the device tree and the kernel code
[Galaxy Note 4 Original Android Development] jcadduono:
I am going to see about fixing up the device trees for all the lacking features and marshmallow today.

Progress happening here: https://github.com/jcadduono/android_device_samsung_trlte

and here (kernel): https://github.com/jcadduono/nethunter_kernel_trlte/tree/twrp-5.1

Not stable yet, need to make some fixes especially to init, file contexts, etc.
[Galaxy Note 4 Original Android Development] Phil3759:
Thanks, subscribing to your git

Just one question to clarify things: the device tree in Teamwin git is the one used to build the official TWRP on their website or no ? If yes, it is working perfectly with every function I tested, even MTP and Qualcom time. If not, why Teamwin doesn't provide the device tree for teh devices they build, since Omnirom git only hosts 5 years old devices ?

I am currently doing a repo sync on omnirom git. Will take a while before it is done and I can look at it
[Galaxy Note 4 Original Android Development] jcadduono:
Yes all devices on twrp.me must/should be built from TeamWin/android_device_manufacturer_device. I'm not sure why the repo for trlte is not up to sync, I figured the device was broken because of it. You can also fetch an entire repository from gerrit as well. Nonetheless, I have created a test build (for Europe, Oceanic, and Americas) here:

https://idlekernel.com/twrp/trlte/testing/ (3.0.2-1-rc1)

Non-EU/America/Oceanic users as well as Note 4 edge will have builds available on request. I figure the only difference will be dtb image anyway.

If you want to build from my sources, you will need to cherry-pick this: https://gerrit.omnirom.org/#/c/18164/

If you don't mind informing me of any issues that you can find in that build so I can go about fixing them, please give it a whirl!

Here's a checklist if you wanna go over it:

Blocking checks
[ ] - Correct screen/recovery size
[ ] - Working touchscreen
[ ] - Backup to internal/microSD
[ ] - Restore from internal/microSD
[ ] - Reboot to system
[ ] - ADB & ADB shell
[ ] - Flash zips in Install page
[ ] - Flash boot.img/recovery.img using Flash Image in Install page

Medium checks
[ ] - Flash zip with ADB sideload
[ ] - UI colors (red/blue inversions)
[ ] - Screen goes off (and back on :))
[ ] - EXT4 support (wipe/format/restore to)
[ ] - F2FS support (wipe/format/restore to)
[ ] - exFAT support (wipe/format)
[ ] - NTFS support (wipe/format)
[ ] - System, Data, Internal Storage, microSD card/Modem/Firmware/EFS (if applicable) partitions listed in mount/backup choices
[ ] - Decrypt encrypted /data
[ ] - Correct date
[ ] - MTP read/write
[ ] - USB Mass Storage read/write
[ ] - Set brightness level

Minor checks
[ ] - Reboot to bootloader/download mode
[ ] - Reboot to recovery
[ ] - Power Off
[ ] - Battery level
[ ] - Temperature
[ ] - Encrypted backups
[ ] - Vibration
[ ] - Screenshot
[ ] - Resize data partition

Thanks!
[Galaxy Note 4 Original Android Development] Phil3759:
Oh, that's great, I will do for sure and give you a detailed feedback with your checklist

If it is only a kernel issue, no worry, I usually opt to compile a kernel myself from source, force it to be permissive and eventually add kernel modules for fancy file systems.

If TWRP doesn't need any extra kernel modules, it should be fine

I will let you know
[Galaxy Note 4 Original Android Development] jcadduono:
Ok I've got a variety now...

https://idlekernel.com/twrp/trlte/testing/3.0.2-1-rc2/

Qualcomm Snapdragon models only

Chinese Note 4 grab trltezc

Every other Note 4 model takes trlte

Japan Note Edge grab tbltekdi

Every other Note Edge model takes tblte

This should hopefully cover ever existing model of Note 4 and Note Edge for Qualcomm.

If you guys wouldn't mind trying them out, and filling in as much of this as you can with [pass] or [fail], and uploading a recovery.log (even if it works fine!), it would help with moving it to stable:

Blocking checks
[ ] - Correct screen/recovery size
[ ] - Working touchscreen
[ ] - Backup to internal/microSD
[ ] - Restore from internal/microSD
[ ] - Reboot to system
[ ] - ADB & ADB shell
[ ] - Flash zips in Install page
[ ] - Flash boot.img/recovery.img using Flash Image in Install page
[ ] - Correct model names (ro.product.device, ro.product.model, ro.product.name)
[ ] - Temperature stays below 90 Celsius during backup/restore

Medium checks
[ ] - Flash zip with ADB sideload
[ ] - UI colors (red/blue inversions)
[ ] - Screen goes off (and back on :))
[ ] - EXT4 support (wipe/format/restore to)
[ ] - F2FS support (wipe/format/restore to)
[ ] - exFAT support (wipe/format)
[ ] - NTFS support (wipe/format)
[ ] - System, Data, Internal Storage, microSD card/Modem/Firmware/EFS (if applicable) partitions listed in mount/backup choices
[ ] - Decrypt encrypted /data (AOSP/CM based!)
[ ] - Correct date
[ ] - MTP read/write
[ ] - USB Mass Storage read/write
[ ] - Set brightness level
[ ] - OTG storage mounting (if applicable)

Minor checks
[ ] - Reboot to bootloader/download mode
[ ] - Reboot to recovery
[ ] - Power Off
[ ] - Battery level
[ ] - Temperature
[ ] - Encrypted backups
[ ] - Vibration
[ ] - Screenshot
[ ] - Resize data partition
[Galaxy Note 4 Original Android Development] Phil3759:
Here's the feedback from RC2 for trlte (international Note 4)

Blocking checks
[x] - Correct screen/recovery size
[x] - Working touchscreen
[*] - Backup to internal/microSD
[ ] - Restore from internal/microSD
[x] - Reboot to system
[*] - ADB & ADB shell
[x] - Flash zips in Install page
[x] - Flash boot.img/recovery.img using Flash Image in Install page

Medium checks
[ ] - Flash zip with ADB sideload
[x] - UI colors (red/blue inversions)
[x] - Screen goes off (and back on :))
[x] - EXT4 support (wipe/format/restore to)
[ ] - F2FS support (wipe/format/restore to)
[ ] - exFAT support (wipe/format)
[ ] - NTFS support (wipe/format)
[x] - System, Data, Internal Storage, microSD card/Modem/Firmware/EFS (if applicable) partitions listed in mount/backup choices
[-] - Decrypt encrypted /data
[*] - Correct date
[x] - MTP read/write
[x] - USB Mass Storage read/write
[x] - Set brightness level

Minor checks
[x] - Reboot to bootloader/download mode
[x] - Reboot to recovery
[x] - Power Off
[x] - Battery level
[x] - Temperature
[ ] - Encrypted backups
[x] - Vibration
[-] - Screenshot
[ ] - Resize data partition

[ ] : empty means not tested

[x] : means tested and working

[*] - Backup to internal/microSD

ok external, not possible to internal sd because of encryption

[*] - ADB & ADB shell

Seems like some memory overflow issue in displaying user name in cmd line

Check image attached

[-] - Decrypt encrypted /data

Not supported, no prompt for decryption key

[*] - Correct date

not working because of /data encrypted on qualcom boards

[-] - Screenshot

fb2png binary not present in /sbin

Probably missing TW_INCLUDE_FB2PNG flag

Settings saved on reboot

not if encrypted, which is the most annoying as TWRP doesn't seem to support storing settings to external sd

Conclusion:

severe issue:

The adb shell bizarre characters in user name field suggest a buffer overflow in that field or at best a buffer over-read

minor issues

- TWRP lacks an option to store settings in external sd when /data/internal sd is not mountable / encrypted

- Missing fb2png in these builds, maybe just the TW_INCLUDE_FB2PNG flag missing

- Implementing Samsung decryption if doable, password/pin/pattern

- a UI shortcut to save screenshots like I implemented in PhilZ Touch would be welcome instead of adb
[Galaxy Note 4 Original Android Development] jcadduono:
Your adb issue is normal on Windows, probably due to control character and TERM variable. It is like that on all devices afaik. Command prompt isnt a good linux shell, I recommend using something like mintty or putty to connect to adb. It is still functional though?

You are sure screenshots are not working? Normally fb2png is not necessary on qcom devices if ever. Screenshot is vol-down + power I think, or maybe vol-down + home can't remember. The screenshots should be saved to external SD.

As for encryption, we probably won't have samsung encryption working for some time...we have some initial patching available in gerrit but doesn't work as we don't know the current Samsung crypto API in L and M. Hence why it says AOSP/CM only, would like to know if that is working if anyone finds the time to install CM.
[Galaxy Note 4 Original Android Development] Phil3759:
Adb is fine display in linux in fact, wasn't aware about the windows issue. Otherwise, yes, it works as expected and pull/push is fine

Screenshot: vol-down + power works and screens are nice. However, it took me a while to figure where they are stored. Found in logs they are saved in /tmp ! so volatile on reboot or can be moved using built in file manager at least on the built in terminal. I could look at sources to find why they are not stored to external storage

Encryption: I thought the libs you submitted could work in M. So yes, if the decryption call/libs is not known, it will be hard to fix it in deed

About saving settings to external storage, which is the most annoying on an encrypted device:

Following the source, I see TWRP code forces internal storage as settings storage in partition.cpp and forcing Is_Settings_Storage only on internal storage or /data/media

https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/partition.cpp#L396

and the later occurances of Is_Settings_Storage is that file

A simple way to fix it I see in partition.cpp:

https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/partition.cpp#L164

is by editing the fstab and adding this flag to external storage "settingsstorage"

This needs no recompile of TWRP, just a repack, but will force it on all builds if added in sources

A better approach, that looks rather easy in sources, is modifying the code in partition.cpp to set "Is_Settings_Storage" bool true on external storage when internal storage is not available. Actually, the code only enables it on Internal_Storage or on /data/media detection

What do you think about it ? Is there a reason that external storage (when detected available) was not added in sources to store settings if internal storage is unavailable ?
[Galaxy Note 4 Original Android Development] jcadduono:
I've thought about fixing the settings storage flag but never got to it. At the moment it does nothing but set the partition to storage and has nothing to do with settings.

Ideally when it is fixed I would likely set EFS to settings storage.
[Galaxy Note 4 Original Android Development] Phil3759:
You are right

The issue is here I think:

- When processing fstab, Partition_Post_Processing() will trigger /data/media setup when reading /data mount point in fstab file

https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/partitionmanager.cpp#L106

- /data/media is called early in fstab processing, before the external storage, it will set Is_Settings_Storage to true

https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/partition.cpp#L849

- settings_partition will be immediately set to /data/media

https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/partitionmanager.cpp#L113

- later, when fstab processing flags reach to external sd with the settingspartition flag, it won't be considered since settings_partition is already set

A simple and maybe proper approach would be just to replace in this line:

https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/partition.cpp#L628

Is_Settings_Storage by a new external bool Is_Forced_Settings_Storage

Then before this line, we add an extra if condition

https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/partitionmanager.cpp#L113

to test for Is_Forced_Settings_Storage and (*iter)->Is_Present and we assign settings_partition its value

If you think it is worth it, I can try to send a patch through gerrit when I have some time

PS: I am not sure that setting it to EFS is something most users would like. It means the partition will be mounted r/w and data written to it regularly. If something goes wrong, partition could be corrupted. If no backup, phone is dead, at least Samsung devices. Plus, you'll need to do further changes in code to separate "settings storage" from a path to be designed as storage
[Galaxy Note 4 Original Android Development] jcadduono:
EFS is safe to write to on at least all the devices I maintain, and is only used as a cache for baseband and firmware (storing calibration data for proximity, gps, etc). Zeroing it out will result in stock firmware regenerating it on boot from scratch, and it typically has plenty of space available for fitting additional settings like TWRP, hence why I'm not worried.

I think what would be preferred is to not create a new flag, but have settings storing iterate through all partitions marked as settingsstorage and save settings to each one that is mounted rw. The flag should be entirely separated from storage flag, allowing non-storage partitions to be used for settings storage. If you want to go about trying to make this happen, that would be great!
[Galaxy Note 4 Original Android Development] Phil3759:
I wanted to be sure of a team dev intentions before submitting anything.

What about loading prefs ? What partition should be priotirized? Imagine a dev adding a settings storage flag to fstab in his device tree. How TWRP would choose the default. Internal - >external - > efs - > cache... A UI choice should be added?

On some older samsung devices, efs is not regenerated for sure, like S2, S3. People could loose emei. So EFS must only be enabled by flag
[Galaxy Note 4 Original Android Development] jcadduono:
It should only be selected by fstab line, not by user. In most cases you would only have 1 partition or none marked for settings storage, and it would only save to those 2 places (internal storage is always settings storage), and when loading settings I suppose it would be ideal to check internal storage before settings marked partitions, and only iterate settings marked partitions for loading if not already able to load settings from internal. It should still save copies of settings to each partition marked as settings storage IF the partition is mounted RW, and ignore the partition when saving if it is not.
[Galaxy Note 4 Original Android Development] Phil3759:
Seems logical and easily doable if no UI interaction is needed

I will look at it as soon as I have a little time
[Galaxy Note 4 Original Android Development] Phil3759:
Had a few time and tried to give it a quick shot and start to compile TWRP for the first time. However, your device tree is broken (no kernel sources specified and 6.0 environment requires it even if prebuilt kernel is set).

Adding necessary kernel sources and setting all defconfig files in BoardConfig further fails with bootimage.mk make rule missing

Not sure how you built with the tree in your git!

I tried Teamwin repos and they also seem outdated. They still have the device.mk instead of omni_trlte.mk, so they don't even lunch.

Sorry, but since I have less time than old day, I hoped for a working device tree to start compile TWRP and fix sources without much bothering about fixing device tree from scratch. After all, trlte is a 3 years old device, so was expecting the basic sources to be working.

Would have been great if omnirom git hosted uptodate and working device trees like in cyanogenmod. As it is now, it seems really fragmented across many devs.

Maybe Teamwin could provide the proper repos for the devices officially supported so that every new comer to TWRP doesn't have to redo the same thing: start with a device tree from scratch. That's what I did when I was compiling CWM mod recoveries for 177 devices.

Anyway, I will look at it whenever I have a spare weekend

Thanks anyway for your help

PS: Am I supposed to just build TWRP in cm repo ? Or get device tree from cm and add TWRP flags ?

Really sorry as I never expected omnirom not having any device tree with it.
[Galaxy Note 4 Original Android Development] jcadduono:
Kernel sources are not a requirement (for building, should always be hosted on github and pointed to from device tree, either from README or BoardConfig!) and it builds fine without them. I've always used prebuilt kernel images and linked to the sources in the README.md due to compiler variations and whatever else, it's extra time to build the kernel with each recovery image.

I'm not sure what you're doing wrong to cause the compilation to fail, as it works in the TWRP jenkins, the omnirom 6.0 build tree on my PC, and both the omnirom 6.0 and 5.1 build trees on my server (idlekernel.com)

https://github.com/jcadduono/android_device_samsung_trlte is what you have cloned? (don't forget to fetch it and reset --hard to the HEAD of it, I had to rebase some of the commits to clean it up before submission)

As for issues with the current tree on TeamWin github, that is why I chose to take over the device.
[Galaxy Note 4 Original Android Development] Phil3759:
Thanks again

I will try to rebase and be sure of the code matching

Yes, I did a full repo sync on omnirom then a git clone on my fork of your device tree repo and a git clone on my fork of your kernel for trlte (twrp-5.1 branch)

Will look at them later this week. Just trying to get TWRP compile to check the code. I also prefer prebuilts kernel to speed things.

Any thoughts why omni repos don't have any updated device trees for TWRP ? I imagine it is a "Historical story..."
[Galaxy Note 4 Original Android Development] Phil3759:
Ok, got it fixed, some upperscore in device/Samsung folder name was there and I didn't notice it because of the fonts size

make: *** No rule to make target `/root/Desktop/build_cm10/android-build_omni/out/target/product/trlte/obj/STATIC_LIBRARIES/libinit_msm_intermediates/export_includes', needed by `/root/Desktop/build_cm10/android-build_omni/out/target/product/trlte/obj/EXECUTABLES/init_intermediates/import_includes'. Stop.
make: *** Waiting for unfinished jobs....

libinit_msm is built in device/qcom/common which is included in omni.dependencies files

Am I missing some trlte_common or samsung _qcom_common trees?

Ok: this was fixed by editing the qcom_utils.mk in core, not sure why it is broken. Maybe because Omnirom doesn't support trlte and many new qualcom devices
[Galaxy Note 4 Original Android Development] bigbiff:
I am not sure I understand what you are saying? Is the download OK or not?
[Galaxy Note 4 Original Android Development] kondronaute:
download ok but when I install I got 2.8.2.0 :p
[Galaxy Note 4 Original Android Development] bigbiff:
Please paste the link here that you downloaded.
[Galaxy Note 4 Original Android Development] kondronaute:
i think the last one :( I not remember exactly :(

http://www.techerrata.com/browse/twrp2/treltexx
[Galaxy Note 4 Original Android Development] Danilo Pantelić:
Same error here with zip file...

Problem solved with img file and flashify program!

Taking screenshot from recovery still doesn't working :(
[Galaxy Note 4 Original Android Development] SUNUN:
I confirm it is now blue! http://techerrata.com/bigbiff/openrecovery-twrp-2.8.3.0-treltexx.img.tar
[Galaxy Note 4 Original Android Development] kondronaute:
i think it's pbm with flashing the zip with twrp.

if you are on TWRP2.8.1.2 and flash the zip it say it flashed but in fact not flashed and you stay 2.8.1.2

if you decompress the file and flash the recovery.img with flashify it work and you have TWRP 2.8.1.3
[Galaxy Note 4 Original Android Development] bigbiff:
tre3gxx or treltexx?
[Galaxy Note 4 Original Android Development] kondronaute:
treltexx
[Galaxy Note 4 Original Android Development] bigbiff:
Yeah, going to check it out tonight.
[Galaxy Note 4 Original Android Development] xavivts:
Hi, I tried to upgrade to 2.8.3.0 and gives me Fail. trltetmo variant is the perfect 2.8.1.1 me going with this same variant, do not understand what the problem is. greetings and thanks
[Galaxy Note 4 Original Android Development] MartiniGM:
TWRP 2.8.3.0 for trelte (SM-910F)

Hi,

Here is a working TWRP 2.8.3.0 for SM-910F (trltexx). It's pretty much a modded Indian version (trelted). I changed the default.prop to match the values from stock SM-910F recovery.

And I am also able to flash the openrecovery-twrp-2.8.3.0-trlte.zip file from from TWRP recovery.
[Galaxy Note 4 Original Android Development] xavivts:
EEYYY friend, that if I work on my 910F thank you very much. the truth is not what is happening and that has not worked for me this time trltetmo and if the version that you have put me.

I really do not know what's happening, I have increasingly less clear that variant have to install :(
[Galaxy Note 4 Original Android Development] bigbiff:
I reuploaded the image. Please test it from techerrata.
[Galaxy Note 4 Original Android Development] xavivts:
Yeeeaahh now if it works, in the future this will be my version? Thank you very much
[Galaxy Note 4 Original Android Development] MartiniGM:
I've tried flashing some of the other TWRP recovery images from CWM with no luck and I haven't managed to install TWRP on my Note 4 (910F) before today. I used Flashify and it worked at first attempt.

I never actually made an Odin recovery image but I actually think the atteched file should work.. at least it's the same recovery.img and the MD5 check validates in Odin.

Because of file extension limitations, I had to TAR the recovery.tar.md5 one more time. :)
[Galaxy Note 4 Original Android Development] bigbiff:
Had to fix the zip. It is official.