yashsingh1/xdaforums huggingface dataset:
[Android Software Development] v_superuser:
Correct me if I'm wrong, but ADB works in recovery, why you no check for a logcat? :confused:
[Android Software Development] AbduL_PT:
If by fine you mean out of the screen, then ok.

Sent from my mobile
[Android Software Development] NepoRood:
Thanks [MENTION=4878287]_that[/MENTION]

"Most" (of my China devices anyway) boot in 20-30 seconds, so yeah, lol, 2-3 minutes is "forever", I was just curious. I appreciate your input :good:

Regerts,

Nepo
[Android Software Development] vampirefo:
How large is your data partition? I haven't seen TWRP, take a long time to boot on any of my MTK devices, all are ext4 filesystem.
[Android Software Development] ashyx:
It needs encryption removing from the data partition.
[Android Software Development] NepoRood:
My current device isn't MTK, it's a Snapdragon (Qcom). So far, I've used 2.3Gb of space, apps and such. If/when I build a ROM that doesn't boot, TWRP only takes a few seconds to load (that's why I'm thinking it's the data partition).

This is a mystery to the dev that made TWRP for my phone in the first place, lol. I just thought I'd ask about...

Appreciate it,

Nepo
[Android Software Development] mcvisster:
Im a noob in modifing TWRP. How to do that, or what it takes for you to do this for us?

Thank you in advance.
[Android Software Development] ashyx:
1. Boot to twrp

2. Install: https://www.androidfilehost.com/?fid=24591000424951049

3. Using the FORMAT DATA button under WIPE options, format data.

4. Check DATA is mountable.

Note: Formatting Data wipes the internal storage.

5. Reboot
[Android Software Development] mcvisster:
I got a tick on mount data in twrp. So i assume that data is mountable.

---------- Post added at 10:35 AM ---------- Previous post was at 10:05 AM ----------

After i mounted data super su was gone. It erased ewerithing. So i guess it works after flashing your patch. Can i next time when i enter twrp swipe for modifications. Edit. I went to twrp and it dont ask`s me again swipe to modify . I guess that`s ok
[Android Software Development] morfikov:
I'm trying to built the TWRP image for TP-LINK Neffos C5 MAX. This smartphone has a Mediatek SoC (MT6753) and this SoC is 64-bit, so it's a little bit different that the previous qcom devices that I have.

Here's the initial device tree.

The image builds successfully, but when I flash the device, it doesn't boot in the recovery mode. It simply restarts and loops over and over. I don't really know where the problem is so that's why I'm asking you for help. Of course I can recover the device via SP Flash Tool, so it's not an issue.

I've seen some configs of similar devices, and there are a few differences that I tried to eliminate. First of all when I look at the recovery default.prop file, there's a ro.zygote= property which has a value of zygote32 . In the images of the similar devices, there's zygote64_32 . Should this be changed? What should I put into the BoardConfig.mk file in order to fix this?

Is there a way to get some logs from bootloops so I would know what's wrong?
[Android Software Development] MSe1969:
Hi Surge1223,

thanks a lot for your suggestions - I have looked at all of them and also learned again a couple of things about building. Nevertheless, none of the suggestion brought me further, but I have found now the root cause for my issue, which I will outline below:

'libbatteryservice' is built in frameworks/native/services/batteryservice.

I am using the minimal omni manifest from here: https://github.com/minimal-manifest-twrp

In the omni tree, the Android.mk files in frameworks/native and subdirs (e.g. frameworks/native/services) - it seems to be in all directories containing a further subdirectory - have the following code:

ifneq ($(BOARD_USES_QCOM_HARDWARE),true)
include $(call all-subdir-makefiles)
endif

Since I want to build TWRP for my osprey (Moto G 2015) device, the behavior is clear. :rolleyes:

That however means to me, that if the Omnirom folks have made an effort to entirely bypass frameworks/native for QCom devices, that there must be an omni qcom tree providing the respective alternative, which I found to be the "android-6.0-caf" branch of the android_frameworks_native omni repo (instead of "android-6.0" branch).

One step into the right direction . . . :)

Next, I had to enter

LOCAL_C_INCLUDES += \
frameworks/native/include

into the Android.mk files in frameworks/native/services/batteryservice, frameworks/native/libs/binder and system/core/healthd (even at more than one place, as the vars are cleared several times in the make files) and to remove the -Werror flag in those files as well.

