yashsingh1/xdaforums huggingface dataset:
[Android Software Development] :
In the terminal emulator on your device, type and enter:

getprop ro.board.platform

For my device it reports back with, msm8960.
[Android Software Development] rexdrive:
Thank you, I shall report back after I try that. :)

Update: getprop ro.board.platform: not found

Update: It worked. Thank you very much :)
[Android Software Development] :
Hello

I own a Lenovo Zuk Z1, with CMS-12.1

you know if the op tutorial can works to create a recovery for this phone and root it?

If has the same resolution and CPU/GPU that the OPO. I can use the OPO recovery image?

Thanks in advance
[Android Software Development] :
If it's on the same SoC and all else is identical according to what you say, then just unpack the recovery.img, review all contents inside the ramdisk and insure all is correct according to your device such as kernel, dtb (if applicable), fstab, and so forth. Will also need to grab the recovery binary inside the sbin directory of the ramdisk and double check flags being used such as lun path, battery path, and anything else that is noticeable. Practically, you are looking at porting a prebuilt TWRP and to be frankly honest, it would be much simpler to grab the Device Tree from the other device and make the needed changes then build TWRP from source.
[Android Software Development] sub77:
how can i get the build flags out of the binary?
[Android Software Development] :
Searching for specific strings using a hex editor would suffice. It's all practically there given my experience messing around with it.
[Android Software Development] rexdrive:
Another question please help me out here:

What do I write here -

BOARD_BOOTIMAGE_PARTITION_SIZE :=

The commands that I tried are:

- cat /proc/mtd = no result

- cat /proc/mounts = I get something, not much relevance

- cat /proc/partitions = gives me the partition size

- ls - al /dev/block/platform/msm_sdcc.1/by-name = gives me the info as to where is the boot, recovery, system, etc.

Please help me out thank you.
[Android Software Development] :
Seems a hard task, and also the build from source.

Can't be a bit automatized?
[Android Software Development] :
Sorry, even if you wrote a script to automatize it to some degree for porting a prebuilt twrp recovery from one device to another you would still be rather limited. Doing it manually is your best bet for now.

---------- Post added at 11:50 AM ---------- Previous post was at 11:46 AM ----------

Use fdisk to get the size. Should be part of your busybox tool.

fdisk -l /path/to/block/partition

In the picture below I pointed fdisk to my recovery partition. It reports back that the recover partition size is, 16776704 bytes.
[Android Software Development] phil2sat:
Is there an option to specify an extra Kernelconfig for Recovery, cause my default Kernel with Wifi enabled is to big to create a TWRP Recovery
[Android Software Development] rexdrive:
I already ran that command and got the information and here's a dumb question after that -

I have seen samples for other devices, e.g.:- my C1904, and there the BOARD_BOOTIMAGE_PARTITION_SIZE := 0x01400000.

How is it so?

Because the command that you shared showed some other value. Sorry for being dumb
[Android Software Development] :
The value displayed on the terminal is in decimal. You can convert that decimal to hex if you like.

---------- Post added at 01:52 PM ---------- Previous post was at 01:51 PM ----------

Have you tried using the stock kernel from your recovery partition?
[Android Software Development] rexdrive:
It really was a dumb question, it completely slipped my mind. :p Thank you
[Android Software Development] phil2sat:
No thats not an option, i know how to build a TWRP around my stock kernel and i would be also able to change kernelconfig and build TWRP with that config

BUT

On normal rom generation "brunch jfltexx" i get an error that the recoveryimage is too big for partition (fixed build error by expanding partition size)

Now i think it yould be nice to set an extra recovery kernel config to build boot.img and bootrecovery.img

BUT

