yashsingh1/xdaforums huggingface dataset:
[Android Software Development] morfikov:
I have the following line in the BoardConfig.km file

TW_BRIGHTNESS_PATH := /sys/class/leds/lcd-backlight/brightness

This file exists. When the screen goes off, the content of the file shows:

# cat /sys/class/leds/lcd-backlight/brightness
0

When I press the power button, it shows:

# cat /sys/class/leds/lcd-backlight/brightness
10

which is the right value, but the screen is off.

I tried to echo that file with a bigger number (100, 255), but nothing happens, I mean the value is set, but the screen is still off.

I've checked whether changing the screen brightness works under the working Android, and echoing that file makes the screen brighter or dimmer, so the file is correct. So any idea why this isn't working in TWRP?
[Android Software Development] _that:
Not really an idea why, just an idea what to try next: Compare the kernel logs (dmesg) from "fastboot boot" and "fastboot flash". Pay attention to the kernel command line and any lines that could be related to the display or backlight.
[Android Software Development] morfikov:
There's really no difference in the command line. In the case of flash I have two additional options: gpt and rr=2 -- I don't know what adds them and what they do.

The kernel and recovery logs look very similar

There are some differences in SElinux policies so I added just in case

BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive

But still no difference -- it works when booted from RAM, and it doesn't work when flashed.

---------- Post added at 10:47 PM ---------- Previous post was at 10:00 PM ----------

I targeted it! It looks like the problem is the rr=2 kernel cmd option . Does anyone know what the "rr" means?

---------- Post added at 11:29 PM ---------- Previous post was at 10:47 PM ----------

I was trying to build the image with rr=0, rr=1, rr=3, but it doesn't work. Still don't know what that rr is. Is there a way to remove this option from the kernel command line somehow?
[Android Software Development] sub77:
no. is rr set by kernel or bootloader?
[Android Software Development] morfikov:
I don't know. Is there a way to find that out?
[Android Software Development] andy_zhang:
How to get BoardConfig.mk?if hav no BoardConfig.mk,i Should do what?

China user
[Android Software Development] ashyx:
Make it yourself.
[Android Software Development] andy_zhang:
I have official boot and recovery, i wanna make twrp.I use omni 6.0. But Idont know how to get BoardConfig.mk .

China user
[Android Software Development] ashyx:
Find a github source for a device with the same platform as yours and modify the make files as you need.

Which device do you have?
[Android Software Development] MSe1969:
TWRP 3.0.3 f. osprey build issue

Update: I came one step further. Using now

<project name="sultanqasim/android_kernel_motorola_msm8916" path="kernel/motorola/msm8916" remote="github" revision="squid_marshmallow"/>
<project name="TeamWin/android_device_motorola_osprey" path="device/motorola/osprey" remote="github" revision="android-6.0"/>
<project name="TeamWin/android_device_motorola_msm8916-common" path="device/motorola/msm8916-common" remote="github" revision="android-6.0"/>

for the device specific part and altered the BOARD_KERNEL_CMDLINE value in device/motorola/msm8916-common/BoardConfigCommon.mk from ... androidboot.bootdevice=soc.0 ... to ... androidboot.bootdevice=7824900.sdhci ...

Now the recovery is able to mount everything and even attempts to decrypt my data partition, but always reports that the password is wrong (with earlier TWRP, all works fine).

Any advice? Thanks a lot, M
[Android Software Development] gabrielgagz:
IS there a way to shrink the size of TWRP? My recovery partition is 15,4mb even with the kernel compiled with xz the final result of twrp is around 17mb...i know i can avoid languages but is not enough...
[Android Software Development] Android-Andi:
Lzma compressed recovery ramdisk might help, needs an custombootimage.mk

Gesendet von meinem A0001 mit Tapatalk
[Android Software Development] kirito9:
Build without superSU, MTP, sdcard partitioning etc.
[Android Software Development] gabrielgagz:
Great i'll check this! Thanks

Thanks i've found some info here https://xdaforums.com/showpost.php?p=70836209&postcount=2721
[Android Software Development] oF2pks:
f2fs twrp/format: 1.4 vs 1.6 vs 1.7 ?

When changing a partition to f2fs, what are the differences (regarding the external/f2fs-tools version built in twrp) between 1.4, 1.6 and 1.7 ?

If any, what f2fs' compatibility needed with roms (and fstab flags...?) ?

Thx for helping.

btw, I recently move to omni branch 711 (for f2fs_ver=1.7), and had easy(?) "broke" :

