yashsingh1/xdaforums huggingface dataset:
[Android Software Development] bigsupersquid:
I'll give Sony points as a manufacturer for having gone mostly open source for some of their devices.

Look through this site:

https://developer.sonymobile.com/

Hopefully they have what you are looking for.
[Android Software Development] ashyx:
If you're building for a Android 6 device then use the Omni 6.0 branch and the TWRP 7.1 branch.

Also why don't you build as eng instead of user debug?
[Android Software Development] morfikov:
Yes, but this device has Android 7.0 installed now, so it's not 6.0 and not 7.1, I mean the OMNI source. :)

I don't know, people were using this kind of configuration, I've just copied their files and made changes. :)

Any idea about the errors?
[Android Software Development] ashyx:
It's still possible to build for a 7.1 device in Android 6 branch.

Have you tried make proper then starting the build again.?

You need to post a link to your device tree to give more info.
[Android Software Development] morfikov:
Here it is.
[Android Software Development] ashyx:
It's a fairly messy and complicated config if it's just for Twrp . Lots of stuff I find unnecessary and personally wouldn't use. However then again I'm not big on MTK devices.

Nothing I see springs out, so I'd try starting a clean build.
[Android Software Development] morfikov:
I don't really know which entries are necessary and which aren't. I simply copied stuff from other people's configs. I've managed to build the image using the 6.0 branch, and the image works fine.

You can always say which things can be removed, and I try to remove them.
[Android Software Development] Professor Woland:
Hello

