yashsingh1/xdaforums huggingface dataset:
[Android Software Development] DiamondJohn:
You said you checked kmsg, but did you check last_kmsg?
[Android Software Development] MKUltraBlack:
How do I get my device tree, to start a build. I want to build twrp for my s7 edge but build it on omni oreo base as the latest official is nougat, I think. Is there a list of the folders or files and can I get them directly from the phone. Many thanks in advance
[Android Software Development] DiamondJohn:
Have you already checked its not an official device? You may be pleasantly surprised.

The next check I would personally do is search guthub for the device/kernel & vendor.. You could also check which are being used for any custom ROMs for your device, if there are any.

Then you could try a similar device

Then maybe try following the many tutorials here and elsewhere in the web to extract a device/vendor and Kernel from a running device.
[Android Software Development] ashyx:
I'm pretty sure this device already has twrp builds available.

You wouldn't be able to compile on Oreo branch anyway if your kernel only supports Nougat and earlier.

---------- Post added at 11:16 AM ---------- Previous post was at 11:15 AM ----------

Is your kernel build permissive?
[Android Software Development] _that:
Do you have a link for new kernel features required by Oreo and what makes old kernels incompatible?
[Android Software Development] ashyx:
Not sure how to answer this or if it's just sarcasm? :rolleyes:

In my experience, and I've tried it on a number of occasions. A Kernel built for a particular Android version tends not to be upwardly compatible with later Android builds, especially for the number of Samsung devices I've complied kernels and TWRP for, which is a considerable number.

Probably due to missing source code required to work with added/changed functionality in later Android versions.

However the reverse is usually fine in my experience as is compiling twrp using earlier branches of Android source code with later kernels.

So all I'm saying is if it doesn't boot try the same or earlier branch of source code to build in.

This doesn't mean back porting features and patches isn't possible to get it to boot on any particular kernel version, it's just a hassle and easier to just build in the right branch in the first place.
[Android Software Development] DiamondJohn:
https://xdaforums.com/android/software-hacking/reference-how-to-upstream-android-kernel-t3626913
[Android Software Development] _that:
I asked because Android should require very little more than a standard kernel - a couple of years ago it was only ashmem and binder that needed to be enabled in the kernel config, and I could run Android on my desktop in a container (using anbox).

Maybe GPU or other drivers - similar experience with NVidia drivers on a desktop. But TWRP doesn't use the GPU, so it should be more compatible with older kernels than Android.

That's a long thread (with a misleading title, but interesting content) - do you have a more specific link to the kernel requirements for different Android versions?
[Android Software Development] ashyx:
Yep, that's true.

I've had no issue booting new versions of twrp with older kernels, that is until Samsung break compatibility with newer boot loaders.

The only issue for example, is say, compiling twrp in Oreo branch of Omni with a MM kernel.

TWRP just won't boot, but compile it in LL or MM branch and it will boot no problem.
[Android Software Development] Micha_Btz:
Heya,

I started to port my twrp from oreo to pie source. Yesterday it breaks for missing libcrypto_hw.so, but it seems, that https://github.com/TeamWin/android_device_qcom_common is only available for oreo.

If I commented out https://github.com/Micha-Btz/zangyapro_twrp/blob/android-9.0/BoardConfig.mk#L41 it build, is this not be needed any more for pie or should I use a other source?

TIA Micha
[Android Software Development] Android-Andi:
https://github.com/LineageOS/android_vendor_qcom_opensource_cryptfs_hw

Look at lineage-16.0 branch. Was moved there on lineage-15.1 already, not sure if Omni and teamwin followed
[Android Software Development] The_Walking_Playground:
Hi,

You could just use the Oreo branch, if that's the latest one that's there. Did you try that?

TWP
[Android Software Development] hamed.n.g1992:
odin APNHLOS error J510F

Hi, good time ,,,I am a home user , i have samsung j510f and upgrade this J510FXXU2BRB2 4file next flashed 1154TWRP_3.0.2_SM_J5_2016_Nougat_7.1.1 by odin And installed tis packages last year:

1154XposedInstaller_3.1.4 - Greenify-ROOT-4.0.1-Mod

it worked well but yesterday i wanted to upgrade again the mistake started from here!!! I took my mobile to the recovery mod and delet every data and reset factory from recovery mod!!!!!!!!next stoped on samsung logo!!!!

i go download mod that flash by new rom THR-J510FXXU2BRE2-J510FOJV2BRD1 4file but error APNHLOS!!!