Now it is busy building, will check later. However - having to modify those files as described above does not really seem the right way for me, because those issues should then also affect the 'regular' omni builds . . . ?

Any opinion? Thanks a lot

M
[Android Software Development] _that:
Omni's "android-6.0" seems to be the only branch that has this special feature. That explains why I didn't see it because I only looked in Omni 4.4, Omni 5.1, CM 13 and AOSP 7... :rolleyes:

I'd expect those headers to be included somehow by this line:

https://github.com/omnirom/android_build/blob/android-6.0/core/config.mk#L577
[Android Software Development] MSe1969:
A big thanks - that is the solution:

What I (wrongly did) in the manifest was

<project path="frameworks/native" name="android_frameworks_native" remote="omnirom" revision="android-6.0-caf" groups="pdk" />

what I should have done, and I did it now, was:

<project path="frameworks/native" name="android_frameworks_native" remote="omnirom" revision="android-6.0" groups="pdk" />
<project path="frameworks/native-caf" name="android_frameworks_native" remote="omnirom" revision="android-6.0-caf" groups="pdk" />

The logic simply is, that there is a separate "non-qcom" and a separate "qcom/caf" tree. Then the headers are pulled properly and you can also use the same build tree for qcom and non-qcom devices.

Okay, now the compilation works and I can get to the next step to test the result... :)

Thanks again, M
[Android Software Development] opticyclic:
Is this a typo?

You have two different lines for the external sd card here.

The first has 2 mount points in it but the second only has one.

The second looks right to me but there are lots of examples using the former

https://www.google.com/search?q=/dev/block/mmcblk1p1++++/dev/block/mmcblk1+site:github.com

Which is correct?
[Android Software Development] messi2050:
hi

i have an problem with my twrp port on the lg stylo 2 plus , when i use the hardware buttons to boot into twrp this factory resets the device everytime i use it, using adb commands and reboot to recovery apps boots twrp with no problem the problem only excist when i use the hardware buttons to boot into twrp , i'm using prebuilt pure stock kernel to compile , any tip or solution on how can i solve this will be appreciated.
[Android Software Development] NepoRood:
First one...
[Android Software Development] :
I'm currently learning kernel building and would like to update my TWRP (still stuck in the old 2.x version). So basically my stock firmware is 5.1.1, that means I'll compile based on the android-5.1 branch right?
[Android Software Development] Deltadroid:
You need to find a different partition to use for /misc. On my device, /misc is pointing to /bnr to solve this issue.

Example:

https://github.com/syphyr/android_d...mmit/b49e01d1442cd6408ad2aee0a1c28bc13089126b

https://github.com/syphyr/android_device_lge_v500/commit/efdecd4cc4a156be5d7b11fe000033e395e7b343
[Android Software Development] _that:
Alternative: https://gerrit.omnirom.org/#/c/20849/
[Android Software Development] Captain_Throwback:
Yes, that's typically the best way. You just need the current TWRP branch (android-7.1) for your android_bootable_recovery.
[Android Software Development] :
Wait so even on a 5.1.1 firmware I'll compile from the android-7.1 and not android-5.1? Got it, thanks.
[Android Software Development] opticyclic:
Can you explain why the external sd card has 2 mount points in the definition but the others only have one?
[Android Software Development] Captain_Throwback:
Backup mount point to the block device. That's only an option on the SD card because it's the only partition on that block device. So if the initial mount fails, the full device mount may work. For the other partitions, the full block device contains all of the device partitions, so there can be no backup mount option.
[Android Software Development] messi2050:
many thanks it works now using the last twrp 7.1 branch and setting ignore_misc flag :D you rock guys.
[Android Software Development] opticyclic:
I'm now using the following in the twrp.fstab

/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="External SDCard";storage;removable

I have extracted the fstab from the resulting recovery.img and I see that it is included.

However, when I boot the image the external sd card is marked as "Micro SDCard" and not "External SDCard".

It also appears in the Advanced wipe section.

This seems to say to me that the twrp.fstab is being ignored.

However, if I remove that line completely it doesn't appear at all, implying that the twrp.fstab isn't being ignored.

Whats going on?

---------- Post added at 10:16 PM ---------- Previous post was at 10:02 PM ----------