- twrp libf2fs.so build OK but miss in recovery.img/sbin (needed for format) (: thx to [MENTION=6829336]Hacker432[/MENTION] )

Checked on /cache

...
...
I:operation_start: 'Change File System'
Formatting Cache using mkfs.f2fs...

[B][U]F2FS-tools: mkfs.f2fs Ver: 1.7.0 (2016-07-28) [/U][/B][modified by Motorola to reserve space]

Info: Debug level = 0
Info: Label =
Info: Trim is disabled
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 786432 (384 MB)
Info: zone aligned segment0 blkaddr: 512
Info: format version with
"Linux version 3.1.10-MRlzma..."
[B][U]Info: Overprovision ratio = 10.000%
Info: Overprovision segments = 43 (GC reserved = 28)[/U][/B]
Info: format successful
I:mkfs.f2fs -t 0 /dev/block/mmcblk0p4 process ended with RC=0
Done.
I:Recreating /cache/recovery folder.
I:Copying file /etc/recovery.fstab to /cache/recovery/recovery.fstab
I:Version number saved to '/cache/recovery/.version'
Updating partition details...
[Android Software Development] gabrielgagz:
Hi I have exactly the same problem when i try to compile with lzma....dis you solve it?
[Android Software Development] morfikov:
I have some questions concerning the check list.

How to test "USB mass storage export" and "MTP export"?

What exactly should I do in the case of "backup/restore to/from adb" and "backup/restore to/from external (USB-OTG) storage"?

What about "UI colors (red/blue inversions)"?
[Android Software Development] _that:
USB Mass Storage is only supported if explicitly enabled in your kernel config and TWRP build - it can expose a storage device via USB (like a regular USB stick), usually a physical microSD card.

MTP should work out of the box, test if Windows shows it as mobile device and you can copy files from and to the device. I'm using simple-mtpfs under Linux, there are other implementations too.

ADB backup is explained in this commit comment: https://gerrit.omnirom.org/#/c/15943/

For backup to USB-OTG storage you need a USB-On-the-Go stick or a USB-OTG adapter (USB micro-B male to A female) and a regular USB stick. If supported by your hardware and kernel (and if your fstab is correct), it should show up in the UI as a target device for backups.

The TWRP UI should be blue. If it looks orange, your pixel format is wrong.
[Android Software Development] morfikov:
I can see the microSD as a regular block device (sdb on my linux), and I can mount the phone's filesystem via jmtpfs . I thought it needs something else (the "export" confused me). :D So these two work fine.

I think here will be problem because the device doesn't support USB-OTG.

It's blue.

So I have to make sure that this one also works.
[Android Software Development] MSe1969:
TWRP 3.0.3 for Osprey - finally successful !

Finally I've made it - a working TWRP 3.0.3 for the osprey device! :good:

Decryption now also works properly. Will still test it thoroughly, but looks very good so far.

The trick was to use the omni 5.1 tree (with some tweaks).

It seems, something does not work properly, when using the omni 6.0 tree. The same has also happened, when I tried to build within the lineageOS 13 build tree for my osprey device - it was not possible to decrypt the data partition! This seems to be related to Android 6, but I haven't really found out . . . :confused:

TWRP 3.0.3-0 for osprey build instructions in detail:

1. Create the build tree from here: https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/tree/twrp-5.1 (Github, minimal-manifest-twrp, omni repo, twrp-5.1 branch)

2. Change the default.xml manifest: Refer path 'hardware/libhardware' from the omni project repo 'android_hardware_libhardware' to the 'android-6.0' branch instead of 'android-5.1'

3. Create a local manifest with the following repositories:

<project name="TeamWin/android_device_motorola_msm8916-common" path="device/motorola/msm8916-common" remote="github" revision="android-6.0"/>
<project name="TeamWin/android_device_motorola_osprey" path="device/motorola/osprey" remote="github" revision="android-6.0"/>
<project name="TeamWin/android_device_qcom_common" path="device/qcom/common" remote="github" revision="android-6.0" />
<project name="sultanqasim/android_kernel_motorola_msm8916" path="kernel/motorola/msm8916" remote="github" revision="squid_marshmallow"/>

4. After synchronizing, edit the omni.dependencies file in device/motorola/osprey to point to the above TeamWin msm8916 device repo, in order to avoid a roomservice.xml file to be written

5. to build, enter

lunch omni_osprey-eng && mka recoveryimage

Cheers, M

P.S.: Download it from here: https://www.androidfilehost.com/?fid=673368273298936356
[Android Software Development] MSe1969:
Build TWRP along within LineageOS build tree