i try many rom 4file , 1file by odin does not work and error APNHLOS!!!

next try Z3X_SAMSUNG_TOOL_PRO_29.5_Crack that did not work!!!error APNHLOS!!!

next download COMBINATION_FA60_J510FXXU2AQB2 and flash bye ODIN 307 Justttttt and only by ODIN 307!!!!!now it turns on but if try flash again warns error APNHLOS!!!

What should I do to correct?Please help me....Thank you very much

I send the results flash for you in link
[Android Software Development] Android-Andi:
[MENTION=9854059]hamed.n.g1992[/MENTION] off topic here. You better look at your device forums for help.

As a side note:

Making text fat and colorful doesn't help anyone.
[Android Software Development] ashyx:
Just restore the backup you made with twrp BEFORE wiping everything. :rolleyes:
[Android Software Development] hamed.n.g1992:
thanks man
[Android Software Development] Micha_Btz:
This doesn't work.

============================================
[1/1] /home/mdomann/handy/build/recovery/pie/out/soong/.minibootstrap/minibp /home/mdomann/handy/build/recovery/pie/out/soong/.bootstrap/build.ninja
[38/39] glob prebuilts/ndk/stl.bp
[76/76] /home/mdomann/handy/build/recovery/pie/out/soong/.bootstrap/bin/soong_build /home/mdomann/handy/build/recovery/pie/out/soong/build.ninja
FAILED: /home/mdomann/handy/build/recovery/pie/out/soong/build.ninja
/home/mdomann/handy/build/recovery/pie/out/soong/.bootstrap/bin/soong_build -t -l /home/mdomann/handy/build/recovery/pie/out/.module_paths/Android.bp.list -b /home/mdomann/handy/build/recovery/pie/out/soong -n /home/mdomann/handy/build/recovery/pie/out -d /home/mdomann/handy/build/recovery/pie/out/soong/build.ninja.d -o /home/mdomann/handy/build/recovery/pie/out/soong/build.ninja Android.bp
error: device/qcom/common/Android.bp:20:16: unrecognized property "product_variables.lineage"
ninja: build stopped: subcommand failed.
21:14:51 soong bootstrap failed with: exit status 1

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

Will try the old one.
[Android Software Development] Android-Andi:
You should replace your cryptfshw with the one linked.

But it also works using your Oreo setup and checkout pie branch for TWRP. There's no issue compiling newer TWRP versions inside older Android trees. Easiest solution.
[Android Software Development] k4y0z:
I am currently working with an LP-Kernel trying to get a Pie ROM working.

The kernel needed a few selinux-patches, ambient capabilities and hwbinder patches to even boot up properly.

Here is a list of the selinux-patches:

http://jeffvanderstoep.blogspot.com/2016/05/selinux-kernel-patches-for-android-n.html

Here are other patches i needed:

https://review.lineageos.org/c/LineageOS/android_kernel_motorola_msm8226/+/90296

https://review.lineageos.org/c/LineageOS/android_kernel_nvidia_shield/+/206271

https://review.lineageos.org/c/LineageOS/android_kernel_lenovo_msm8974/+/229074/1

https://review.lineageos.org/c/LineageOS/android_kernel_oneplus_msm8996/+/208074/1

https://review.lineageos.org/c/LineageOS/android_kernel_htc_flounder/+/198944/1

Although I couldn't use the binder-patch and had to backport it myself.

Upstreaming as mentioned by [MENTION=5417899]DiamondJohn[/MENTION] will probably get you most patches, but it can also be a lot of work.
[Android Software Development] Micha_Btz:
hm, build was fine now, but flashing a LOS 16.0 is not possible https://gist.github.com/Micha-Btz/8067fae9080e9c0a1d62fd0989c01409

There are also a lots of denies from se-linx. Should I build twrp with se permissive mode?

I already build with BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive. Why twrp doesn't accept my los build?

https://github.com/Micha-Btz/zangyapro_twrp/blob/android-9.0/BoardConfig.mk#L62
[Android Software Development] Android-Andi:
After trying to flash

adb pull /tmp/recovery.log
[Android Software Development] _that:
Thanks for the links, very interesting.

Please be aware that the usual definition of "upstreaming" means that you are contributing *your* patches back to upstream devs - that's why I said earlier that DiamondJohn's thread has a misleading title.
[Android Software Development] Micha_Btz:
https://gist.github.com/Micha-Btz/3b34829f216699bf6d3493379d2909be

