yashsingh1/xdaforums huggingface dataset:
[Android Software Development] shadowcliffs:
Actually I'm curious how a working twrp fixed the issue with MDM (Mobile Device Management). Whenever I tried to wipe data and factory reset through stock recovery, it says "MDM does not allow FactoryReset". I googled this message and found people whose demo device has the same issue and later on was fixed by twrp. I'm curious on how twrp can bypass MDM.
[Android Software Development] cleverior.ipul:
someone please help me. i'm facing this problem when i try to compile twrp 2.7. what's wrong and how to fix it ?

target thumb C: libext4_utils <= system/extras/ext4_utils/indirect.c
target thumb C: libext4_utils <= system/extras/ext4_utils/uuid.c
target thumb C: libext4_utils <= system/extras/ext4_utils/sha1.c
target thumb C: libext4_utils <= system/extras/ext4_utils/wipe.c
target thumb C: libext4_utils <= system/extras/ext4_utils/crc16.c
target SharedLib: libext4_utils (/home/linmint/Project/cm11/out/target/product/Polymer_2x/obj/SHARED_LIBRARIES/libext4_utils_intermediates/LINKED/libext4_utils.so)
target Symbolic: libext4_utils (/home/linmint/Project/cm11/out/target/product/Polymer_2x/symbols/system/lib/libext4_utils.so)
target Strip: libext4_utils (/home/linmint/Project/cm11/out/target/product/Polymer_2x/obj/lib/libext4_utils.so)
Import includes file: /home/linmint/Project/cm11/out/target/product/Polymer_2x/obj/SHARED_LIBRARIES/libopenaes_intermediates/import_includes
target thumb C: libopenaes <= bootable/recovery-twrp27/openaes/src/oaes_lib.c
bootable/recovery-twrp27/openaes/src/oaes_lib.c:44:25: fatal error: oaes_config.h: No such file or directory
compilation terminated.
make: *** [/home/linmint/Project/cm11/out/target/product/Polymer_2x/obj/SHARED_LIBRARIES/libopenaes_intermediates/src/oaes_lib.o] Error 1
[cleverior@nemo-lab cm11]$

thanks in advance :)
[Android Software Development] :
Have you verified if oaes_config.h exists? That is your error. It cannot be found.
[Android Software Development] _that:
Why aren't you compiling the current version (2.8.7+)? Also, in which ROM tree?
[Android Software Development] :
[MENTION=4878287]_that[/MENTION], He is using CM11, but good question about recent TWRP version.
[Android Software Development] cleverior.ipul:
oaes_config.h will exist if oaes_config.c is compiled successfully.

bcz i just have source cm11.
[Android Software Development] :
oaes_lib.c won't compile successfully unless oaes_config.h exists ;)

---------- Post added at 02:44 PM ---------- Previous post was at 02:40 PM ----------

Might want to consider updating the source with repo sync and see if this fixes your issue.
[Android Software Development] cleverior.ipul:
i'll try it later. any other suggestions?

and do you know about DT image ?
[Android Software Development] :
Only suggestion that comes to mind.

And yes.
[Android Software Development] _that:
No, oaes_config.h exists in openaes/inc after checking out sources.

You should still use the latest version of TWRP.
[Android Software Development] ketut.kumajaya:
[MENTION=6367467]SHM[/MENTION], [MENTION=4878287]_that[/MENTION], [MENTION=912474]Dees_Troy[/MENTION] I also found fsflags support broken. This because Process_FS_Flags Flags parameter just a copy not a reference, not get updated, Mount_Flags always 0

Change https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/partition.cpp#L409 to