Dear experts,

I am interested to build TWRP "seamlessly" within the LineageOS tree. I was successful building it using an own tree, see my previous posts. However, when trying to properly integrate it into the LineageOS tree ("properly integrate" means for me, that I don't want to "tweak" the manifests, do --force-sync and build TWRP and then revert the tweaks to be able again to build Lineage), I am confronted with some weird issue:

I have - as advised in the compile guide - synch'ed the TWRP repo from omnirom into bootable/recovery-twrp, next to the default bootable/recovery from Lineage and work with a shell script for my build, where I simply put

export RECOVERY_VARIANT=twrp

before the "brunch osprey" statement. Whilst that part works as expected and indeed, the recovery is attempted to be built from the TWRP directories, I get a couple of errors like the below:

bootable/recovery-twrp/applypatch/applypatch.cpp:31:10: fatal error: 'android-base/strings.h' file not found
#include <android-base/strings.h>
^
bootable/recovery-twrp/applypatch/freecache.cpp:32:10: fatal error: 'android-base/parseint.h' file not found
#include <android-base/parseint.h>
^
bootable/recovery-twrp/otafault/config.cpp:23:10: fatal error: 'android-base/stringprintf.h' file not found
#include <android-base/stringprintf.h>

The errors might look "trivial" at first hand: Indeed, there is nowhere a subdirectory 'android-base' in my LineageOS build tree, so I simply thought to look into my TWRP build tree to see where this directory would be located there and then to decide on next options.

However, now comes the weird part: In my "minimal omnirom" tree for TWRP, an 'android-base' subdir is not there either, and there is also nowhere e.g. a file called stringprinf.h!

Nevertheless, the build works like a charm in my omnirom TWRP tree! :confused:

(And the code for TWRP is the same, so the files causing above errors have the same include statements)

What am I missing here?

Thanks, M
[Android Software Development] vampirefo:
I don't use recovery variant, I delete the recovery folder in LineageOS and replace with TWRP folder rename it to recovery.
[Android Software Development] MSe1969:
I've tried this, but same result as described :( - so having TWRP sources directly in bootable/recovery does not fix my issue.
[Android Software Development] _that:
This should be in system/core/base/include. At least it is there in AOSP 7.
[Android Software Development] MSe1969:
I know, I've tried building something in an omni 7.0 full-blown tree, and there it is under system/core/base/include. But not in my minimal-omni-android-5.1 tree. And as said before, building works there. I've even done 'make clean' and built again from scratch, and all went well! That's where it becomes weird...
[Android Software Development] _that:
I guess that in your Omni tree you only built a recoveryimage, but with LineageOS you tried to build the full ROM. The recoveryimage doesn't depend on applypatch (the updater does, but that's only used for creating flashable zips).
[Android Software Development] MSe1969:
Thanks a lot! That's exactly what happens.

To summarize, the following works to finish a build for TWRP along within the LineageOS tree:

1. An additional local manifest (e.g. twrp.xml)

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="omnirom"
review="gerrit.omnirom.org"
fetch="https://github.com/omnirom" />
<project path="bootable/recovery-twrp" name="android_bootable_recovery" remote="omnirom" revision="android-7.1" />
<project path="external/busybox" name="android_external_busybox" remote="omnirom" revision="android-6.0" />
</manifest>

2. TWRP entries in the device tree's BoardConfig.mk (here: device/motorola/osprey) plus a fitting twrp.fstab file:

#TWRP
TW_THEME := portrait_hdpi
PRODUCT_COPY_FILES += device/motorola/osprey/twrp.fstab:recovery/root/etc/twrp.fstab

3. Shell script for regular LineageOS build f. osprey

#!/bin/bash
export KERNEL_TOOLCHAIN=$PWD/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin
export KERNEL_TOOLCHAIN_PREFIX=arm-eabi-
export WITH_SU=true
source build/envsetup.sh
brunch osprey

4. Shell script to build TWRP

#!/bin/bash
export KERNEL_TOOLCHAIN=$PWD/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin
export KERNEL_TOOLCHAIN_PREFIX=arm-eabi-
source build/envsetup.sh
export RECOVERY_VARIANT=twrp
export TARGET_CRYPTFS_HW_PATH=vendor/qcom/opensource/cryptfs_hw
export TW_INCLUDE_CRYPTO=true
export TW_SCREEN_BLANK_ON_BOOT=true
lunch cm_osprey-userdebug
mka recoveryimage

The only item not yet solved, see my previous posts, is:

Whilst TWRP is built within omni 5.1 tree, all works fine. If however TWRP is

not

built with the 5.1 omni tree, decryption of the data partition is impossible (the correct password is not accepted) - any idea what could cause this issue?

Thanks again, M.
[Android Software Development] vampirefo:
Any chance of TWRP in future builds, being able to select and choose via hard keys ( volume up/down, power), instead of just touch only.
[Android Software Development] Captain_Throwback:
No. It's a TOUCH recovery. That's literally the point. You can however run TWRP commands via adb shell.
[Android Software Development] vampirefo:
Yes, as long as phone is connected to a PC. There are devices where touch doesn't work, so hard keys would be great.

Anyway thanks for the reply.
[Android Software Development] Captain_Throwback:
You can also use a USB keyboard & mouse if your device supports OTG.
[Android Software Development] vampirefo:
Yes, I use wireless mouse, but still would be better if could be done via hardware keys.
[Android Software Development] Captain_Throwback:
Aren't there other recoveries that allow you to navigate with hardware keys?
[Android Software Development] Captain_Throwback:
Also, isn't it possible to patch the kernel so that touch works? Is there no kernel source available for your device?
[Android Software Development] vampirefo:
Yes, I have built them as well, Carliv recovery, is both touch and non touch, so the one recovery can be used as touch or no touch.

TWRP is more modern and is always being updated, so would be nice if hardkey method was included.
[Android Software Development] Captain_Throwback:
TWRP wasn't built or designed to be used with hard keys. I'd recommend fixing touch on your device, as per my previous post.
[Android Software Development] vampirefo:
LOL, if I could fix touch, I would have already done so.
[Android Software Development] Captain_Throwback:
Well, do you have kernel source? If not, have you tried patching the kernel binary directly? How have you attempted to fix it?
[Android Software Development] kirito9:
Where exactly does one find where to patch? In the touch driver itself? What part of the driver? I know all devices are different so there's no guide per say but would be nice to know where to start.

---------- Post added at 04:54 AM ---------- Previous post was at 04:53 AM ----------

If you have the source, you can kindly ask jemmini@4pda to do so for you. He's done it before.
[Android Software Development] Captain_Throwback:
Usually in the kernel source there's some code in the input driver that disables touch while in recovery mode. This is usually linked to a "bootmode" function of some sort. I've found where this is for several of my devices, and that's how I fix touch in my kernel.

EDIT: For example - https://github.com/CaptainThrowback...mmit/3e364f07a7e939f0ad35e04b6d05f6419aaf5f64
[Android Software Development] vampirefo:
I don't have source, if I did I would have already fixed it.
[Android Software Development] Captain_Throwback:
It can be done without source as well if you patch the kernel binary. But you'd need to have an idea of how touch is being disabled by looking at a similar kernel.
[Android Software Development] kirito9:
Thanks, I'll be sure to check this out.
[Android Software Development] vampirefo:
If I could find a similar kernel, I would use it or it's source to build what I needed, so far none have been found.

I look through all 6737 32 bit kernel source I can find, none come close to my device so far.

My goal is to either find kernel source for similar device, or a kernel from another device that will boot on my device.
[Android Software Development] Captain_Throwback:
I'm sorry for trying to help. I'll let you go about your business.
[Android Software Development] vampirefo:
No problem, have a good evening.
[Android Software Development] muguthemangler:
Using the AIO-TWRP-Compiler by [MENTION=4478781]yuweng[/MENTION] I was able to compile TWRP for the ZTE Warp 7 (also known as ZTE N9519 or zte_beam).

With Kingroot, I have managed to get root on the device. Unfortunately, it is only a temporary root -- when the phone reboots, root is lost. This is my first time ever compiling TWRP and so I am a little nervous about deploying it to my device. My understanding is that if the recovery image is bad, my device could be bricked -- and without a permanent root solution, it's unclear to me whether I'd have any hope of de-bricking it.

What is the safest way for me to test my build of TWRP? Is there any way I can do a "dry run" without putting my device at risk?

(Also, my compiled recovery.img is 19.1 MB while the recovery.img extracted from my device is 48 MB. Is that expected?)

Thanks!
[Android Software Development] ashyx:
You haven't stated which device you are referring to? I must say I find your tone a little curt considering a knowledgeable member like the cap is trying to help you resolve the issue.