I have had some small success, but can't flash a rom. For now flash stops always with:

And also decryption of data don't work.

here is my device tree https://github.com/Micha-Btz/zangyapro_twrp

Help would be great, since I have no diea more by myself.
[Android Software Development] Micha_Btz:
use a prebuild update engine fixes it for me, build update-engine doesn't work.

https://github.com/TeamWin/android_...mmit/8cd790c5050d6f8fac1de97f9b503482aea221cd
[Android Software Development] cloooned:
SM-A405FN

Which Omni platform tree would you recommend for an Android 9 based Samsung model SM-A405FN?

I've tried this one but with some dependencies problems, busybox is missing...

https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/tree/twrp-9.0

If I'll follow the origianl guide with Omni 7.1, build works, but the device won't boot and I don't know if my board config is wrong or the platform is not compatible.
[Android Software Development] The_Walking_Playground:
Hi,

That's the correct tree. In the README for that branch, it tells you how to build without dependencies. And in the 9.0 tree, I believe you should be building with toybox by including TW_USE_TOOLBOX in your BoardConfig. See if that helps.

TWP
[Android Software Development] cloooned:
Thanks, at least that works for now...
[Android Software Development] Magendanz:
Deleted
[Android Software Development] MikeAngel0:
Phone not listed.

Hello, and sorry if this doesn't belong here.

I want to compile TWRP for my phone with Android 8.1.0. However, my phone is a TP-Link Neffos C7. It doesn't use a custom ROM and cannot be rooted. Is there still a possibility to build a Custom Recovery for my phone?﻿

Thanks in advance.
[Android Software Development] ashyx:
You don't need root to install a custom recovery.

You just need some way of flashing it to your device.
[Android Software Development] MikeAngel0:
Thanks for the response.

I'm glad that I don't need root privileges to install a Custom Recovery. I do have a way to flash the recovery into the phone via SP Flash Tools.

Still, I have quite the doubts about this but I'll post them here and in another thread I found in case someone can help.

- TWRP is available on Android 8.1.0? Or should I try to compile something like Red Wolf or OrangeFox?

- I just need to deactivate the Zip verification signature, is it necessary to flash a Custom Recovery then?

Thanks again for the response and hope someone else can help me clear these doubts. Cheers!
[Android Software Development] Ab.Shaheen:
I have a problem, i have used many recoveries, ported one, unofficial builds, even i have compiled myself. The problem i am facing is the issue while installing OTA updates.

Currently i am maintaining havoc OS for lg device. But during OTA flash device reboots directly to twrp and does not lash OTA automatically. have to flash manually, while on stock recovery (which is based on lineage recovery) it flashes automatically without any user interference, i am just curious if i am missing any property to set.
[Android Software Development] ashyx:
Custom recoveries aren't usually compatible with stock OTA's as they don't do the required hash check.

Stock recovery is usually required unless the OS is custom such as Lineage.
[Android Software Development] Ab.Shaheen:
But i have seen unoffocial builds of twrp as well, which supports OTA autoflash. all of them are unified recoveries, can you please give me an idea what is unified recovery and what properties i will need to set. usually recovery need otautils and f2fsk support to work with ota files, my updater successfully create block.map, uncrypt_file, uncrypt_status and fstab files in /cache/recovery which are needed fot OTA. but recovery does not see that at all. even recovery need to check hashes then there should be any error in recovery log, but there is nothing like that, log file was as simple as rebooted into recovery normally.
[Android Software Development] pix106:
FYI, I've already uodated official havoc os ota just fine using twrp on xiaomi mipad4.
[Android Software Development] Ab.Shaheen:
yeah that i know, TWRP works with havoc, but how, there are unified TWRP versions of TWRP which support OTA autoflashing.
[Android Software Development] _that:
Since TWRP is licensed under GPLv3, you can obtain the source code of those unofficial builds and see what they did to support OTA autoflashing.
[Android Software Development] Micha_Btz:
Hi there,

I trying to get encryption to work for my zangyapro, but there are some problems:

adb logcat shows:

WARNING: linker: error reading config file "/system/etc/ld.config.txt" for "/sbin/busybox" (will use default configuration): error reading file "/system/etc/ld.config.txt": Too many symbolic links encountered
WARNING: linker: error reading config file "/system/etc/ld.config.txt" for "/sbin/logcat" (will use default configuration): error reading file "/system/etc/ld.config.txt": Too many symbolic links encountered
11-26 11:01:54.934 857 857 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 857 (hwservicemanage), pid 857 (hwservicemanage)
11-26 11:01:54.936 857 857 F libc : crash_dump helper failed to exec
11-26 11:01:54.937 857 857 F libc : failed to wait for crash_dump helper: No child processes
11-26 11:01:59.922 864 864 W linker : error reading config file "/system/etc/ld.config.txt" for "/sbin/hwservicemanager" (will use default configuration): error reading file "/system/etc/ld.config.txt": Too many symbolic links encountered
11-26 11:01:59.933 864 864 F libc : CANNOT LINK EXECUTABLE "/sbin/hwservicemanager": cannot locate symbol "_ZN7android8hardware7details14gServiceSidMapE" referenced by "/sbin/android.hidl.token@1.0.so"...

recovery.log

I:Switching packages (TWRP)
I:Starting Adb Backup FIFO
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'mount'
I:Set page: 'decrypt'
I:Set page: 'trydecrypt'
I:operation_start: 'Decrypt'
I:Unable to find a directory to store TWRP logs.D:crypt_ftr->fs_size = 106938303
I:Using scrypt with keymaster for cryptfs KDF
I:TWRP keymaster max API: 3
I:Signing safely-padded objectcould not find any keystore module
Failed to init keymaster 0/1
E:Decrypt took too long, killing process
I:Child process killed successfully
Failed to decrypt data.
I:Set page: 'decrypt'
I:operation_end - status=1
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'

here is my devices tree:

https://github.com/Micha-Btz/zangyapro_twrp/tree/oreo

I think "Failed to init keymaster" is my problem, is this dedicated to /sbin/hwservicemanager?

Someone an Idea?

Micha
[Android Software Development] SachinBorkar:
How to compile TWRP with precompiled kernel ?

I have device tree.
[Android Software Development] Android-Andi:
TARGET_PREBUILT_KERNEL :=

As an example https://github.com/TeamWin/twrp_android_device_samsung_gts4lwifi/blob/master/BoardConfig.mk
[Android Software Development] ianmacd:
Syncing to and building for a given release version.

What's the correct way to build TWRP for a given named release instead of against the head of a branch?

If I repo init and repo sync, which is what the official docs tell one to do, I get the head of the branch, including any changes since the latest release, 3.3.0. This includes fixes, but also new bugs, of course.

I had hoped to be able to reset an existing tree, already synced to HEAD, like this:

repo init -u git://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni.git -b twrp-9.0
repo sync -d && repo forall -c 'git reset --hard'

but the manifest gives me the head of bootable/recovery, for example. bootable/recovery isn't tagged, so I can't sync against a commit tagged with something like v3.3.0 or whatever, because it doesn't exist.

How does one achieve this? I feel as if I must be missing something obvious.

UPDATE:

The answer, I'm told, is just to git reset bootable/recovery to the release commit and not worry about any of the external dependencies.
[Android Software Development] _that:
Yes, TWRP doesn't have formal tagged releases because some device-specific builds are done at different times from the then-current sources (a truncated hash of the bootable/recovery commit used for building is written to recovery.log).

Unless you have a very strict requirement for stability you should just use the head of the current branch (and report any bugs immediately :)). But if you insist you can also add a revison="the_commit_hash" attribute to the project element in the manifest to "pin" a repository to a specific commit.
[Android Software Development] ianmacd:
Thanks for your answer. That makes things clearer.

In fact, my first approach was, indeed, to go with the head of the branch, but as chance would have it, this did result in a quite significant bug creeping into the build, rendering it unusable. It took me a couple of hours of wading through unfamiliar code before I found the commit that had caused it, at which time I filed an issue about it and e-mailed the author.

That was the moment that the thought came to me that I probably shouldn't be using the head of the branch, but it wasn't obvious to me how to reset all the repos from the manifest to a given moment in time, hence the question I asked here today.

Learning the idiosyncratic ins and outs of TWRP is something of an arcane process with its fair share of labyrinthine passages to navigate; but I'm getting there.

Cheers again.
[Android Software Development] ianmacd:
BusyBox deprecation and the problem of legacy ROM/mod installer code.

I recently started maintaining three builds of TWRP and, given that these builds target devices running Android 9.0, I built them without BusyBox, having been advised that BusyBox is deprecated for devices running Android 9.0 and later.

The only problem is that the builds have since come in for some flak for allegedly being "broken". In actual fact, they are working as designed. They merely expose the unsafe assumptions made by legacy zip file installer code.