bool TWPartition::Process_FS_Flags(string& Options, int& Flags) {

and https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/partitions.hpp#L95 to

bool Process_FS_Flags(string& Options, int& Flags);

fix the problem.
[Android Software Development] :
[MENTION=4021423]ketut.kumajaya[/MENTION] could you push this to gerrit for review? So it will finally be fixed.
[Android Software Development] ketut.kumajaya:
I'm working inside CyanogenMod source tree, maybe [MENTION=5153662]Android-Andi[/MENTION] can help us.
[Android Software Development] Android-Andi:
You are still alive buddy? Tried to contact you many times on hangouts :D

I am away from PC, but you can commit it from Webinterface on omni gerrit (i can do too, but would add authorship to me, lol)

Here's how it works:

https://m.youtube.com/watch?v=dubJjEYpOMw

(Recorded on slim, but works on omni the same way)
[Android Software Development] ketut.kumajaya:
Ha..ha.. :D Take the authorship, a credit for me and [MENTION=6367467]SHM[/MENTION] more than enough.
[Android Software Development] Android-Andi:
ok, wi do in a sec

---------- Post added at 04:44 PM ---------- Previous post was at 04:36 PM ----------

Done [MENTION=6367467]SHM[/MENTION] and [MENTION=4021423]ketut.kumajaya[/MENTION] https://gerrit.omnirom.org/#/c/14355/
[Android Software Development] cleverior.ipul:
can i compile latest TWRP using CM11 source ?
[Android Software Development] :
Yes but expect build errors that may need to be resolved. CM is a difficult repo to use when building TWRP. It does not play nice.
[Android Software Development] cleverior.ipul:
what the best source should i use to build twrp ?
[Android Software Development] :
Omnirom. Branch, android-5.1, as of right now is definitely recommended.
[Android Software Development] fgl27:
in case my device doesn't exists there? in Omnirom...

But it exist in CM and Mokee source.

Mokee would be better? because it is AOSP base and less changed?

Or anyone advise difference?

:good:
[Android Software Development] cleverior.ipul:
how the total size of omni ?
[Android Software Development] :
Like 14-15 gigs off the top of my head. That's it's initial size. It will grow when you make a build.
[Android Software Development] andreya108:
Hi!

I've compiled the latest (2.8.7.0) version of twrp from branch android-5.1 and within omnirom-5.1 environment (the latest, just after repo sync).

Everything works fine (Samsung SM-T365 device) except one thing:

when I trying to connect via adb the following message appears:

"- exec '/system/bin/sh' failed: No such file or directory (2) -"

So, I checked adbd sevices and rebuild it to point to /sbin/ash (for busybox) as alternative shell, but it doesnt work either.

I think that it is due to bad default sepolicy configuration (there are labels reffered in init.rc that are not defined in sepolicy files at all), is it?

If so, where I can get correct sepolicy? (tried one from cyanogenmod, but recovery bootloops)

If not, what is the problem?
[Android Software Development] :
Is system mounted?
[Android Software Development] vel_tins:
Compile error with CM 12.1

Hi guys (and girls)

I have two major issues...(what else) :confused:

Devices is an Android One with Snapdragon 410/MSM8916 SoC and Lollipop 5.1

1. cyanogen recovery against CM 12.1 sources builds fine, but its really poor

So I' ve tried to compile the latest TWRP with CM 12.1, but I get the following error:

make: *** No rule to make target '/home/rol/CWM/android/system/out/target/product/IQ_II/obj/STATIC_LIBRARIES/libminui_intermediates/export_includes', needed by '/home/rol/CWM/android/system/out/target/product/IQ_II/obj/EXECUTABLES/healthd_intermediates/import_includes'. Schluss.
make: *** Auf noch nicht beendete Prozesse wird gewartet …

Any ideas?

2. Building TWRP with the 5.1 Omnirom sources ends in a successful build, BUT

TWRP won't boot (from fastboot), but any other (incl. Cyanogen) recovery does.

I used init.rc and recovery.fstab from a 12.1 Cyanogen recovery build, which also boots fine from fastboot.

No more idea where to look or check.

Is there probably some kind of "testing" available, where I can delimit possible errors

If any files/logs are needed, I will provide what I have, just let me know.
[Android Software Development] :
[MENTION=517401]vel_tins[/MENTION], can't really assist you but I can confirm that I have the same issue trying to boot TWRP using fastboot after making a build using the Omni source but with CM this is not an issue for me. I currently use Omni by default so fastboot will remain an issue until I find the problem and fix it or someone makes it obvious to me. :)
[Android Software Development] sub77:
you have to clone twrp to bootable/recovery-twrp with RECOVERY_VARIANT=twrp flag in BoardConfig.mk

your recovery.fstab should look like this:

/system	ext4	/dev/block/platform/msm_sdcc.1/by-name/system	flags=backup=1;canbewiped;wipeingui;display="System"

but not like this:

/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,errors=panic wait

for the most devices there is no need to change any initrd files.

some device trees: https://github.com/teamwin
[Android Software Development] vel_tins:
OK, I had the flag in BoardConfig.mk, but didn't rename recovery to recovery-twrp.

It's nowhere mentioned in the first post...

I can build TWRP now, but it doesn't boot anyway.

When I flashed this TWRP, it seems that Cache/Dalvik/Art was wiped, because my phone "optimizes" all Apps on next boot.

This does NOT happen, when I flash the Cyanogen-Recovery.

It does look like this.

/cache	ext4	/dev/block/platform/7824900.sdhci/by-name/cache
/system	ext4	/dev/block/platform/7824900.sdhci/by-name/system
/data	ext4	/dev/block/platform/7824900.sdhci/by-name/userdata	length=-16384
/external_sd	vfat	/dev/block/mmcblk1p1	flags=display="Micro SDcard";storage;wipeingui;removable
/boot	emmc	/dev/block/platform/7824900.sdhci/by-name/boot
/recovery	emmc	/dev/block/platform/7824900.sdhci/by-name/recovery
/misc	emmc	/dev/block/platform/7824900.sdhci/by-name/misc

For changes in init.rc or recovery.fstab, I don't need to recompile everything, correct?

Just unpack, edit and repack?
[Android Software Development] sub77:
yes, no need to recompile.

have you set selinux to permissive, it can block recovery if enforcing.
[Android Software Development] :
I basically added the following to the kernel cmd line :). No changes anywhere else.