I think i have to integrate this by my self
[Android Software Development] _that:
Yes, that would be a nice feature for some devices. You'd need to modify build/core/tasks/kernel.mk to allow for two separate kernel configs and separate kernel object directories, and build/core/Makefile to use your separate recovery kernel.
[Android Software Development] SdtBarbarossa:
Hello twrp team, im trying to mount the second partition of sd_ext via twrp (changed fstab mounpoint mmcblk1p2) but somehow i always goes directly to internal storage... What can i do to mount it correctly?

EDIT: SOLVED thx much to [MENTION=4878287]_that[/MENTION]
[Android Software Development] vel_tins:
twrp.fstab - Partition naming scheme

I've compiled TWRP 2.8.7.0 for Android One (Snapdragon 410) and everything works fine, but there is a minor "issue"

Stock recovery and Cyanogen Recovery can use the following syntax:

/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
.........

But this doesn't work in TWRP (can't mount partitions) and I have to use something like:

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

Why does (my) TWRP not accept the above naming scheme?

On Github, I've seen that TWRP should be able to work with both schemes.
[Android Software Development] _that:
Check what you really see under /dev/block/platform in TWRP. Maybe you're using a different kernel for TWRP that names the directory differently?
[Android Software Development] vel_tins:
I think I got it.

In TWRP the naming changed from

/dev/block/platform/[COLOR="SeaGreen"]7824900.sdhci[/COLOR]/by-name/cache
to
/dev/block/platform/[COLOR="Red"]soc.0[/COLOR]/by-name/cache

Hmm...

Kernel is a prebuilt kernel from stock recovery.
[Android Software Development] fgl27:
Resolved...

i'm trying to build on omni and cant pass this error (i can if i remove the content of the file, but don't wanna to do that)

build/core/tasks/vendor_module_check.mk:62: *** Error: vendor PRODUCT_COPY_FILES file "vendor/motorola/quark/proprietary/bin/adspd:system/bin/adspd" has unknown owner. Stop.

#### make failed to build some targets (03:40 (mm:ss)) ####

I copy the files from the device or clone from another source and received the erro.

I check file owner and they are my linux user, i try to included my user on white list but that did not work.

Edit: resolved

A 2# error appeared

build/core/tasks/vendor_module_check.mk:56: *** Error: Product "omni_quark" cannot have overlay in vendor tree: vendor/omni/overlay/common. Stop.

#### make failed to build some targets (03:55 (mm:ss)) ####

I search and for this i find a fix

change this

PRODUCT_RESTRICT_VENDOR_FILES := [COLOR="red"]true[/COLOR]

for this

PRODUCT_RESTRICT_VENDOR_FILES := [COLOR="Red"]false[/COLOR]

And the 1#error disappeared, don't now if is because of the change on (PRODUCT_RESTRICT_VENDOR_FILES :=) because i change so many files after the first error... but all good now. :good:
[Android Software Development] _that:
As I said before, this is your kernel naming the devices, it has nothing to do with TWRP.
[Android Software Development] vel_tins:
The TWRP Kernel is the stock Kernel from the stock recovery, pulled from my device.

So why does stock recovery work with that naming schemes, but TWRP doesn't?

EDIT: I've also tried the extracted Kernel from "boot.img" with the same result.
[Android Software Development] :
Send me your twrp recovery and your stock recovery.
[Android Software Development] vel_tins:
Here we go....
[Android Software Development] :
You sent me two different twrp images. Which one is for your device? The one called twrp.img has different offsets and different kernel commandlines then your stock recovery.img. The twrp.img uses a different partition naming scheme than seen in the stock recovery. I can only speculate just by the above mentioned that this twrp.img is not for your device. In fact, the twrp.img you sent me is for the Huawei Ascend Mate 2 (MT2-L03). I was the one who built that recovery - ModdingMyMind. Haven't even looked at twrp-neu.img yet.
[Android Software Development] vel_tins:
Nope...seems something went wrong.

I've attached "stock-recovery.img" and "twrp_neu.img", but no "twrp.img"

twrp_neu.img:

kernel=kernel
ramdisk=ramdisk
page_size=2048
kernel_size=17610591
ramdisk_size=4527946
base_addr=0x80000000
kernel_offset=0x00008000
ramdisk_offset=0x01000000
tags_offset=0x00000100
cmd_line='console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 androidboot.selinux=permissive'
board=""
format=gzip

ro.build.id=LMY48G
ro.build.display.id=full_IQ_II-userdebug 5.1.1 LMY48G eng.rol.20150830.120719 test-keys
ro.build.version.incremental=eng.rol.20150830.120719
ro.build.version.sdk=22
[Android Software Development] :
Possible but very strange. Anyways, moving alone, I looked at twrp_neu.img.

I found your problem.... For starters, the recovery.fstab located inside the ramdisk under the /etc directory uses the wrong by-name partitioning scheme. So remove it or fix it. Also, at the root of the ramdisk is twrp.fstab.

twrp.fstab should not be at the root of the ramdisk. It should be located under the /etc directory. Fix this mistake and your problem will go away.
[Android Software Development] vel_tins:
The "wrong" partitioning scheme, is the only one which works.

/dev/block/platform/[COLOR="Red"]soc.0[/COLOR]/by-name <-- The "wrong" but working scheme in TWRP!
/dev/block/platform/[COLOR="SeaGreen"]7824900.sdhci[/COLOR]/by-name <-- The "correct" but not working in TWRP!

I moved twrp.fstab to /etc, it was detected and renamed at boot time, but as expected, it didn't work

ls -al /dev/block/platform in TWRP.

ls -al /dev/block/platform
drwxr-xr-x 4 root root 780 Jan 13 23:34 [COLOR="Red"]soc.0[/COLOR]

ls -al /dev/block/platform in ANDROID

drwxr-xr-x root root 1970-01-14 07:17 [COLOR="SeaGreen"]7824900.sdhci[/COLOR]
drwxr-xr-x root root 1970-01-14 07:17 7864900.sdhci

SAME KERNEL!
[Android Software Development] :
Are you positive the stock recovery.img you are referencing is the proper recovery for your specific device? Have you verified the by-name partitioning scheme in your android terminal while system is booted?
[Android Software Development] vel_tins:
Eventually I've found the solution.

I had to add the following line into BoardConfig.mk:

TARGET_PLATFORM_DEVICE_BASE := /devices/soc.0/

There may be other solutions, but this works for now.

Thanks for your help.
[Android Software Development] :
This is new to me and to be honest weird. But thanks for sharing this. Will look at the source with regards to that flag to better grasp it's purpose and intent.
[Android Software Development] HaoZeke:
TWRP Recovery error!!

Hey can anyone help me out with this?

Export includes file: frameworks/native/services/batteryservice/Android.mk -- /home/haozeke/Android/Lolipop/crdroid/out/target/product/z3/obj/STATIC_LIBRARIES/libbatteryservice_intermediates/export_includes
make: *** No rule to make target '/home/haozeke/Android/Lolipop/crdroid/out/target/product/z3/obj/STATIC_LIBRARIES/libminui_intermediates/export_includes', needed by '/home/haozeke/Android/Lolipop/crdroid/out/target/product/z3/obj/EXECUTABLES/healthd_intermediates/import_includes'. Stop.
make: *** Waiting for unfinished jobs....
Export includes file: frameworks/native/libs/binder/Android.mk -- /home/haozeke/Android/Lolipop/crdroid/out/target/product/z3/obj/STATIC_LIBRARIES/libbinder_intermediates/export_includes
43.04s user 30.28s system 92% cpu 1:19.15 total
[Android Software Development] cesanaboia:
Hi!

I have this source: https://github.com/TeamWin/android_device_lge_h815

and G4 unofficial cyanogenmod tree.

What I have to do for compiling TWRP?
[Android Software Development] tomkins0752:
I've been working on building TWRP for the HTC J Butterfly 3 for the past week, and it just doesn't want to boot past the HTC splash screen.

I'm building in Omnirom using a kernel pulled from the device's recovery.img.

Could someone take a look at the compiled image or the config files I put together? I might be overlooking something.
[Android Software Development] ashyx:
Which branch of omni are you using to build. I have tried building for 3 different devices using existing trees and all 3 hang at the boot screen using 5.1.1 branch.

All builds compile successfully.

I've had working builds on earlier branches and even with cm sources, so don't know what's going on.
[Android Software Development] :
If it hangs then most certainly your init.rc file probably needs updating. If using the one from your stock image then compare it against the one which is part of the source. For awhile I only used branch 4.4 because 5.1 failed to boot. I later discovered I needed to update init.rc. They are different so check it out.

---------- Post added at 08:27 PM ---------- Previous post was at 08:16 PM ----------

https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/etc/init.rc

---------- Post added at 08:28 PM ---------- Previous post was at 08:27 PM ----------

https://github.com/omnirom/android_bootable_recovery/blob/android-4.4/etc/init.rc
[Android Software Development] tomkins0752:
Thanks for the tips. I've been using the 5.1 omni branch.

I'll try both the 4.4 branch and editing my init.rc, and see if I can at least get if to boot.
[Android Software Development] ashyx:
Thanks for the reply but that's not the issue, I can swap the whole Ramdisk, with a known working ram disk and just swap the sbin folder from the complied build and it still fails, to boot. As a test I took the recovery binary and libminitwrp.so from the compiled build and put it in the working Ramdisk sbin folder and it booted just fine. So looks like something got compiled wrong even though everything got compiled OK.
[Android Software Development] :
With the exception of the sbin directory what else in both ramdisks were different from one another? Did you diff any common files? I am willing to bet there are differences that exist which again would implicate the need to update the tree.
[Android Software Development] ashyx:
As far as I remember just sepolicy, but I know that works also, tested that too.

The differences are in the sbin directory, pretty much the majority of the files in the sbin folder show a difference.
[Android Software Development] :
You mind if I look at both ramdisks as is out of curiosity?
[Android Software Development] ashyx:
Will have to post up tomorrow. Pc is off and bedtime for me.
[Android Software Development] :
No problem, I don't expect any eta. If you get around to it great, but if not then it is no big deal either.
[Android Software Development] m0d:
When flashing new ROM I get the following lines appearing mixed with normal display:

Segmentation fault
E:mount -o bind '/data/media' '/sdcard' process ended with ERROR=139
Segmentation fault
E:mount -o bind '/data/media/0' '/sdcard' process ended with ERROR=139
Segmentation fault
E:mount -o bind '/data/media/0' '/sdcard' process ended with ERROR=139

Twrp version 2.8.7.0

Everything works fine, just was wondering how to fix the above

twrp.fstab:

# mount point	fstype	device	[device2] fstype2

/boot	emmc	/dev/block/platform/msm_sdcc.1/by-name/boot
/system	ext4	/dev/block/platform/msm_sdcc.1/by-name/system
/cache	ext4	/dev/block/platform/msm_sdcc.1/by-name/cache
/data	ext4	/dev/block/platform/msm_sdcc.1/by-name/userdata	length=-16384
/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="Micro SDcard";storage;wipeingui;removable
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="USB OTG";storage;wipeingui;removable

Boardconfig Twrp changes:

# TWRP Recovery
TARGET_NO_SEPARATE_RECOVERY := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565"
BOARD_HAS_NO_SELECT_BUTTON := true
BOARD_USE_CUSTOM_RECOVERY_FONT := \"roboto_23x41.h\"
TW_THEME := portrait_hdpi
RECOVERY_GRAPHICS_USE_LINELENGTH := true
RECOVERY_SDCARD_ON_DATA := true
TW_HAS_NO_RECOVERY_PARTITION := true
TW_FLASH_FROM_STORAGE := true
TW_EXTERNAL_STORAGE_PATH := "/external_sd"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "external_sd"
TW_DEFAULT_EXTERNAL_STORAGE := true
TW_INCLUDE_JB_CRYPTO := true
TW_CRYPTO_FS_TYPE := "ext4"
TW_CRYPTO_REAL_BLKDEV := "/dev/block/platform/msm_sdcc.1/by-name/userdata"
TW_CRYPTO_MNT_POINT := "/data"
TW_CRYPTO_FS_OPTIONS := "nosuid,nodev,barrier=1,noauto_da_alloc,discard"
TW_CRYPTO_FS_FLAGS := "0x00000406"
TW_CRYPTO_KEY_LOC := "footer"
TW_INCLUDE_FUSE_EXFAT := true
TW_BRIGHTNESS_PATH := /sys/class/leds/wled:backlight/brightness
TW_MAX_BRIGHTNESS := 4095
TW_NO_USB_STORAGE := true
TW_NO_SCREEN_BLANK := true
[Android Software Development] sub77:
you nedd mount points in your fstab.
[Android Software Development] lj50036:
What is the device ?

Thx Josh
[Android Software Development] m0d:
To sdcard?

Z3-compact, sony.

The error I got was from personal build.

But I do not notice any difference to official twrp sources

Other than the inclusion of TARGET_NO_SEPARATE_RECOVERY := true in my sources.
[Android Software Development] tomkins0752:
So I just noticed this happened. Sunday, while testing builds, when I thought nothing happened on screen and I went to hold down power, vol up and vol down, it would take a screencap if I didn't do it all at once.

So my device had booted into TWRP but the screen didn't show anything but a backlit black screen.

So...how would I fix this?
[Android Software Development] :
ro.debuggable should be set to equal 1 by default in your TWRP build. So, boot up TWRP again and plug your device into your pc. Now try to pull the recovery log while the screen is blank. Log should point to the culprit.

adb pull /tmp/recovery.log
[Android Software Development] tomkins0752:
Thank you!

I believe I found and fixed the culprit. I'm building now.

This is my first time building, and of course I pick an obscure phone, but this thread has really helped a lot.
[Android Software Development] :
Be sure to share your problem based on the log and your solution if successful. Would help others facing the same problem.
[Android Software Development] Tanuj97:
I am trying to compile twrp for htc one x but I am getting this error

bootable/recovery/gui/Android.mk:140: **************************************************************************
bootable/recovery/gui/Android.mk:141: * TW_THEME () is not valid.
bootable/recovery/gui/Android.mk:142: * Please choose an appropriate TW_THEME or create a new one for your device.
bootable/recovery/gui/Android.mk:143: * Valid options are portrait_mdpi portrait_hdpi watch_mdpi
bootable/recovery/gui/Android.mk:144: * landscape_mdpi landscape_hdpi
bootable/recovery/gui/Android.mk:145: **************************************************************************
bootable/recovery/gui/Android.mk:146: * stopping. Stop.

heres my boardconfig.mk

#TWRP CONFIG:
122 #DEVICE_RESOLUTION to be eliminated: https://github.com/TeamWin/Team-Win-Recovery-Project/commit/591b920
123 DEVICE_RESOLUTION := 720x1280
124 # new handling of resolution
125 TW_THEME := portrait_hdpi
126 # this enables proper handling of /data/media on devices that have this folder for storage
127 RECOVERY_SDCARD_ON_DATA := true
128 # disables things like sdcard partitioning
129 BOARD_HAS_NO_REAL_SDCARD := true
130 # removes the USB storage button on devices that don't support USB storage
131 TW_NO_USB_STORAGE := true
132 TW_BRIGHTNESS_PATH := /sys/devices/platform/tegra-pwm-bl/backlight/tegra-pwm-bl/brightness
133 TW_MAX_BRIGHTNESS := 255
134 TW_NO_SCREEN_BLANK := true
135 # fixes slanty looking graphics on some devices
136 RECOVERY_GRAPHICS_USE_LINELENGTH := true
137 HAVE_SELINUX := true
138 TWHAVE_SELINUX := true

what should I do to fix it ??
[Android Software Development] lj50036:
Post links to the kernel and device trees....

Thx Josh
[Android Software Development] :
[MENTION=5894937]onex master[/MENTION], comment out line 123. It is deprecated. You have two resolution flags currently set in your boardconfig file. DEVICE_RESOLUTION and TW_THEME. DEVICE_RESOLUTION is not needed.
[Android Software Development] Tanuj97:
I tried removing the line 122 and 123

but no luck

heres my device tree for omni

kernel sources
[MENTION=6367467]SHM[/MENTION] [MENTION=5123642]lj50036[/MENTION]
[Android Software Development] :
You need to push your most recent changes to all three of your repos being used to build TWRP. I don't wish to have to rewrite them just to duplicate your current issue.

I currently have downloaded omni_device_htc_endeavoru, android_kernel_htc_endeavoru, and android_device_htc_tegra3-common. As is, with no changes to any of those repos, it fails to even start building. I made some changes and the build starts but continues to fail. I could fix this on my end if I wanted to but my main goal was to have the sources build and see if I can replicate your issue with TW_THEME flag.
[Android Software Development] _that:
The BoardConfig in your device tree looks correct, but apparently TW_THEME is not set when you are building. Post the exact commands you used for lunch and for building.
[Android Software Development] Tanuj97:
https://github.com/teemodk/android_device_htc_tegra3-common/tree/omni

heres the common tegra 3 tree which I am using

---------- Post added at 06:30 PM ---------- Previous post was at 06:28 PM ----------

the commands I used were

. build/envsetup.sh
mka recoveryimage
[Android Software Development] :
Ok, the build was successful, and these were the changes I made...

In your boardconfig.mk file I commented out lines 123, and 137

In your endeavoru.mk file I commented out line 96

Then I ran the following commands to setup the build environment and to target the device:

. build/envsetup.sh && lunch omni_endeavoru-userdebug && mka recoveryimage
[Android Software Development] _that:
Try a different pixel format.
[Android Software Development] boa19861105:
I also have this problem

TARGET_RECOVERY_PIXEL_FORMAT := "BGRA_8888" Failure Unable adb shell

TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888" Failure Unable adb shell

TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565" Success can adb shell But the picture can not enter TWRP screen
[Android Software Development] tomkins0752:
I tried these formats, but none of them have worked.

Are there any others to try? Or something like a catch all for the format?
[Android Software Development] _that:
I don't see how the pixel format in recovery could have any influence on adb shell. It should only affect what you see on the screen (and possibly if TWRP even starts), but adbd is a separate process that doesn't know anything about the screen...

One thing you can try is this patch:

https://gerrit.omnirom.org/#/c/13545/
[Android Software Development] tomkins0752:
Very nice man! I'll give this a shot in a little bit.

Especially after I created some sort of awful offspring that had all the TWRP labels but looked like stock recovery.

I made sure it will never see the light of day.
[Android Software Development] boa19861105:
It stays in this picture

Wait a few seconds the screen will sleep
[Android Software Development] boa19861105:
I can enter TWRP screen but you can not touch
[Android Software Development] lihonglin:
i compile twrp for my phone honor4A also can not touch.......do you have solution?
[Android Software Development] _that:
Some HTC kernels disable touch in recovery. Look around in the kernel source code for code that disables the digitizer depending on the boot mode. For testing you could flash TWRP to the boot partition - if touch works, then this is your problem. (Do this only if you have an Android kernel to flash back to boot when you're done with testing).
[Android Software Development] lihonglin:
hello ,my honor4a can touch。。。。but inaccurate touch screen.....please help me ..thanks...