One of these assumptions is the availability on the system of BusyBox. Not only does the typical install script fail to check for its existence, there invariably isn't even a post-installation check to verify the correct completion of the work. When, following a botched, partial flash, the device in question subsequently fails to boot, the blame wrongfully gets apportioned to TWRP; particularly if the installer code in question previously worked as intended on a different device running a different build of TWRP, where its assumptions did hold true.

Whilst it should be trivial for script authors to fix their installer code (for example, either by first verifying the existence of BusyBox or by directly invoking symlinked applets in /sbin), I'm seeing some resistance to the idea. Not every so-called developer is capable of writing robust code or cares enough to do the work. Furthermore, end users are selfish pragmatists, and care much less whether the fix is applied in the right place, and much more about obtaining a fix — any fix — promptly.

This creates some pressure to build TWRP with BusyBox after all.

I want to do things properly. I am loath to include BusyBox if it means perpetuating the existence of sloppily written installer code that really ought to be fixed, but I am pragmatic enough to see the argument for simply including BusyBox and putting an end to the discussion.

What do other TWRP maintainers do in this situation? Should I give in to demand and include BusyBox, or are the reasons for its deprecation strong enough to continue to omit it?
[Android Software Development] gee one:
That's a dilemma for sure. It seems like the world is moving towards toybox, so that seems like the way to go to me. Plus, if it's easier for you to build with toybox and the right thing to do, then that seems like all reasonable decisions point to using toybox and dropping support for busybox. Maybe just put a big warning that new twrp is not compatible with legacy zips?

Does TWRP have an official stance on busybox vs toybox?

Back in the day, people flashing their phones would unpack and modify zips to get them to work- they used both hands to type on the command line, so no hand-holding was needed. I get it that the modern tools offer a lot of convenience, but the whole do-it-yourself spirit is, ya know, to do it yourself!

Thanks in advance for your work!

Edit: in full disclosure, I have nothing to do with twrp. I build it for my own builds, but that is the end of my ability. I rely on the hard work of maintainers and programmers who blazed a wide path for others to follow.
[Android Software Development] RebelLion_:
So i got a compilation error with my Moto E4's TWRP source. This is the stock source, i havent changed anything and we have a working unofficial TWRP from this source supposedly

https://github.com/moto8937-twrp/android_device_motorola_msm8937-common.git

The error I'm getting is this:

/bin/bash: /home/rebellion/recovery/twrp/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-androidkernel-strip: No such file or directory

This is the directory's contents:

~/recovery/twrp$ ls prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/

aarch64-linux-android-addr2line aarch64-linux-androidkernel-cpp
aarch64-linux-android-ar aarch64-linux-androidkernel-gcc
aarch64-linux-android-as aarch64-linux-androidkernel-ld
aarch64-linux-android-c++ aarch64-linux-androidkernel-nm
aarch64-linux-android-c++filt aarch64-linux-androidkernel-objcopy
aarch64-linux-android-cpp aarch64-linux-androidkernel-objdump
aarch64-linux-android-dwp aarch64-linux-androidkernel-size
aarch64-linux-android-elfedit aarch64-linux-android-ld
aarch64-linux-android-g++ aarch64-linux-android-ld.bfd
aarch64-linux-android-gcc aarch64-linux-android-ld.gold
aarch64-linux-android-gcc-4.9 aarch64-linux-android-nm
aarch64-linux-android-gcc-ar aarch64-linux-android-objcopy
aarch64-linux-android-gcc-nm aarch64-linux-android-objdump
aarch64-linux-android-gcc-ranlib aarch64-linux-android-ranlib
aarch64-linux-android-gcov aarch64-linux-android-readelf
aarch64-linux-android-gcov-tool aarch64-linux-android-size
aarch64-linux-android-gprof aarch64-linux-android-strings
aarch64-linux-androidkernel-ar aarch64-linux-android-strip
aarch64-linux-androidkernel-as

It fails at 93% every time and i feel like this is the only issue that needs to be resolved for a successful compilation. Any ideas what to do?
[Android Software Development] Android-Andi:
Depending on Google's branch strip exist properly or not.

https://github.com/Unlegacy-Android/android/commit/00436d24fccef070b29af98c6927951a2b3c8e6a

Edit:

From your BoardConfig:

KERNEL_TOOLCHAIN_PREFIX := aarch64-linux-androidkernel-

Try

KERNEL_TOOLCHAIN_PREFIX := aarch64-linux-android-