I was surprised to find out that after specifying -b twrp-5.1 that repo brought in a different version of android_bootable_recovery.

When I look at the manifest it is a different version to everything else in the manifest.

https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni/blob/twrp-5.1/default.xml#L35

If android_bootable_recovery is not tied to the version of omnirom then what is the purpose of the different branches?
[Android Software Development] Captain_Throwback:
The default TWRP branch is updated when a new version of Android is released. TWRP is then updated to the latest branch (with legacy support for older build trees added) and the old branches are deprecated. So the newest branch is always the current one that should be used.
[Android Software Development] opticyclic:
Just to clarify what you are saying with an example:

The phone has a 5.1 ROM on it from the manufacturer

I am just compiling TWRP and not a full ROM

I am using the minimal manifest to save bandwidth.

Do I use the latest branch of the minimal manifest and not the 5.1 branch?

The 5.1 branch will have omnirom 5.1 sources and (as of right now) 7.1 android_bootable_recovery.

The 7.1 branch will have omnirom 7.1 sources and 7.1 android_bootable_recovery.

If I use the 7.1 branch (with 7.1 omnirom source) is that going to cause problems with my kernel that was extracted from a 5.1 ROM?
[Android Software Development] Captain_Throwback:
Use the 5.1 branch with 7.1 bootable/recovery. Because yes, you will likely have issues trying to use a kernel made for 5.1 with the 7.1 tree. Again, the 7.1 bootable/recovery is backwards compatible, so building TWRP this way is fine.
[Android Software Development] morfikov:
I've managed to build and boot the image successfully. Based on the info from the previous posts, I used different branch -- 5.1 instead of 6.0 so it could match the Android version installed on the smartphone. Still the TWRP is set to 7.1 .

The only thing I had to change in the BoardConfig.mk was the following:

#TARGET_2ND_CPU_VARIANT := cortex-a53
TARGET_2ND_CPU_VARIANT := generic

And the question is why the image builds when I set cortex-a53 on 6.0 and on 5.1 it fails? When I wanted to use the first line, I got this error:

target SharedLib: libc (/media/Kabi/Android/omni-twrp-5.1/out/target/product/tp702a/obj/SHARED_LIBRARIES/libc_intermediates/LINKED/libc.so)
target SharedLib: libc_32 (/media/Kabi/Android/omni-twrp-5.1/out/target/product/tp702a/obj_arm/SHARED_LIBRARIES/libc_intermediates/LINKED/libc.so)
target StaticLib: libc_nomalloc (/media/Kabi/Android/omni-twrp-5.1/out/target/product/tp702a/obj/STATIC_LIBRARIES/libc_nomalloc_intermediates/libc_nomalloc.a)
/media/Kabi/Android/omni-twrp-5.1/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: /media/Kabi/Android/omni-twrp-5.1/out/target/product/tp702a/obj_arm/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(bcopy.o): multiple definition of 'bcopy'
/media/Kabi/Android/omni-twrp-5.1/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: /media/Kabi/Android/omni-twrp-5.1/out/target/product/tp702a/obj_arm/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(memmove.o): previous definition here
collect2: error: ld returned 1 exit status
build/core/shared_library_internal.mk:68: recipe for target '/media/Kabi/Android/omni-twrp-5.1/out/target/product/tp702a/obj_arm/SHARED_LIBRARIES/libc_intermediates/LINKED/libc.so' failed
make: *** [/media/Kabi/Android/omni-twrp-5.1/out/target/product/tp702a/obj_arm/SHARED_LIBRARIES/libc_intermediates/LINKED/libc.so] Error 1
make: *** Waiting for unfinished jobs....

So should I use generic instead of cortex-a53 all the time, or just in the case of 5.1 Android version?
[Android Software Development] Fobos531:
Hello, I'm trying to port TWRP to my device (LG Spirit). There hasn't been a single custom ROM for this device. TWRP has been built, but doesn't display properly (?) when booted into (screen backlight reacts on power button press, but I can't see anything on the screen) so I decided to port it to my device.

This is what I've done so far.

1) downloaded this since Moto G3 and my device are based on the exact same chipset

2) replaced absolutely every "osprey" entry with "c70n" (my device's codename) and "motorola/Motorola" with "lge/LGE"

3) made a twrp.fstab with these contents:

PRODUCT_COPY_FILES += device/lge/c70n/twrp.fstab:recovery/root/etc/twrp.fstab

4) tweaked the partition sizes in boardconfig.mk accordingly so they match my device

What do I have to do next? I'm pretty confused.
[Android Software Development] MSe1969:
TWRP 3.0.3 Osprey mount issue

Hello experts,

see my referred post above - I was able to compile a TWRP 3.0.3 recovery for my osprey device, but this recovery is not able to mount anything other than the external SD card!

I use the omni manifest from here https://github.com/minimal-manifest-twrp

and the below device specific repos:

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

(Note: Using the device repo's from TeamWin git provided the same results)

When I looked deeper into it, I have made the following observation:

The /etc/recovery.fstab has entries pointing to /dev/block/platform/soc.0/by-name/. . . for example

/system ext4 /dev/block/platform/soc.0/by-name/system

With TWRP 3.0.2 (and also looking at /dev from the booted LineageOS 13), this exactly corresponds to the structure.

However, when booting my generated TWRP 3.0.3, I need in fact a structure /dev/block/platform/soc.0/7824900.sdhci/by-name/. . .

After modifying the fstab accordingly and rebuilding, it was possible to mount /system and /cache, but still not data (because my phone is encrypted) and it does not even attempt to decrypt.

My questions:

What is "7824900.sdhci" (as this is only even visible, when I boot my generated TWRP - not when having my LineageOS 13 or TWRP 3.0.2 up)?

How can I have TWRP simply detecting /data and asking for the decryption password?

Thanks a lot, M
[Android Software Development] MSe1969:
Hi,

not sure whether I have understood properly the quoted section above, but just to clarify, please see my comments below. I have an issue with my attempts to build TWRP as well, see my post. Nevertheless, this is my understanding so far:

By default, an /etc/recovery.fstab file is built for the recovery ramdisk. This file contains the list of mount points (docu about fstab see e.g. 'man fstab' or 'man mount' from your linux PC). As part of the TWRP build, you need to define that device specific fstab, so TWRP will be able to mount the respective partitions of your device.

In order to do so, a recovery.fstab file with those needed entries is normally located your device tree.

With the code (in below example for my own MotoG3 device) in the BoardConfig.mk (or BoardCommonConfig.mk)

TARGET_RECOVERY_FSTAB := device/motorola/msm8916-common/twrp.fstab

this file is then pushed into the target directory as out/target/product/<your device>/recovery/root/etc/recovery.fstab

If you would like to maintain - for better compatibility - also the option to build other recoveries within your tree, you can - in ADDITION to the approach above - also specify a dedicated twrp.fstab file in parallel to your default fstab file (e.g. device/motorola/msm8916-common/rootdir/etc/fstab.qcom), with different settings than for your default recovery and copy that file IN ADDITION to out/target/product/<your device>/recovery/root/etc/twrp.fstab by specifying in your Board(Common)Config.mk the command

PRODUCT_COPY_FILES += device/lge/c70n/twrp.fstab:recovery/root/etc/twrp.fstab

In other words, that command must not be the content of the file twrp.fstab, but part of your Board(Common)Config.mk file.

Hope that clarifies and brings you one step further.

Regards, M
[Android Software Development] opticyclic:
If you extract the existing recovery.img from your device you can get the existing fstab file and also a kernel that you can use.

adb shell
su
cd /dev/block
ls -lR|grep by-name
ls -l <the-output-of-above/by-name>|grep recovery

Copy the partition to an img file on your sdcard:

dd if=<block-path-from-last-command> of=/sdcard/recovery.img
adb pull /sdcard/recovery.img
adb shell rm /sdcard/recovery.img

Then use Carlivs image kitchen to extract out the kernel and the fstab.

You can then use the kernel as a prebuilt and update the fstab with one that works on your device already.

The key files in the output folder are dt.img, img_info, kernel. You can move the dt.img and kernel (overwrite the other generated one) to your project but we need to extract info from the img_info file to put in the BoardConfig.mk.

The line starting cmd_line= replaces BOARD_KERNEL_CMDLINE in the BoardConfig.mk. e.g.

cmd_line='console=null androidboot.console=ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 earlyprintk'
#becomes
BOARD_KERNEL_CMDLINE := console=null androidboot.console=ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 earlyprintk

Take the value from the ramdisk_offset and the tags_offset and put them in a new line in the BoardConfig.mk. e.g.

ramdisk_offset=0x02000000
tags_offset=0x00000100
#becomes
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x02000000 --tags_offset 0x00000100 --dt device/nubia/NX529J/dt.img
[Android Software Development] _that:
Not a bug, that's some hardcoded magic in partitionmanager.cpp to enable translation of some common partition names.
[Android Software Development] opticyclic:
I was looking at that class and I can't see how the behaviour described on the first post is supposed to work.

The display flag is parsed at certain points because I can log it, however, the end result is that it is ignored, as well as other flags, such as wipeingui.

I'd rather not accidentally wipe my external sdcard!

Are you saying that it is a feature that the display flag and wipeingui flag are ignored external_sd card?

I don't understand the logic in that.
[Android Software Development] _that:
The translatable partition names came long after the ability to specify the partition name in the fstab, and yes, they simply override whatever is in the fstab. There are also lots of hardcoded rules in partition.cpp, for example that the "standard" partitions (including /external_sd) can be wiped. I didn't write them and generally it's a mess, but it is not a bug.

If you don't trust yourself to not accidentally go to "Wipe", "Advanced Wipe", check "external_sd" *and* swipe the slider, then you should probably not be using TWRP at all. :)
[Android Software Development] shoey63:
Have any of you guys worked out how to access internal storage /sdcard on Nougat in TWRP with encrypted /data?

And I mean without entering a password.

I have Sony Xperia X (suzu), and use Omnirom 6.0 sources with 7.1 /bootable/recovery.
[Android Software Development] Captain_Throwback:
You have to add decryption support to your TWRP.

TW_INCLUDE_CRYPTO := true

And add whatever files your recovery needs to decrypt to the ramdisk via recovery/root in your device files. There's also a patch that uses system vold for decrypt you might want to try: https://gerrit.omnirom.org/21050

[MENTION=2605798]nkk71[/MENTION] and I just got it working on an HTC MTK device for the first time.
[Android Software Development] DiscMan55:
Hello,

I managed to build twrp with crypto support for android device ivy (Sony Xperia Z3+), but I face a problem getting TARGET_HW_DISK_ENCRYPTION to work because of different path expected by twrp for libcryptfs_hw.so on LineageOS 14.1 sources.

I would appreciate any ideas on my thread here: https://xdaforums.com/showpost.php?p=71227841&postcount=13

Thanks in advance.
[Android Software Development] Captain_Throwback:
Replied in your thread.
[Android Software Development] :
I found a TWRP file someone made for my device (he disappeared), but I'm still not sure how do I update TWRP for it. Is there a github commit that I can retrace the steps from?

Edit: Link to the old source here
[Android Software Development] morfikov:
I'm still configuring the images for my devices, but one of the smartphones has weird issues. Basically the image was built successfully, and I was testing it via the "fastboot boot recovery.img" command. It looked like that everything was working just fine, so I flashed the image via "fastboot flash recovery recovery.img".

When I boot the device into the recovery mode, it boots without problems. The only thing is that none of the preconfigured settings work. For instance brightness isn't set to the right value. I've checked the recovery logs, but according to the them, everything is as it should be and all of the settings are properly set. When I check the settings under Settings > Screen there are also the right values, but when I change the values, nothing happens. there's no errors in the recovery log.

Another problem is when the screen goes off (automatically or by pressing the power button). When it turns off, there's no way to turn it on. The phone works fine, and I can swipe to unlock if I just manage to press the button and also I can press any other button and the phone vibrate when I do so., but the screen is off all the time.

Does anyone know what would cause the aforementioned problems? Why are they two different results when booted via "fastboot boot" and "fastboot flash"? I thought it's the same, but in the case of the first command, everything takes place in RAM. So why does one work and the other not?
[Android Software Development] Captain_Throwback:
Sounds like you need to set the proper brightness file path in your BoardConfig.
[Android Software Development] morfikov:
But it's the right one. There's no problem when i boot the image via "fastboot boot" and everything works just fine. The problem is when I flash the image and boot into recovery. For some reason something is wrong, but there's no errors in the log.
[Android Software Development] NepoRood:
Only way to find out is dive in and see, that dev used Omni source, so give it a try :good: