yashsingh1/xdaforums huggingface dataset:
[Android Software Development] juliusssss:
Hi,

I want to compile TWRP for a Xiaomi Redmi 1s, it has snapdragon 400 msm8226 like Moto G.

I have compiled without errors with Linuxmint 16, java 6 and Omni 4.4 sources, but it doesn't work.

I don't know what i do wrong.

Boardconfig.mk

DEVICE_RESOLUTION := 720x1280
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
BOARD_USE_CUSTOM_RECOVERY_FONT := \"roboto_15x24.h\"
BOARD_BOOTIMAGE_PARTITION_SIZE := 16777216
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 16777216
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 824180736
BOARD_USERDATAIMAGE_PARTITION_SIZE := 6120328396
BOARD_FLASH_BLOCK_SIZE := 131072

recovery.fstab

/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered wait,check
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc wait,check
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 nosuid,nodev,barrier=1,data=ordered,nodelalloc wait
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware vfat ro,uid=1000,gid=1000,dmask=227,fmask=337 wait
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/mmcblk1p1 /external_sd vfat nodev,barrier=1,data=ordered,nodelalloc wait
/dev/null /sdcard datamedia defaults defaults

And the compile log.

Can anybody help me?

Thanks. Greetings.

Sorry for my english.
[Android Software Development] MasterAwesome:
You have to build a kernel with selinux support..
[Android Software Development] juliusssss:
Hi MasterAwsome,

Thanks for your answer.

I don't have the kernel sources from my device, they haven't been released.

Edit: I extracted kernel from boot.img. Android version of my device is 4.3 and i believe that it support selinux.

Greetings.
[Android Software Development] bigsupersquid:
the SoC may be the same but most likely the board files and device drivers will differ.
[Android Software Development] juliusssss:
I extracted kernel from boot.img. Android version of my device is 4.3 and i believe that it support selinux.

With that kernel TWRP must work, but it doesn't work.

Greetings.
[Android Software Development] bigsupersquid:
in terminal, or in adb shell, on the device

zcat /proc/config.gz | grep "SELINUX"

to see if it's enabled.

if the zcat command fails (and it might, on stock rom) then you'll have to pull the /proc/config.gz, unpack it, and search through it manually for SELINUX
[Android Software Development] juliusssss:
In terminal when i type the commands:

/system/bin/sh: zcat: not found
[Android Software Development] Temanyan:
Same problem as early, flags hw is on, may see same three on git, 22 22 ect, log in attachment
[Android Software Development] nkk71:
The log is clear that it's failing in this function

Add some debugging to it, and/or strace a slightly modified twrpdec
[Android Software Development] Temanyan:
Have anywhere some kind of manual how to debug it or trace. In attachment kernel log, in system vold function after failed fist decrypt, have something like this

"3>[469, vold][ 12.393347] QSEECOM: __qseecom_process_incomplete_cmd: fail:resp res= -65,app_id = 0,lstr = 12288

<6>[469, vold][ 12.393357] get_ice_device_from_storage_type: found ice device ffffffc0ac68b400

<6>[469, vold][ 12.510084] get_ice_device_from_storage_type: found ice device ffffffc0ac68b400

<3>[469, vold][ 12.512608] QSEECOM: qseecom_create_key: Set the key successfully

<11>[469, vold][ 12.512662] Cryptfs: Ascii password was updated

<11>[469, vold][ 12.516651] Cryptfs: target_type = req-crypt

<11>[469, vold][ 12.516665] Cryptfs: real_blk_name = /dev/block/bootdevice/by-name/userdata, extra_params = fde_enabled ice

<6>[469, vold][ 12.516770] device-mapper: req-crypt: req_crypt_ctr: Mapping block_device /dev/block/bootdevice/by-name/userdata to dm-req-crypt ok!"

What is ice? Maybe "TARGET_USE_UFS_ICE" will help?
[Android Software Development] nkk71:
That's a vold_decrypt strace, not a twrpdec strace, but anyway, your dmesg shows:

<3>[451, recovery][ 5.821380] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 5.821386] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 6.321482] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 6.321487] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 6.821575] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 6.821580] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 7.321690] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 7.321697] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 7.821796] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 7.821801] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 8.321893] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 8.321899] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 8.821989] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 8.821995] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 9.322084] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 9.322089] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 9.822182] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 9.822198] device-mapper: ioctl: error adding target to table
<3>[451, recovery][ 10.322292] device-mapper: table: 253:0: crypt: IV mechanism required
<4>[451, recovery][ 10.322298] device-mapper: ioctl: error adding target to table

which is where your problem is most likely
[Android Software Development] Temanyan:
Any idea how to solve this problem?

It's help for debugging I think?!

# TWRP Debug Flags

#TWRP_EVENT_LOGGING := true

#TARGET_USES_LOGD := true

#TWRP_INCLUDE_LOGCAT := true

#TARGET_RECOVERY_DEVICE_MODULES += strace debuggerd

#TW_RECOVERY_ADDITIONAL_RELINK_FILES += $(TARGET_OUT_OPTIONAL_EXECUTABLES)/strace $(TARGET_OUT_EXECUTABLES)/debuggerd64

#TARGET_RECOVERY_DEVICE_MODULES += twrpdec

#TW_RECOVERY_ADDITIONAL_RELINK_FILES += $(TARGET_RECOVERY_ROOT_OUT)/sbin/twrpdec

#TW_CRYPTO_SYSTEM_VOLD_DEBUG := true

This is my first twrp for device and I think that was a good idea stay system vold function, because it works, and disable hw and other decryption functions. Or need some help to get it works. Maybe links to manuals how to find out what is wrong:):confused:
[Android Software Development] PaWill:
Can't get to work the backup System. Creates a file system.ext4.win of size 1024 bytes. What could be the problem? How to provide logs? Sorry for my English.
[Android Software Development] jahidinbedod:
hi dude,

how to edit file "recovery" in sbin folder

I want to change some lines of text in the file

what tools should i use ?

please help me ?
[Android Software Development] Temanyan:
I think it helps

BOARD_HAS_LARGE_FILESYSTEM := true

TARGET_USERIMAGES_USE_EXT4 := true

TARGET_USERIMAGES_USE_F2FS := true

Logs can get in twrp-advanced-copy log-swipe .ect

And link device three in here

---------- Post added at 06:32 AM ---------- Previous post was at 06:30 AM ----------

Unpack recovery image any unpackers, edit file, pack it back.)
[Android Software Development] DiamondJohn:
https://github.com/GameTheory-/mktool
[Android Software Development] PaWill:
These flags are already available. :(

the mistake was ext3, not ext4. Thank you.
[Android Software Development] _that:
That's the main TWRP binary - you don't edit it, you compile it from source as described in this thread.
[Android Software Development] Micha_Btz:
Hi there,

I build twrp for amami device. But I have a strange problem while building. My build tree are:

https://github.com/cm12-amami/android_device_sony_rhine-common/tree/cm-12.1-twrp

https://github.com/cm12-amami/android_device_sony_amami/tree/cm-12.1-twrp

If i start the build it stops with:

make[1]: Leaving directory '/home/mdomann/handy/build/cm-12.1/kernel/sony/msm8974'
Kernel Modules not enabled
mdpath=`find /home/mdomann/handy/build/cm-12.1/out/target/product/amami/system/lib/modules -type f -name modules.order`; if [ "$mdpath" != "" ];then mpath=`dirname $mdpath`; ko=`find $mpath/kernel -type f -name *.ko`; for i in $ko; do arm-eabi-strip --strip-unneeded $i; mv $i /home/mdomann/handy/build/cm-12.1/out/target/product/amami/system/lib/modules/; done; fi
mdpath=`find /home/mdomann/handy/build/cm-12.1/out/target/product/amami/system/lib/modules -type f -name modules.order`; if [ "$mdpath" != "" ];then mpath=`dirname $mdpath`; rm -rf $mpath; fi
make: Circular /home/mdomann/handy/build/cm-12.1/out/target/product/amami/ramdisk-recovery.cpio <- /home/mdomann/handy/build/cm-12.1/out/target/product/amami/ramdisk-recovery.img dependency dropped.
----- Making uncompressed recovery ramdisk ------
/home/mdomann/handy/build/cm-12.1/out/host/linux-x86/bin/mkbootfs /home/mdomann/handy/build/cm-12.1/out/target/product/amami/recovery/root > /home/mdomann/handy/build/cm-12.1/out/target/product/amami/ramdisk-recovery.cpio
error: cannot open directory '/home/mdomann/handy/build/cm-12.1/out/target/product/amami/recovery/root'
build/core/Makefile:972: recipe for target '/home/mdomann/handy/build/cm-12.1/out/target/product/amami/ramdisk-recovery.cpio' failed
make: *** [/home/mdomann/handy/build/cm-12.1/out/target/product/amami/ramdisk-recovery.cpio] Error 1
make: *** Deleting file '/home/mdomann/handy/build/cm-12.1/out/target/product/amami/ramdisk-recovery.cpio'

#### make failed to build some targets (54 seconds) ####

The directory /home/mdomann/handy/build/cm-12.1/out/target/product/amami/recovery/root did not exist.

If I create them the build runs through fine. Can I let create this directory while build. I also understand not really where I have set this directory for output can someone make it clear?

Thanks Micha
[Android Software Development] DEVILOPS 007:
Hi, I want to give this a go but could someone tell me how to add f2fs to the twrp build for the Nexus 6p? Thanks. I've got the build working but the main reason I am making the build is to add f2fs.:good:
[Android Software Development] Mysteryagr:
Kindly add official support for Motorola Moto C 4G - codenamed: namath - XT1754

Device tree: https://github.com/Mysteryagr/android_device_motorola_namath/tree/twrp

Kernel source: https://github.com/Mysteryagr/Moto-C-namath-kernel/tree/LOS-14.1

XDA thread: https://xdaforums.com/android/development/recovery-twrp-3-1-1-0-themed-moto-c-t3713279

Built inside Lineage using full sources.

Thanks in advance.
[Android Software Development] Aex12:
Can you please add official support for Xiaomi Mi 5X (tiffany)?

I succesfully compiled it and get it working with this device tree: https://github.com/Aex12/android_device_xiaomi_tiffany

XDA Thread: https://xdaforums.com/mi-5x/development/recovery-twrp-3-1-1-0-t3715084/

Thanks in advance!
[Android Software Development] poppy22:
I use LineageOS 15.0 source code to compile twrp3.2 is a prompt error

build/core/base_rules.mk:375: warning: overriding commands for target `/home/ubuntu/linos/out/target/product/ocm/system/xbin/wget'
./external/busybox/Android.mk:153: warning: ignoring old commands for target `/home/ubuntu/linos/out/target/product/ocm/system/xbin/wget'
[ 66% 2/3] glob external/*/Android.bp
ninja: error: '/home/ubuntu/linos/out/target/product/ocm/obj/STATIC_LIBRARIES/libbootloader_message_intermediates/export_includes', needed by '/home/ubuntu/linos/out/target/product/ocm/obj/EXECUTABLES/init_intermediates/import_includes', missing and no known rule to make it
11:20:43 ninja failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1
make: Leaving directory '/home/ubuntu/linos'

#### make failed to build some targets (37 seconds) ####
[Android Software Development] Travisholt92:
i've been working at it all day modifying my fstab but i'm stuck at "Kernel panic - not syncing:VFS: Unable to mount root fs on unknown-block(0,0)" after flashing the built TWRP. It builds without errors but only with 1588 jobs, that seems kinda low to me but this is my first build of TWRP so im not 100% positive.

can anybody give me some insight on where to look first?
[Android Software Development] NepoRood:
A) There was absolutely No Need to quote the entire OP (Original Post) for your query...

B) Don't use Lineage 15, try an older branch, I personally still use CM 12.1, or Omni

Nothing to go on here, really. Provide a Github link to your build trees...
[Android Software Development] matshias:
How to build TWRP 3.2.0-0 instead of 3.1.1-0

When I build using the manifest from https://github.com/minimal-manifest-.../tree/twrp-7.1 I am still getting 3.1.1-0. Will this manifest be updated or should I use a different one?

I am the maintainer for Lenovo Yoga Tablet 3 Plus and people asked me about 3.2.0 and why it is not built for our device.
[Android Software Development] Travisholt92:
It appears the 7.1 tree was merged with the 8.0 one , the 3.2.0-0 can be found there
[Android Software Development] Magendanz:
Migrating from twrp-5.1 branch

Per the OP instructions, i've been using this minimal OMNI manifest to build TWRP for Amlogic and Rockchip devices. However, while I've been able to get these projects to build on both twrp-5.1 and twrp-7.1 branches, only the ones built on twrp-5.1 would make it past the boot logo.

It's not clear to me why these projects would build, but not boot, on the newer branches. And now that TWRP 3.2 is out, I'm hoping to get it working on the new twrp-8.0 branch.

Are any tutorials on how to migrate from twrp-5.1 to newer branches?

Could my problem be due to using a prebuilt kernel? Or how about the warnings I receive about "ignoring old commands for target"? Are there commands in my makefiles that I can no longer use?
[Android Software Development] ashyx:
You can't just throw any old kernel in there and expect it to work with any branch.

Use the appropriate branch for the kernel.
[Android Software Development] Magendanz:
Sorry, I should have mentioned that I'm using a prebuilt kernel from a Nougat OEM ROM. Ironically, this kernel works when building twrp-5.1, but not twrp-7.1.
[Android Software Development] ashyx:
The branches you are talking about is Omni source code not TWRP specific code.

TWRP can be built in either branch including Marshmallow regardless of TWRP version.

I compile all Nougat builds of TWRP in the Marshmallow branch and will continue to do so until something breaks.

Mainly because I can't be bothered downloading a shed load of updated source code for no reason.

The Marshmallow branch is still maintained so there's no issue as far as I'm concerned.
[Android Software Development] boar-hooligan:
Hello friends help rebuild recovery

for the tablet Oysters T72HM 3G

https://xdaforums.com/attachment.php?attachmentid=4355852&stc=1&d=1512793961this is an old recovery under TWRP 3.0.2

https://xdaforums.com/attachment.php?attachmentid=4355851&stc=1&d=1512793961 This new stock recovery

Could you make a new TWRP recovery?

Thanks in advance=)
[Android Software Development] kaiz16:
Hi sorry if this a dumb question.

But do i need Kernel sources to build TWRP ?

Or is device tree enough? And what about the vendor? Thank you.
[Android Software Development] DodoGTA:
Kernel sources aren't required to build and boot TWRP (but they can come in handy or they're required when trying to fix certain bugs)

TWRP is a relatively minimal environment when compared to Android, so it doesn't need a lot of vendor blobs (they're mostly needed for hardware-based encryption and some other things)
[Android Software Development] Magendanz:
Unfortunately, it doesn't look like the Lollipop branch is still being maintained. For example, it doesn't seem to have gotten any of the TWRP 3.2 changes. And I've never been able to even successfully build on Marshmallow, since it generates the following error:

build/core/base_rules.mk:157: *** frameworks/native/cmds/dumpstate: MODULE.TARGET.STATIC_LIBRARIES.libdumpstate.default already defined by frameworks/native-caf/cmds/dumpstate.

Strangely enough, building on Nougat doesn't seem to have this problem, but it won't boot.
[Android Software Development] TimSchumi:
Concerning the build error on Marshmallow, you just need to remove (depending on your device) one of the offending projects from your manifest. So either frameworks/native or frameworks/native-caf
[Android Software Development] Magendanz:
It's not clear to me why the conflicting frameworks/native-caf project is included in twrp-6.0 manifest while not on twrp-5.1 or twrp-7.1, but removing it did the trick. The Marshmallow build was successful and seemed to run identically to the Lollipop build. Thanks, [MENTION=7331587]TimSchumi[/MENTION]!

Now to just figure out why builds on the twrp-7.1 branch won't boot...
[Android Software Development] pix106:
You can build TWRP 3.2 using omnirom 5.1 sources, and just use bootable/recovery from omnirom 8.0.

Use the local manifest to remove the bootable/recovery project and add the new one from 8.0 branch (or 7.1 if you want TWRP 3.1...)
[Android Software Development] Magendanz:
That worked beautifully, and I built it right on the old twrp-5.1 branch. Here was my local_manifest.xml:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="omnirom"
review="gerrit.omnirom.org"
fetch="https://github.com/omnirom" />

<remove-project name="android_bootable_recovery" />
<project path="bootable/recovery" name="android_bootable_recovery" remote="omnirom" revision="android-8.0" groups="pdk-cw-fs"/>
</manifest>

Simple, right? Thanks, [MENTION=3064479]pix106[/MENTION]!!
[Android Software Development] Ibuprophen:
I've got a question for the TWRP Experts here...

How could I correct the following issue

-- AND/OR --

Where can I correct the following issue...

While in the TWRP Recovery (whether by way of rebooting to it from the ROM or using the devices key combinations to enter it) and, when I select "Power Off" in TWRP (the device powers off normally), then...

... Here's the Issue...

Once I power up the device (using the devices power button only) it always boots up back into recovery.

How can I correct this?

If i Power Off via TWRP (and I'm only referring to TWRP) and then turn on the device, using the power button only, the device should just boot up normally.

Am I going nuts??? :eek:

I hope i had explained this okay via text... :)

~~~~~~~~~~~~~~~

I DO NOT PROVIDE SUPPORT VIA PM UNLESS ASKED/REQUESTED BY MYSELF.

PLEASE KEEP IT IN THE THREADS WHERE EVERYONE CAN SHARE
[Android Software Development] Magendanz:
It sounds like you attempted a factory reset from Settings->Backup & Reset->Factory Data Reset and your version of TWRP is not reading and clearing the bootloader control block (BCB). This will cause you to be stuck in that kind of TWRP bootloop until the BCB is cleared.

To clear the BCB manually, issue this command in TWRP terminal (where bootdevice is platform path) to wipe the misc partition:

dd if=/dev/zero of=/dev/block/bootdevice/by-name/misc bs=1M

I tried to fix a similar problem with a custom BCB offset on Rockchip devices. The BOARD_RECOVERY_BLDRMSG_OFFSET makefile variable is used to set BCB offset for command-line arguments in the /misc partition. However, the code to convert it to the precompiler directive was removed. I submitted a change to restore it in an appropriate context, but I don't believe it was ever checked in.
[Android Software Development] Ibuprophen:
Thank you very much for your response!

Actually the device is running great...

This was a bug/issue that began with the TWRP v3.2.0-0 and still there with the recent v3.2.1-0 released for the klte.

~~~~~~~~~~~~~~~

I DO NOT PROVIDE SUPPORT VIA PM UNLESS ASKED/REQUESTED BY MYSELF.

PLEASE KEEP IT IN THE THREADS WHERE EVERYONE CAN SHARE
[Android Software Development] mightysween:
I can confirm seeing this behavior in both 3.2.0 and 3.2.1 on builds I have compiled for Motorola X4. But it isn't happening on *every* build (I am doing a lot of changes for testing), and unfortunately I don't know what causes it.

Funny thing is, after seeing my device ONLY boot in to recovery so many times, my struggle now is getting the device to boot directly to recovery with "fastboot boot <recovery.img>" instead of booting to the system... :)

So, incidentally, how the heck do I do this (boot a recovery image TO recovery from fastboot) on a device with no recovery partition? It is driving me nuts and I know I am probably overthinking it.
[Android Software Development] bigsupersquid:
Often the boot and recovery partitions are the same size, and I've definitely been able to flash recovery to the boot partition on my devices, lg and htc both using fastboot.

Not exactly what you're mentioning, but it's another way to boot recovery using fastboot as intermediary. Just have to replace the boot partition afterwards.
[Android Software Development] mightysween:
Thanks, but there is no recovery partition on the X4, nor separate boot and recovery images.
[Android Software Development] abrakadabra_srb:
Problem with busybox

Hey guys

I'm trying to compile TWRP for AOSP Bullhead ROM. I managed to compile it for Android 7.0 (couple of months ago) but now I have issues with Android 8.0. I initially added only bootable/recovery from Omnirom and when it complained about busybox I added this from Omnirom too. Now, I cant seem to figure out this build problem:

[163/981] including ./external/busybox/Android.mk ...
build/core/binary.mk:1485: error: external/busybox/Android.mk: libbusybox: C_INCLUDES must be under the source or output directories: /media/arielos/out/target/product/bullhead/obj/busybox/minimal/include.
16:47:39 ckati failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1

For both twrp and busybox I use android-8.0 branch. Can someone give me any hint on how to overcome this problem?
[Android Software Development] bigsupersquid:
To build twrp with android 8 I had to download minimal omnirom sources and tweak my device folder to work with it.

Was a lot easier than trying to hash out the errors with busybox and updater and whatever else it was throwing a fit about a while back trying to build in lineage source tree.
[Android Software Development] DEVILOPS 007:
What did you tweak if you don't mind me asking?
[Android Software Development] NepoRood:
I still use CM12.1 to build...

I haven't tried latest TWRP (3.2.X) but, I built 3.1.1 a few weeks ago, for a couple different devices, without any issues
[Android Software Development] bigsupersquid:
some makefiles have different names. Everything cm/lineage needs swapped to omni, some things in vendor includes in the makefiles are different. I was lucky enough to find an old (kitkat, maybe lollipop?) device tree for my a5 at teamwin's github to compare to and work from.

I didn't upload that htc a5 device tree or I'd point you to the diff; I chunked all the -common stuff together into one big messy device folder instead and it worked well enough to build TWRP. It also has Multirom patched in, so even TWRP was all patched up with changes and not just my device tree.

I wouldn't necessarily expect omni to boot with the mess I made of the device tree though. Still, TWRP built with absolutely no issues in the omni tree compared to trying to make it work in lineage 14 or 15, and recovery booted and functioned fine.
[Android Software Development] jahidinbedod:
how to remove this text

very bad :rolleyes:

see pict

help
[Android Software Development] ashyx:
Hex edit SBIN/RECOVERY or rebuild from source and remove from BoardConfig.mk
[Android Software Development] DodoGTA:
What's your device?
[Android Software Development] jahidinbedod:
I will try it

thanks bro

---------- Post added at 04:32 PM ---------- Previous post was at 04:31 PM ----------

op5
[Android Software Development] DodoGTA:
Then use this TWRP recovery: https://xdaforums.com/oneplus-5/development/recovery-twrp-3-1-1-0-touch-recovery-t3632912