androidboot.selinux=permissive
[Android Software Development] sub77:
can i have a look on your tree?
[Android Software Development] :
https://github.com/Tkkg1994/device_samsung_kccat6_twrp
[Android Software Development] sub77:
have you tried to build the kernel and dtb from source and checked the offsets?
[Android Software Development] :
Offsets are good. And yes, I modified the kernel source so that modules would be built in. The TWRP build currently has an issue with vibration not working and was hoping that building the modules into the kernel would resolve it but it did not so I am still looking that over. Nothing wrong with it except for the following known bugs:

- no vibration

- MTP mounts storage but cannot copy to or from (this is due to Samsung apparently using a different implementation with MTP that isn't adapted with the TWRP source if I understood [MENTION=4878287]_that[/MENTION] correctly over on IRC after discussing it earlier today).

However, I do not own the device. Just helping another member out with it since he wasn't sure how to setup the device tree and make a build.

With that said, I may exclude MTP since it can't really be used and instead attempt to use CDFS within init.recovery.usb.rc in hopes that files can be transferred from device to pc and vice versa. The device only uses one lun. It doesn't have multiple luns and doesn't use UMS to my knowledge. It's mounted as an image or cd based upon reviewing both stock recovery and boot ramdisks and their feedback.

(My previous statement is not an open door invitation to everyone who wants twrp so do not blow up my inbox) - thanks :)
[Android Software Development] fgl27:
can any one help please.

I trying to make TWRP to work in lollipop on Motorola XT1225 and have no success. All the recovery's that i have made none boot...

All the info about what i did is in here:

http://xdaforums.com/droid-turbo/de...est-builds-t2956937/post62348860#post62348860

Please give a look i will try any idea... :good:

Thanks...
[Android Software Development] arvinquilao:
Ah, this could explain why my TWRP 2.8.7.0 build from cm12.1 source doesn't run the recovery binary automatically (you have to force start it from adb). Another 2.8.7.0 build from cm11 source doesnt have this issue, so I'm thinking that this indeed is an selinux issue. :)
[Android Software Development] someone755:
http://review.cyanogenmod.org/#/c/89474/

This is what you need if building in a CM tree on Lollipop.
[Android Software Development] vel_tins:
Exactly, after adding this flag,

androidboot.selinux=permissive

TWRP booted without problems.

Only one minor minor issue:

If I format the recovery.fstab like this:

/boot emmc /dev/block/platform/soc.0/by-name/boot
/system ext4 /dev/block/platform/soc.0/by-name/system
/system_image emmc /dev/block/platform/soc.0/by-name/system
/data	ext4 /dev/block/platform/soc.0/by-name/userdata
.......

TWRP boot takes ages and is not able to mount any partitions.

Format needs to be like this:

/cache	ext4	/dev/block/mmcblk0p29
/system	ext4	/dev/block/mmcblk0p25
/data	ext4	/dev/block/mmcblk0p31	length=-16384

:confused:
[Android Software Development] :
Use which ever one works best.
[Android Software Development] someone755:
As far as I know, the two formats are the same, the only difference being that the second one is device-specific while the first one is more universal.

The slow format happened to me as well (though only on /system); using rm -rf solved it for me: https://github.com/someone755/andro...mmit/98b5c49bcbb39875f5826083cc14bbad4b26d779

Now for a question of my own: what sets the way the recovery is compressed?

Currently the default is lzma, but this is causing issues for me so naturally I'd like to change that -- is there any way I can do that (if this is even TWRP-related)?
[Android Software Development] :
Unpack the image then decompress the ramdisk. Compress the ramdisk according to your liking. GZIP, LZ4, XZ, and so on. Just make sure the kernel supports it or it will fail to boot. GZIP is pretty common to be supported by kernels.

gzip:

mkbootfs decompressed_ramdisk_folder | gzip > ramdisk.gz

lz4:

mkbootfs decompressed_ramdisk_folder | lz4 -l > ramdisk.lz4

xz:

mkbootfs decompressed_ramdisk_folder | xz -1 --check=crc32 > ramdisk.xz

lzma:

mkbootfs decompressed_ramdisk_folder | xz --format=lzma > ramdisk.lzma
[Android Software Development] someone755:
Thanks, though I was wondering if there's a way I could change the compression method at the time of building.
[Android Software Development] _that:
Default compression for ramdisks is gzip (as far as I've seen), but if your device tree has a custom makefile target for $(INSTALLED_RECOVERYIMAGE_TARGET) it can be anything. Normally developers introduce lzma compression only because the image would be too big with gzip.
[Android Software Development] :
https://github.com/Tkkg1994/device_samsung_kccat6_twrp/blob/master/samsung/kccat6/custombootimg.mk

Modify the above file to your liking.

In the boardconfig.mk file include:

BOARD_CUSTOM_BOOTIMG_MK := /path/to/custombootimg.mk

---------- Post added at 05:16 PM ---------- Previous post was at 05:09 PM ----------

If you plan on using gzip then my recent post is pointless. Just build the recovery. Ramdisk is automatically compressed as gzip from the source.
[Android Software Development] someone755:
The thing is this is a Sony device, so it uses its own custombootimg.mk

https://github.com/AOSPA-L/android_...ommon/blob/lollipop-mr1/boot/custombootimg.mk

I can't find a single reference to LZMA, but when I build TWRP, I know it's LZMA because it won't work without this commit which was made specifically for LZMA-compressed ramdisks:

https://github.com/CyanogenMod/android_device_sony_msm8974-common/commit/60dc19e0 (but CyanogenMod refused to accept it for reasons unknown, which is the only reason I'm going through this now).
[Android Software Development] fgl27:
I think i find the error is at :recovery will test it...

when I finish compiling, the file twrp.fstab is not in etc folder.

the top of device.mk is like this

PRODUCT_COPY_FILES += \
device/motorola/quark/twrp.fstab:recovery/root/etc/twrp.fstab

PRODUCT_COPY_FILES += \
device/motorola/quark/rootdir/etc/init.qcom.rc:root/init.qcom.rc \
device/motorola/quark/rootdir/etc/init.qcom.power.rc:root/init.qcom.power.rc \
device/motorola/quark/rootdir/etc/init.qcom.usb.rc:root/init.qcom.usb.rc \
device/motorola/quark/rootdir/etc/fstab.qcom:root/fstab.qcom \
device/motorola/quark/rootdir/etc/ueventd.qcom.rc:root/ueventd.qcom.rc

the twrp.fstab file is present on device/motorola/quark/ but its not in recovery.img. And no error occur while compiling...

For all the .rc file it work but not to twrp.fstab

if i unpackimg and repackimg it work but i wanna to do that in the compiling process

I'm using CM source don't know if that matters. :good:
[Android Software Development] :
That makefile is using gzip to compress the ramdisk.

That commit uses a script in the ramdisk during boot time (if I looked at it correctly). It checks to see if the gzip compressed ramdisk worked. If not then it decompresses and compresses as lzma and trys again.

---------- Post added at 05:55 PM ---------- Previous post was at 05:51 PM ----------

In boardconfig.mk

TARGET_RECOVERY_FSTAB := /path/to/twrp.fstab
[Android Software Development] fgl27:
solved, sorry for so many post...

I'm get a error...

I'm able to backup, system, data, boot and cache.

But if i try to restore or wipe, TWRP doesn't complete and doesn't comes out the wipe screen.

after i force reset and open recovery, i get

E: unable to mount '/system'

E: unable to mount '/cache'

my twrp.fstab is

/system ext4 /dev/block/platform/msm_sdcc.1/by-name/system
/data	ext4 /dev/block/platform/msm_sdcc.1/by-name/userdata length=-16384
/data	f2fs /dev/block/platform/msm_sdcc.1/by-name/userdata length=-16384
/cache	ext4 /dev/block/platform/msm_sdcc.1/by-name/cache
/fsg	ext4 /dev/block/platform/msm_sdcc.1/by-name/mdm1m9kefs3
/firmware	ext4 /dev/block/platform/msm_sdcc.1/by-name/modem
/persist	ext4 /dev/block/platform/msm_sdcc.1/by-name/persist
/boot emmc /dev/block/platform/msm_sdcc.1/by-name/boot
/recovery emmc /dev/block/platform/msm_sdcc.1/by-name/recovery flags=backup=1

/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=removable;storage;display=USB-OTG

default recovery.fstab is

# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data f2fs rw,nosuid,nodev,noatime,nodiratime,inline_xattr,inline_data wait,nonremovable,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,nobarrier,journal_async_commit wait,nonremovable,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw,nosuid,nodev,noatime,nodiratime,data=writeback,noauto_da_alloc,barrier=1 wait,check
/dev/block/platform/msm_sdcc.1/by-name/mdm1m9kefs3 /fsg ext4 ro,nosuid,nodev,barrier=0,context=u:object_r:firmware_file:s0 wait,check
/dev/block/platform/msm_sdcc.1/by-name/modem /firmware ext4 ro,nosuid,nodev,barrier=0,context=u:object_r:firmware_file:s0 wait,check
/dev/block/platform/msm_sdcc.1/by-name/persist /persist ext4 rw,nosuid,nodev,barrier=1,defcontext=u:object_r:persist_file:s0 wait,check
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults recoveryonly
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults recoveryonly

/devices/f9200000.ssusb/f9200000.dwc3/xhci-hcd.0.auto/usb3/3-1/3-1:1.0 auto auto defaults voldmanaged=usbdisk:auto

I don't understand way two data one ext4 and other f2f?

My board config:

# TWRP
TW_THEME := portrait_hdpi
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TW_INCLUDE_L_CRYPTO := true
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true
TW_SCREEN_BLANK_ON_BOOT := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565"
TW_NO_USB_STORAGE := true
TARGET_RECOVERY_FSTAB := /path/to/twrp.fstab

-include vendor/motorola/quark/BoardConfigVendor.mk

:good:
[Android Software Development] _that:
You just linked to CyanogenMod's repository, so apparently they did accept it.
[Android Software Development] someone755:
The init.sh script uses extract_elf_ramdisk to get a recovery ramdisk from another partition. The commit I linked checks if the process failed, and tries again, this time assuming the ramdisk was compressed with lzma.

Usually it's an uncompressed ramdisk (if I understood the custombootimg.mk correctly). But without the commit I linked (made specifically for use with LZMA-compressed recovery ramdisks), the recovery will not work, so that's proof that something is packing the recovery ramdisk with LZMA. The question I'm asking is, what that is (and if it's even something connected to TWRP).