I have recently tried to build TWRP for my mt6735 device and failed (it was sitting on "waiting for ram dump"), after that I tried repacking recovery with lz4 ramdisk compression and it booted and works (I can't access /data partition probably because of forceencrypt).

So can I somehow point to build ramdisk with lz4 instead of default gzip?
[Android Software Development] DodoGTA:
You can do that with a custom boot image generation file
[Android Software Development] Professor Woland:
Have any file to use it as example?
[Android Software Development] bauuuuu:
just saying, try

BOARD_KERNEL_LZ4C_DT := true

LZMA_RAMDISK_TARGETS := boot,recovery

in your Boardconfig.mk
[Android Software Development] Professor Woland:
tried, nothing, still the same, still in gzip
[Android Software Development] gee one:
Maybe you are missing a dependency in your build computer? Like lzop or zlib1g-dev or liblz4-tool - just a guess.
[Android Software Development] Professor Woland:
Shouldn't I get an error during build in that case?

However I used minimal TWRP manifest, and to be honest I don't know how to check if I'm missing those any hints?

Here is repo https://github.com/minimal-manifest-twrp/platform_manifest_twrp_omni I think it's all there..?

I'm using prebuilt kernel and it doesn't have dt image if that means something..
[Android Software Development] gee one:
Try apt-get update, then apt-get install lzop zlibg1-blah liblz4 blah. Or the equivalent for your distribution (yum, pacman, emerge, etc).

The packages need to be installed on your computer. The twrp manifest doesn't pull those in for you.
[Android Software Development] pvineeth97:
Sir, TWRP minimal manifest repo sync doesn't work anymore.

fatal: manifest 'default.xml' not available
fatal: remove-project element specifies non-existent project: android_external_svox

IOError: [Errno 2] No such file or directory: '/home/vineeth_pen/android/omni_twrp-7.1/.repo/manifest.xml'
[Android Software Development] NepoRood:
If you're using a prebuilt kernel, you can't compress it at build time, it's already built ;)

In order to change compression, you need kernel sources
[Android Software Development] Professor Woland:
Ooooh

I will send as soon I get hands on PC.

This is my fault I didn't explain kernel is compressed and I know that I need to change ramdisk compression in recovery.img
[Android Software Development] ashyx:
I'm pretty sure he's referring to ramdisk compression.

Edit: didn't see previous post for some reason. :silly:

---------- Post added at 03:29 PM ---------- Previous post was at 03:24 PM ----------

[MENTION=4544860]osm0sis[/MENTION] will be able to help you with the correct syntax for mkbootimg for LZ4.
[Android Software Development] androiabledroid:
I have encountered an strange error that I have created a twrp device tree in my older build my external sdcard was mounting but when I tried to build again using same no change in tree now after building it is not mounting external sdcard but my previous build is still mounting external sdcard

Plz help me
[Android Software Development] _that:
Read this fully, then ask again -> http://www.catb.org/esr/faqs/smart-questions.html
[Android Software Development] Professor Woland:
checked it's all there

summoning [MENTION=4544860]osm0sis[/MENTION]
[Android Software Development] androiabledroid:
I read this

---------- Post added at 11:15 PM ---------- Previous post was at 11:11 PM ----------

I need help would you help me
[Android Software Development] gee one:
Well, since you are using a precompiled kernel, can you just replace the current kernel with your compressed version? It's probably just an include file or make file somewhere. You'll just be using the build system to save you a few steps.

Or you can try to get the kernel source and go to town.
[Android Software Development] Professor Woland:
I'm not quite sure if I understand you. I'm using prebuilt kernel yes, but I have issue with ramdisk compression which is by default gzip instead of lz4, so recovery image won't boot untill I repack it manually.
[Android Software Development] bigsupersquid:
So the prebuilt kernel has lz4 enabled at least.

I had the same issue with not being able to specify the recovery ramdisk compression with my evo 3d. My evo sources are soooo scrambled and archaic it's difficult to clean them up.

I'm watching this question myself to see what ends up working for you.
[Android Software Development] osm0sis:
You rang? :p

Well, the kernel still needs to be compiled to support lz4 ramdisk compression or it won't work. As for packing the ramdisk correctly it's the usual but with lz4 instead of gzip (usually in -l legacy mode):

cd ramdisk; find . | cpio -H newc -o | lz4 -l > ../ramdisk-new.cpio.lz4

https://github.com/osm0sis/Android-Image-Kitchen/blob/AIK-Linux/repackimg.sh#L82
[Android Software Development] _that:
I tried, but you refused to ask a smart question. Instead you polluted the thread with a full quote of the OP. This is a development forum and thread - you are expected to add all relevant details when asking questions. Before you post again in this thread, please read the page I linked to in my previous post.
[Android Software Development] Professor Woland:
Kernel is fine, only thing I need is to pack ramdisk with lz4.

Ok, thanks for this code but where I'm supposed to put it?

Sorry everyone for this much questions..
[Android Software Development] osm0sis:
.. from a Linux command prompt? I assumed you had a development environment set up.

If you've got a recovery.img you're using the ramdisk from you could always use my Android Image Kitchen to unpack the gzip ramdisk, make any ramdisk changes you need, then swap out the zImage file in split_img and then change the contents of split_img/*-ramdiskcomp from gzip to lz4 and repack. Might be easier for you.

If it doesn't work, again, remember the config the kernel was built with needs to support lz4 ramdisks. Most don't.

I don't think there's anything else I can tell you to help at this point, so I'm going to unsubscribe from this thread again. Good luck!
[Android Software Development] Blackball:
Hi, someone can tell me where I can find the reboot options? I wanna add a reboot into recovery2 button (Huawei)
[Android Software Development] ashyx:
You probably need to look in the GUI directory.
[Android Software Development] Blackball:
I found this but i think its not enough to add something like this.

<button style="main_button">

<condition var1="tw_reboot_recovery" var2="1"/>

<placement x="%indent%" y="%row8_y%"/>

<text>{@rb_recovery_btn=Recovery}</text>

<actions>

<action function="set">tw_back=reboot</action>

<action function="set">tw_action=reboot</action>

<action function="set">tw_action_param=recovery</action>

<action function="set">tw_reboot_param=recovery</action>

<action function="set">tw_has_action2=0</action>

<action function="set">tw_text1={@no_os1=No OS Installed! Are you}</action>

<action function="set">tw_text2={@no_osrb=sure you wish to reboot?}</action>

<action function="set">tw_action_text1={@rebooting=Rebooting...}</action>

<action function="set">tw_complete_text1={@rebooting=Rebooting...}</action>

<action function="set">tw_slider_text={@swipe_reboot=Swipe to Reboot}</action>

<action function="page">rebootcheck</action>

</actions>

</button>

I think i need to find the parameter "tw_reboot_param=recovery" to add another one.
[Android Software Development] ashyx:
There seems to be some defines in variables.h and also some functions in twrp-functions.

Maybe you also need to look at the bootloader_message directory.

Calling [MENTION=4878287]_that[/MENTION]
[Android Software Development] nativetap:
Thank you [MENTION=912474]Dees_Troy[/MENTION] for providing this guide and for continuing to support TWRP - a lot of what we do wouldn't be possible
[Android Software Development] _that:
That is just stored in tw_reboot_arg which is evaluated near the end of twrp.cpp.

So you need to change the GUI, twrp.cpp, and implement it in TWFunc::tw_reboot in twrp-functions.cpp.
[Android Software Development] Professor Woland:
Ooh, I thought I could put this in some of .mk files to automate this process, I know about your AIK i'm used it allready to change compression but what I thought is to automate process so when building is done it comes out with ramdisk in lz4 and I don't have to repack recovery manually, yeah kernel does support lz4 moreover ramdisk in boot.img is in lz4 too like in stock recovery.

Anyway thanks for help.
[Android Software Development] ashyx:
You probably need the crypto blobs from your firmware or try the VOLD flag in your make file.

You could always do away with encryption all together.
[Android Software Development] TheFixItMan:
I believe I have the crypto blobs but it doesn't work - it still just sits there trying to decrypt or says wrong password (even though its correct) or says fails to decrypt

What are the vold flags and how do you add them?

Like I said - it works totally fine without encryption but I wanted to add encryption support

Edit

Don't worry iv fixed it - I can now decrypt my data
[Android Software Development] Blackball:
i have made all changes and compiling is fine but i cant see the button.

There is a button that i cant see too:

<button style="main_button">

<condition var1="tw_download_mode" var2="1"/>

<placement x="%indent%" y="%row13a_y%"/>

<text>{@rb_download_btn=Download}</text>

<actions>

<action function="set">tw_back=reboot</action>

<action function="set">tw_action=reboot</action>

<action function="set">tw_action_param=download</action>

<action function="set">tw_reboot_param=download</action>

<action function="set">tw_has_action2=0</action>

<action function="set">tw_text1={@no_os1=No OS Installed! Are you}</action>

<action function="set">tw_text2={@no_osrb=sure you wish to reboot?}</action>

<action function="set">tw_action_text1={@rebooting=Rebooting...}</action>

<action function="set">tw_complete_text1={@rebooting=Rebooting...}</action>

<action function="set">tw_slider_text={@swipe_reboot=Swipe to Reboot}</action>

<action function="page">rebootcheck</action>

</actions>

</button>

maybe i have to activate it somewhere ?
[Android Software Development] ashyx:
You need this flag in your mk file.

TW_HAS_DOWNLOAD_MODE := true
[Android Software Development] prydmus:
can someone help me here?

i had porting TWRP Recovery for Bluboo S8 from phone with same chipset. but every i booting to twrp recovery the touchscreen wont work.

any solution ?
[Android Software Development] _that:
Here -> https://xdaforums.com/showpost.php?p=71400973&postcount=2884
[Android Software Development] stani2103:
Hi

Why my TWRP not seen my backups?Its latest TWRP and older versions working fine....Now (as allways) I change the name of backup and TWRP not seen no one.....

***TAPATALKING***
[Android Software Development] _that:
This development thread is about compiling TWRP from source. You are expected to add all relevant details when asking questions. Please read http://www.catb.org/esr/faqs/smart-questions.html fully to learn how to ask technical questions with a high chance of getting a good answer.
[Android Software Development] stani2103:
Sorry

***TAPATALKING***
[Android Software Development] ashyx:
Bookmarked! That will be making regular appearances in my threads.

In Particular: Dealing with rudeness.
[Android Software Development] Blackball:
Thank you but it doesn't work for my recovery2 button.
[Android Software Development] narueon:
Backup Boot Partition

My Boot partition is actually of OSIP partition. How can I make TWRP backup and restore OSIP partition??
[Android Software Development] pozidrivphil:
Hi,

I've been reading and learning a lot these last couple days about compiling, but I seem to get stuck at the device sources. I'd like to compile TWRP for the Samsung XCover 4 (SM-G390F), I've found the kernel here:

http://opensource.samsung.com/recept...archValue=g390

But I've googled the crap out of a device tree, with no luck. Could anyone point me to a good guide on how to make one and is this even feasable for a scriptkiddie like me?

I've tried tools extracting it from boot.img and recovery.img, but that doesn't seem to work.

details:

ro.product.board=universal7570

ro.product.cpu.abi=armeabi-v7a

ro.board.platform=exynos5

ro.chipname=exynos7570

Thanks a lot for all the information provided!! This is the first phone where I haven't found a custom recovery right away. Man, it's a real handicap!
[Android Software Development] ashyx:
The best thing to do is search github for a device tree using the same platform as yours and then modify it to suit.

Basically you will need to use your own kernel and dtb and set the correct paths to them in the config.

You will also need to edit all the make files to reflect your particular device.
[Android Software Development] pozidrivphil:
I just threw the kernel I found here in /home/TWRP/kernel/samsung/xcover4lte

But I get an error. Do I need to compile this kernel first into an image and then point to that image with TARGET_PREBUILT_KERNEL := device/samsung/xcover4lte/Image in Boardconfig.mk?
[Android Software Development] NepoRood:
This is a development thread, not a request thread. If you have a TWRP for the same SOC, you should be able to port it to your device. Just search XDA for porting, it's not that hard...
[Android Software Development] divis1969:
TWRP build on Lineage 15

Hi,

I'm trying to build and run the twrp (branch o-8.0) in a Lineage 15 tree.

The build is ok, but the image (system zip) sideload fails with errors:

line 7 col 89: unknown function "set_metadata_recursive"

line 8 col 93: unknown function "set_metadata_recursive"

2 parse errors

Updater process ended with ERROR: 6

Is this branch ok for Lineage 15?
[Android Software Development] TimSchumi:
Fix up your SELinux, that worked for me when I faced that error.

What is said about SELinux when you show the log from within TWRP (the right button in the bar at the bottom of the screen)?
[Android Software Development] NepoRood:
You need some more flags in your fstab, like

flags=backup=1;wipeduringfactoryreset;wipeingui

for system and userdata, at least, probably don't want to wipe boot partition ;)

You should also look at This Guide, if you haven't already :good:
[Android Software Development] pozidrivphil:
Thanks for those flags NepoRood! I stumbled across that guide before in my endless googling, but now I actually have a basic understanding what it is about :)

I recompiled with the flags added to /system and /data, but I still can't mount a microSD card. I wouldn't even need this, if I could just push files with adb, but after trying 5 different drivers and 2 OS, I've got no idea on how to make adb and TWRP talk? Could this be a TWRP compile flag problem as well?
[Android Software Development] ashyx:
Can you post a screen shot of the twrp log screen (right button) ?
[Android Software Development] pozidrivphil:
I added a screenshot in the attachment

Also included my BoardConfig.mk:

USE_CAMERA_STUB := true

# Platform

TARGET_SOC := exynos7570

BOARD_VENDOR := samsung

TARGET_BOARD_PLATFORM := exynos5

TARGET_BOARD_PLATFORM_GPU := mali-t720

TARGET_NO_BOOTLOADER := true

TARGET_BOOTLOADER_BOARD_NAME := universal7570

TARGET_NO_RADIOIMAGE := true

# Flags

#TARGET_GLOBAL_CFLAGS +=

#TARGET_GLOBAL_CPPFLAGS +=

#COMMON_GLOBAL_CFLAGS +=

# Architecture

TARGET_GLOBAL_CFLAGS += -mfpu=neon -mfloat-abi=softfp

TARGET_GLOBAL_CPPFLAGS += -mfpu=neon -mfloat-abi=softfp

TARGET_ARCH := arm

TARGET_CPU_ABI := armeabi-v7a

TARGET_ARCH_VARIANT := armv7-a-neon

TARGET_CPU_VARIANT := cortex-a53

TARGET_CPU_CORTEX_A53 := true

ARCH_ARM_HAVE_NEON := true

TARGET_KERNEL_ARCH := arm64

TARGET_KERNEL_HEADER_ARCH := arm

TARGET_USES_UNCOMPRESSED_KERNEL := true

BOARD_KERNEL_CMDLINE := # Exynos doesn't take cmdline arguments from boot image

BOARD_KERNEL_BASE := 0x10000000

BOARD_KERNEL_PAGESIZE := 2048

# 000RU = recovery kernel, 000KU = system kernel

BOARD_MKBOOTIMG_ARGS := --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --board SRPPK23A000RU

# Partitions

BOARD_BOOTIMAGE_PARTITION_SIZE := 33554432

BOARD_CACHEIMAGE_PARTITION_SIZE := 209715200

BOARD_RECOVERYIMAGE_PARTITION_SIZE := 39845888

BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3145728000

BOARD_USERDATAIMAGE_PARTITION_SIZE := 12066992128

BOARD_FLASH_BLOCK_SIZE := 131072

TARGET_PREBUILT_KERNEL := device/samsung/xcover4lte/Image

TARGET_PREBUILT_DTB := device/samsung/xcover4lte/dt.img

# Use this flag if the board has a ext4 partition larger than 2gb

BOARD_HAS_LARGE_FILESYSTEM := true

TARGET_USERIMAGES_USE_EXT4 := true

TARGET_USERIMAGES_USE_F2FS := true

BOARD_CUSTOM_BOOTIMG_MK := device/samsung/xcover4lte/bootimg.mk

# TWRP specific build flags

TW_THEME := portrait_hdpi

RECOVERY_SDCARD_ON_DATA := true

BOARD_HAS_NO_REAL_SDCARD := true

%TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/13600000.usb/13600000.dwc3/gadget/lun%d/file"

TW_BRIGHTNESS_PATH := "/sys/devices/14800000.dsim/backlight/panel/brightness"

TW_MAX_BRIGHTNESS := 255

TW_DEFAULT_BRIGHTNESS := 162

TW_NO_REBOOT_BOOTLOADER := true

TW_HAS_DOWNLOAD_MODE := true

TW_MTP_DEVICE := "/dev/mtp_usb"

TW_EXCLUDE_SUPERSU := true

TW_INCLUDE_NTFS_3G := true

TW_EXTRA_LANGUAGES := true

TW_USE_NEW_MINADBD := true

# Color fix

TARGET_RECOVERY_PIXEL_FORMAT := "ABGR_8888"

# Encryption support

TW_INCLUDE_CRYPTO := true

#TW_INCLUDE_CRYPTO_SAMSUNG := true

#TARGET_HW_DISK_ENCRYPTION := true

# Debug flags

#TWRP_INCLUDE_LOGCAT := true

#TARGET_USES_LOGD := true

#TWRP_EVENT_LOGGING := true

# Init properties from bootloader version, ex. model info

TARGET_UNIFIED_DEVICE := true

TARGET_INIT_VENDOR_LIB := libinit_sec

TARGET_RECOVERY_DEVICE_MODULES := libinit_sec

TARGET_LIBINIT_DEFINES_FILE := device/samsung/xcover4lte/init/init_sec.cpp

Windows doesn't recognize the device at all when in TWRP.
[Android Software Development] ashyx:
It seems your kernel is still forcing selinux permissions.

I take it you are using the stock kernel and not a source built kernel?
[Android Software Development] pozidrivphil:
Yes, I unrar'ed recovery.img from the stock samsung firmware files and then I used Carliv image tool to extract kernel and dt image. I then pointed to the kernel image in boardconfig.mk with the "TARGET_PREBUILT_KERNEL" flag.

Should I compile with "TWHAVE_SELINUX := false" flag?

I tried the getenforce and sestatus commands in TWRP terminal, but nothing happens at all, terminal seems unresponsive.
[Android Software Development] pix106:
with TWHAVE_SELINUX := true

you can try

BOARD_KERNEL_CMDLINE := androidboot.selinux=permissive
[Android Software Development] crazycranagelo:
ok ow do you het twrp on the insignia flex ns-p10a6100 tablet i am allready rooted i used king root to root it so please help me get twrp on it thank you
[Android Software Development] pozidrivphil:
Thanks, I'll try that tomorrow morning. Could selinux enforcing cause the problem where I'm completely unable to use adb to communicate with twrp?
[Android Software Development] ashyx:
You need to build the kernel from source with selinux set to permissive.
[Android Software Development] pozidrivphil:
Ah crap, I really wanted to avoid going down the next rabbit hole. So many obstacles..

:crying:

Ok, 4 hours later the kernel seems to be compiling, I'm firstly checking if it will finish properly, next I'll change in kernel/security/selinux/Makefile

EXTRA_CFLAGS += -DCONFIG_ALWAYS_ENFORCE=true

true to false.

Best regards from Belgium, I love you all!
[Android Software Development] kai456789:
CAN HELP ME compile TWRP FOR sharp aquos s2

TKS！
[Android Software Development] pix106:
Thanks for sharing, i keep this for my kernel build tries :)

A built from sources kernel can be customized, but IMHO, and as i read it here a few times, for TWRP a prebuilt kernel can be enough.

Of course if it boots with it, with SELinux made permissive if needed, with BOARD_KERNEL_CMDLINE.

Maybe that's not possible with your device kernel... but it can be tried easy, easier than building a kernel :)

Cheers !
[Android Software Development] ashyx:
Nope, Samsung kernels force Selinux to enforcing. The kernel command line will be ignored as the bootloader command line overrides it.
[Android Software Development] Sands207:
Is there any way to force the kernel to be permissive?
[Android Software Development] pozidrivphil:
As ashyx said, the TWRP build flags and cmdline arguments weren't enough. I compiled my kernel (nothing changed to selinux) and used that image instead of the kernel image I extracted from the stock recovery.img. Lo and behold, I could mount the different partitions and a sdcard!!!

Thanks ashyx, I'd never have figured this out alone.

However, talking with TWRP through adb still doesn't work..

I'm now compiling with the always force flag set to false..

On another note, is it still possible to extract the system partition from one phone, tar and md5 it and flash it with odin to another phone?
[Android Software Development] ashyx:
Make sure MTP in twrp is disabled to use adb.
[Android Software Development] pozidrivphil:
I tried messing with MTF, but the problem is that windows doesn't recognize the usb device. Linux pretends nothing's connected at all. So I think there is something wrong with how TWRP presents itself to the pc.
[Android Software Development] _that:
Are you sure you did an -eng build, as suggested in the OP?

If yes, check if adbd is running, check getprop sys.usb.config, read init.recovery.usb.rc to see how it is supposed to work.
[Android Software Development] pozidrivphil:
At lunch, I selected 7. omni_xcover4lte-eng

After which it does give me a warning:

WARNING: device/samsung/xcover4lte/omni.dependencies file not found
[Android Software Development] DodoGTA:
That's OK in this case
[Android Software Development] pozidrivphil:
_that'll be for tomorrow ;) I wonder how those files could've gotten messed up, is this a problem with the compiling of the kernel (toolchain,..), or a twrp compile problem (like device tree stuff,..)

Reminder: my vendor folder is empty, still don't know what that is supposed to do?
[Android Software Development] pozidrivphil:
check getprop sys.usb.config, gives me "mtp,adb"
[Android Software Development] bigsupersquid:
sorry to beat a dead horse here, but I finally found a flag that worked for me again, if you want to give it a try.

BOARD_NEEDS_LZMA_MINIGZIP := true