If you post up the device specs then maybe the cap, myself or someone else will be able to assist further?
[Android Software Development] morfikov:
Basically there are some mechanisms that can save you device. For instance, MTK devices can be debrick via SP Flash Tool, but only if you have a backup of the flash. So even if you flash a bad recovery image, you can recover the device. But SP Flash Tool woks only with MTK devices.

The next thing is when Android boots it checks the content/sums (I don't really know) of the recovery partition and if it differs, the recovery image is generated during boot and the system flash the image to the /recovery/ partition. This can be stopped by removing/renaming some script that resides on the /system/ partition. That's what SuperSU is doing when you install it via recovery. So even if you flash the recovery image successfully, after reboot, it backs to stock. So if you flash a wrong image, it should recover automatically.

Last thing that comes to my mind is not to flash the image directly. So instead of the "fastboot flash recovery recovery.img" command use "fastboot boot recovery.img" . In the second case, the image is loaded to smartphone's RAM and boot from there. So if something goes wrong, you'll see black/white screen and the device reboots. You can fix the image and test it again, till you get a working image. But the "fastboot boot recovery.img" command doesn't work in the case of all phones/Androids. I have two MTK running Android 5.1 and two Qcom running Android 6.0, and only in the two last devices the command works fine.
[Android Software Development] ric69:
Hello how can I help for french translation? there are still some mistake on v3.1.0 (sauvergarder instead of sauvegarder and some strings not translated)
[Android Software Development] Captain_Throwback:
Submit changes/updates to Gerrit.
[Android Software Development] ric69:
OK thanks, I hope I did well
[Android Software Development] Captain_Throwback:
It's broken. I think [MENTION=2638973]bigbiff[/MENTION] is working on fixing it currently...
[Android Software Development] morfikov:
Hmm. I knew that it's not my fault. :D
[Android Software Development] pvineeth97:
I compiled TWRP for LG K420. Touch isnt working.

Log: https://drive.google.com/file/d/0B9ZHDklJCY7DMF95UDJ2eTEtcGM/view?usp=drivesdk
[Android Software Development] followmsi:
How to enable FBE on non HTC device ? .. While not having the famous "qseecomd" available ? :)

Try to get it running on Pixel C device .. no luck until now.

Always the same recovery.log ...

I:File Based Encryption is present
keymaster1_open returned -1e4crypt_initialize_global_de returned fail
keymaster1_open returned -1e4crypt_initialize_global_de returned fail
keymaster1_open returned -1e4crypt_initialize_global_de returned fail

When I compile TWRP .. the following executables will not be created:

twrpfbe

e4policyget

When I add ... it works to get twrpfbe compiled into /sbin folder

TARGET_RECOVERY_DEVICE_MODULES := twrpfbe

If I add both .. what I think it's required for FBE .. it fails to compile ..

TARGET_RECOVERY_DEVICE_MODULES := twrpfbe e4policyget

To verify I have made an extra make command ... of course, the same error.

make -j showcommands e4policyget

The ouput ...

intermediates/e4policyget.d >> out/target/product/dragon/obj/RECOVERY_EXECUTABLES/e4policyget_intermediates/e4policyget.P; rm -f out/target/product/dragon/obj/RECOVERY_EXECUTABLES/e4policyget_intermediates/e4policyget.d )"
bootable/recovery/crypto/ext4crypt/e4policyget.cpp:34:16: error: use of undeclared identifier 'tar_policy'
char* ptr = tar_policy;
^
bootable/recovery/crypto/ext4crypt/e4policyget.cpp:35:33: error: use of undeclared identifier 'tar_policy'
memset(tar_policy, 0, sizeof(tar_policy));
^
bootable/recovery/crypto/ext4crypt/e4policyget.cpp:35:11: error: use of undeclared identifier 'tar_policy'
memset(tar_policy, 0, sizeof(tar_policy));
^
3 errors generated.

I guess, I need both executables to get FBE running ?

Thanks for some help ..

Cheers
[Android Software Development] _that:
How to debug touch issues

Compare the output of

grep . /sys/class/input/event*/device/name

in Android and in recovery.

If your touch input device is not listed in recovery, it is disabled by the kernel when you boot into recovery and you need to patch the kernel. If it is listed, try hexdump -C /dev/input/eventX (where X is the device number of your touch device) and touch the screen to see if you get any output.

Finally, you can build with TWRP_EVENT_LOGGING := true to get all input events received by TWRP into your recovery.log.
[Android Software Development] vampirefo:
Try fastboot boot recovery.img

I have one device, that only works in fastboot boot recovery.img, once the recovery is flashed, touch is disabled.