They didn't though. It got a -2 code review by a device maintainer (Kali-). http://review.cyanogenmod.org/#/c/89057/

Gerrit commits get links to Github even if they don't get accepted, apparently (which I just found about today).
[Android Software Development] _that:
Wow, that's a 100% argument free -2 there. Good to know so that I don't accidentally try to contribute to CM.
[Android Software Development] :
[MENTION=4275152]someone755[/MENTION]

I'm looking at both files and they definitely compress the ramdisk as gzip initially. custombootimg.mk shows no signs of compressing the ramdisk as lzma.
[Android Software Development] fgl27:
solved, sorry for so many post...

i did some test, i discovery that the TWRP cant format EXT4 partition, if i try to wipe any EXT4 TWRP does-not finish the, just stay trying in wipe screen and i need to force reset.

If i try to change file system to F2FS it formats ok.

But the device uses EXT4.

Can some one help i don't now what to do...
[Android Software Development] lj50036:
Yes, TWRP does a 'secure erase' which on some devices and take a very long time, maybe 90 minutes ....

If you do not want this to happen you can use the build flag ...

BOARD_SUPPRESS_SECURE_ERASE := true

This is only for omni sources .....

Thx Josh
[Android Software Development] fgl27:
I try that flag and did not work, exist any other flag that is preventing this (BOARD_SUPPRESS_SECURE_ERASE := true) from work?

thx..
[Android Software Development] lj50036:
What source are you using ?

Thx Josh
[Android Software Development] fgl27:
CM 12.1
[Android Software Development] lj50036:
I cannot help with this, I dont build on CM sources...

Thx Josh
[Android Software Development] vel_tins:
What's the difference between building on CM amd Omnirom sources?

Is there any, noticeable advantage, using Omni?
[Android Software Development] :
Not that I am personally aware of. Only thing I really noticed to be an advantage with using Omni is less errors during build time and the build time is much faster than when using CM. CM is slow because it's inheriting way more than what is really needed just to make a simple recovery build. My humble opinion. Others may disagree :-p
[Android Software Development] lj50036:
Ok had a look and it seems CM uses this build flag

BOARD_SUPPRESS_EMMC_WIPE := true

Thx Josh
[Android Software Development] fgl27:
I believe that was for me.

Because it work.

Thanks...

you or any one here know what that "secure erase" is?

Is a erase that fill all the bits with 0 (or something like that) so no one can read the previous information...

Or is like formatting a driver on computer, quick format erase the files just that, and normal format erase and scan for bad sectors.

or is a TRIM like in SSD's.

Or any other thing...

:good:

edited later...

I find this in a e·MMC PDF

The only thing that is be done wen secure erase a partition is this "purged from the

physical memory array".

I don't think this "secure erase" is necessary.

any one now a bug that can happen if i never format a partition with "secure erase"?

thanks...
[Android Software Development] _that:
It is not necessary. However it can make future writes faster when erased blocks are available.
[Android Software Development] rexdrive:
For Qualcomm Snapdragon 8674 v1, what do I write here

TARGET_BOARD_PLATFORM :=

Do I write - msm8674?