yashsingh1/xdaforums huggingface dataset:
[Android Software Development] _that:
From what I've heard: Busybox doesn't build and/or work properly on newer Android runtimes, and toybox was considered mature enough to replace it in TWRP. I can try to find more detailed information what the exact problems are/were in the next few days.

It has been known for a long time that installers should call the recovery-supplied binaries directly by their name (or symlink) instead of calling the busybox main program. If an installer insists on using busybox, they have to ship it in the zip.
[Android Software Development] SachinBorkar:
I have full crDroid source codes.

I replaced crDroid/bootable/recovery with TWRP source.

But I don't have idea what next to do ?
[Android Software Development] RebelLion_:
With your suggestion made I'm now getting a flex error:

[ 93% 5919/6322] Lex: checkpolicy <=...selinux/libsepol/cil/src/cil_lexer.l
FAILED: /bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -o/home/rebellion/recovery/twrp/out/host/linux-x86/obj/STATIC_LIBRARIES/libsepol_intermediates/cil/src/cil_lexer.c external/selinux/libsepol/cil/src/cil_lexer.l"
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
[Android Software Development] shoey63:
Swap it with the flex in your Linux distro. Rename accordingly.
[Android Software Development] RebelLion_:
How do I do that? Sorry, I've only built kernels standalone before so device trees are new to me
[Android Software Development] Android-Andi:
Is it installed?

apt-get install flex
[Android Software Development] RebelLion_:
Yes it is. I just don't know how to swap it in the build. I did search it though and found some github commits that showed me how to I think. It's just an if/else statement added to the flex Makefile, maybe it will work
[Android Software Development] shoey63:
I'm taking about a straight c+p from usr/bin/flex (or wherever it is) to... prebuilts/misc/linux-x86/flex/flex-2.5.39 in your build repo
[Android Software Development] _that:
Reading the makefiles (config.mk), a less intrusive fix seem to be to set FLEX_EXEC=/usr/bin/flex in the environment.
[Android Software Development] RebelLion_:
That's way easier, thanks for the tip, and I think it worked. It got past 93% and I'm waiting for it to sign test keys now and see if it boots
[Android Software Development] ianmacd:
Well, BusyBox doesn't compile in the android-9.0 branch by default, because it's not there by default. I don't know whether the build system is supposed to fetch BusyBox if it's not available, but that's certainly not happening at the moment.

If I manually integrate it, however:

git clone --branch android-9.0 git@github.com:TeamWin/android_external_busybox.git busybox

then it compiles and is included in TWRP as expected.

That said, if Toybox is the future, that's fine by me. I have no stake in this. I just want to produce TWRP builds that are in line with current recommendations and practices.

Thanks. The wisdom of the advice is obvious and I'll continue to give it.
[Android Software Development] _that:
It's not fetching it automatically, but you can tell it to: add it to your local manifest.

I asked in #twrp about the Busybox situation. CaptainThrowback told me that the since the default C/C++ compiler has changed from gcc to clang in recent Android versions, busybox does compile but the resulting binary has a non-working shell. And due to a question in another channel I noticed that without Busybox we no longer have a vi implementation in TWRP. Not critical but it was nice to have an editor in TWRP.
[Android Software Development] ianmacd:
Valuable information. Definitely a shame about vi, though.
[Android Software Development] AnantaSrikar:
Hey could anybody teach me how to make my own device source code......kind of a noob here. Pls help me. I'm trying to build twrp for a device that doesn't have twrp
[Android Software Development] Android-Andi:
Take a look at device source of devices with same/similar hardware.
[Android Software Development] AnantaSrikar:
Yeah, I got a device with similar specs , but what to do after that?
[Android Software Development] matteo0026:
Hi guys, I tried to update from nougat to oreo sources official twrp for yamcha (bq aquaris u2), but I get always decryption error at boot. These are the edited sources that I forked from teamwin github page: https://github.com/matteo0026/android_device_bq_yamcha

(to be more clear, last commit which I wrote "fix decrypt on boot" didn't fix the issue)

So, what do you think should I edit on these sources for making everything working?
[Android Software Development] DiamondJohn:
Read, search the web, read some more, search the web, read, set up a build environment, read, try, read, come here with specific questions (this whole thread is about helping people build TWRP), read, search the web, read, try and repeat... but not in that order.
[Android Software Development] AnantaSrikar:
It would be nice if u could show me where to start off......... I really have anlmost no clue on making device source. Thanks :)
[Android Software Development] DiamondJohn:
Are you seriously asking me how to do a web search?

https://www.google.com/search?sourc........6..35i39j0i131j0j33i22i29i30.cEak28-hccs

and I think the first few posts of the following thread also has some instructions

https://xdaforums.com/chef-central/android/guide-android-rom-development-t2814763

I am lucky enough to have built for devices that already have a device tree or have one for an almost identical device. ie I have never had to do it myself, so do not know the actual details, I would have to search read read etc etc etc
[Android Software Development] Magendanz:
I have a TWRP build that's hanging on the splash screen, and I'd like to pull the logs from /cache/recovery to determine what's going wrong. Unfortunately, Magisk installs to the recovery partition of this device, so my only way to get root to read those files is by restoring the patched stock recovery...which then ends up overwriting the TWRP logs.

Anyone know of a trick to pull those logs on devices with Magisk in recovery?
[Android Software Development] DiamondJohn:
Just a guess, but maybe boot to a working recovery using fastboot:confused:

never done it myself:

fastboot boot twrp.img
[Android Software Development] matteo0026:
Up...
[Android Software Development] _that:
When you see the TWRP splash screen, adbd is already running and you can directly do adb pull /tmp/recovery.log .
[Android Software Development] _that:
There is a reason why nobody answered your original question. Getting decryption working in TWRP is hard even for experienced developers, because there are so many device-dependent and OS-version-dependent variants. You didn't show any signs of effort to solve your problem yourself. You didn't even include remotely enough information for others to even start investigating, e.g. TWRP and logcat logs, info about your Android OS and versions, if decryption ever worked before, research how encryption has changed with the Android update, etc.
[Android Software Development] Magendanz:
So, this wasn't strictly true at the time that I first posted, but with a few tweaks to the BoardConfig.mk I've got miniadbd up and running. I now have root shell access in TWRP and can pull whatever I need. Thanks!
[Android Software Development] _that:
Good work! Getting ADB access working should always be the first step when bringing up TWRP on any device.
[Android Software Development] Magendanz:
I've been banging my head against this build for 2019 Samsung Galaxy Tab A 10.1 [SM-T510/T515] all day and have still been unable to get past the splash screen, despite having ADB access and no obvious problems poking through logs with root shell access. I'd be grateful for any insights.

Here's the recovery.log:

Starting TWRP 3.3.1-0-ae7ff3b2 on Sun May 26 09:24:49 2019
(pid 3338)
TW_NO_REBOOT_BOOTLOADER := true
I:Lun file '/sys/class/android_usb/android0/f_mass_storage/lun0/file' does not exist, USB storage mode disabled
TW_HAS_DOWNLOAD_MODE := true
TW_INCLUDE_CRYPTO := true
I:TW_BRIGHTNESS_PATH := /sys/class/backlight/panel/brightness
I:Found brightness file at '/sys/class/backlight/panel/brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 15300
I:LANG: en
I:TW_NO_LEGACY_PROPS := true
Starting the UI...
setting DRM_FORMAT_ABGR8888 and GGL_PIXEL_FORMAT_BGRA_8888, GGL_PIXEL_FORMAT may not match!
cannot find/open a drm device: No such file or directory
fb0 reports (possibly inaccurate):
vi.bits_per_pixel = 32
vi.red.offset = 16 .length = 8
vi.green.offset = 8 .length = 8
vi.blue.offset = 0 .length = 8
setting GGL_PIXEL_FORMAT_BGRA_8888
double buffered
framebuffer: 0 (1200 x 1920)
Using fbdev graphics.
I:TWFunc::Set_Brightness: Setting brightness control to 15300
I:Loading package: splash (/twres/splash.xml)
I:Load XML directly
I:PageManager::LoadFileToBuffer loading filename: '/twres/splash.xml' directly
I:Checking resolution...
I:Scaling theme width 1.111111x and height 1.000000x, offsets x: 0 y: 0 w: 0 h: 0
I:Loading resources...
I:Loading variables...
I:Loading mouse cursor...
I:Loading pages...
I:Loading page splash
I:Switching packages (splash)
=> Linking mtab
=> Processing /etc/recovery.fstab
I:Reading /etc/recovery.fstab
I:Processing '/cache'
I:Processing '/efs'
I:Created '/efs' folder.
I:Processing '/cpefs'
I:Created '/cpefs' folder.
I:Processing '/product'
I:Created '/product' folder.
I:Processing '/system'
I:Created '/system' folder.
I:Processing '/vendor'
I:Created '/vendor' folder.
I:Processing '/data'
I:Processing '/boot'
I:Processing '/recovery'
I:Processing '/misc'
I:Processing '/external_sd'
I:Created '/external_sd' folder.
I:Processing '/usb-otg'
I:Created '/usb-otg' folder.
I:Done processing fstab files
I:File Based Encryption is present
e4crypt_initialize_global_de
calling retrieveAndInstallKey
Key exists, using: /data/unencrypted/key

Why would the TWRP GUI not be displayed here?

UPDATE: The issue was that it was balking on Samsung's file-based encryption. Once I updated the fstab in the vendor partition and wiped data with stock recovery, TWRP launched fine. I'm guessing that last line in the log was the problem. (Why would it load a key from a partition it knows is encrypted?)
[Android Software Development] AnantaSrikar:
Ok thanks..... Hope I learn it ASAP :good:
[Android Software Development] morfikov:
TWRP builds/flashes/boots well, but it looks like that most of the time the phone boots, the screen doesn't respond to any touches. It was working well in the previous version of TWRP (3.2.1). Since the issue is sill in 3.3.1.0, I think I have to look deeper and maybe debug this somehow because probably no one else is experiencing this problem.

Basically all things work well except the touch screen. I can log via adb but after around 10min the phone automatically reboots into recovery. Sometimes I manage to unfreeze the screen, but I don't know what triggers it. When the screen works, the recovery mode works as it should (all other options work well). When I reboot manually to recovery again, it also work, but when I boot into the system and then reboot to recovery, the screen freezes again.

I haven't seen any errors in the recovery log, except these, but I don't think they're responsible for the issue:

# cat /sdcard/recovery.log | grep -i err
I:Failed to load image from indeterminate013, error -1
I:Loading page filemanagerrenamefile
I:Loading page filemanagerrenamefolder
E:[MTP] request read returned -1, errno: 5, exiting MtpServer::run loop
E:[MTP] request read returned -1, errno: 5, exiting MtpServer::run loop

So how to debug the issue and fix it?
[Android Software Development] Magendanz:
I notice that the BoardConfig.mk for some newer devices don't include a section that defines the partition sizes. Is this no longer required?
[Android Software Development] DarkAngelGR:
I tried to build and I got error "libvold depends on undefined module libcrypts_hw" in system/gold/Android.bp:88

Update

I managed to build the recovery.IMG but when I flashed it and reboot to recovery I get a small screen with some commands in the top and a log at the bottom. I get installation failed cause it can't mount sdcard. Anyone knows why did that happen? I used a small DT that works with OFRP, PBRP recoveries
[Android Software Development] Magendanz:
On Android Pie with system-as-root, should't TWRP be mounting the system partition to "/"?

All the fstabs that I've seen so far still mount it to "/system", which requires the scripts to look in "/system/system". Seems a little counterintuitive.
[Android Software Development] DarkAngelGR:
I used androif-9.0 branch to compile and the recovery.img isn't working. I tried android-8.1 and the compilation won't even start. Should I use other branch, if yes which?
[Android Software Development] _that:
I must have missed your initial post where you provided all the relevant details like Android tree, device, etc., and I didn't find it on the last 3 pages - can you link to that again?
[Android Software Development] Harishwarrior:
external/busybox/Android.mk: warning: busybox: Bad LOCAL_ADDITIONAL_DEPENDENCIES: busybox_links

external/busybox/Android.mk: error: busybox: LOCAL_ADDITIONAL_DEPENDENCIES must only contain paths (not module names)

build/make/core/base_rules.mk:116: error: done.

14:51:30 ckati failed with: exit status 1

i have cloned the busybox to external/busybox i am getting this error
[Android Software Development] DarkAngelGR:
Sorry for that, my device is Redmi 4 Prime (markw)

I repo synced android-9.0 branch of omnirom

Device tree https://github.com/DarkAngelGR/recovery_markw_dt

Kernel tree https://github.com/DarkAngelGR/olympian_kernel/tree/Zeus

I thought that I had used wrong branch of omnirom so I tried android-8.1 as well but I didn't compile it
[Android Software Development] fawazahmed0:
In case anyone is trying to build twrp from lineage, here are the steps

cd bootable

git clone https://github.com/omnirom/android_bootable_recovery.git recovery-twrp -b android-9.0

cd ..

export RECOVERY_VARIANT=twrp (or save it in boardconfig.mk like RECOVERY_VARIANT := twrp)

Backup and delete the recovery folder

create symlink 'ln -s recovery-twrp recovery'

Now compile , there won't be any build error
[Android Software Development] senseijtitus:
Is there a specific guide for building twrp for Samsung devices with snapdragon CPU?

I'm trying to build twrp for galaxy a70. I have the source code files with me. So how do I proceed?

Please note I am a noob...
[Android Software Development] ashyx:
The guide is as per the OP irrespective of CPU.

De-noob yourself by reading it then hitting the search button on Google.
[Android Software Development] MrHomebrew:
Hi for days now me and a few people have been trying to get a custom recovery ported to the Galaxy Tab 4 8.0 Tn330nu for example.

We have the source files for the device.

We have boot.img file pulled from thedevice

We have recovery pulled from the device

Only thing we do not have is someone to assist or possibly port twrp to the device for us.

We have been doing as much research as possible looking at guides and talking to others trying to build the resources.

We have hit a brick wall and could really use some help. We would really appreciate the time taken to make this happen. I know everyone is busy and this may not be your everyday device but it is like the Galaxy Tab 4 8.0 was forgotten and left out for development. The Galaxy Tab 3 and pro have support so it would only be right to have the same for the tab 4 8.0 t330nu.

The files I spoke of I can include or send download links if needed.

I apologise for taking up room on this thread but we really do need some assistance. I would not mind assisting in future development so this would be a great learning experience. Once I have a better understanding of the process I would gladly pass on the knowledge just hope we can find someone who is open and willing to give us a chance.
[Android Software Development] lj50036:
I would be more then happy to take a look at what you have .... :o

Link me the sources listed above and lets see what we can go ..... :highfive:

Thx Josh
[Android Software Development] MrHomebrew:
Thanks for your time much appreciated. This is what we have together right now as a start. There are 3 other variants of the Galaxy Tab 4 8.0 but as a start all these files are for and from the Galaxy Tab 4 8.0 T330nu version.

T330nu Source file download link:

http://www.4shared.com/zip/UG28maH2ce/SM-T330NU_NA_KK_Opensource.html

Boot.img dumped from device:

http://www.4shared.com/file/nOAtJQbCba/boot.html

Recovery.img dumped from device:

http://www.4shared.com/file/mSkFIM0Bce/recovery.html

Really hope this is a start and helps with the process. If there is anything we can do to further assist or help feel free to let me know or ask any questions.

Again thanks from all of us
[Android Software Development] sub77:
your T330nu Source file download link is just the kernel source. your dumped kernel and recovery is useless.

first you need a working build environment with cm11 or omnirom source for building twrp recovery.

then you have to look for matching device repos.
[Android Software Development] MrHomebrew:
Building the environment using Ubuntu Linux as we speak
[Android Software Development] lj50036:
Well the prebuild boot.img is not useless, we can use the zImage to build TWRP ...

But what is useless is putting anytime into this without a device tree ....

Thx Josh
[Android Software Development] MrHomebrew:
http://d-h.st/users/sub77/?fld_id=40793#files

---------- Post added at 05:57 AM ---------- Previous post was at 05:54 AM ----------

https://github.com/sub77/android_device_samsung_milletwifi

Thanx sub77

Only issue is recovery loop.

Loading recovery causes constant reboot and loop. We are figuring it out.
[Android Software Development] MrHomebrew:
To show it is is ext4 using partition table.
[Android Software Development] Laserman49:
Hello. Could you make it fully functionnal with Galaxy S4 I9515 please ? Because, others Custom Recovery don't recognize SD Cards, and we have no touchscreen. Thanks by advance.
[Android Software Development] h1gh1:
Hello, I would like you to make changes to TWRP for HTC Desire C - there is already official support, but there is no SELinux support, so Android 4.4 ROMs can not be flashed. I made a working port of CM11 for Desire C, and included TWRP in my build process, and it was working properly. I took previously available sources, made some modifications and recovery is working properly for a lot of users, so I would like these changes to be pulled in official recovery.

Here is the recovery thread:

http://xdaforums.com/htc-desire-c/orig-development/recovery-twrp-2-8-1-0-t2921443

Device tree:

https://github.com/high1/android_device_htc_golfu

and kernel:

https://github.com/high1/android_kernel_htc_golfu.

Regards,
[Android Software Development] Hashbang173:
Are the steps different when building TWRP for lollipop?
[Android Software Development] desalesouche:
it seems sources need more fix.i got twrp booting but my sd card and inetrnal sd are not regonized, MB =0
[Android Software Development] Hashbang173:
Can you tell me how you got it to compile? Did you use cm12, omni, etc, what command did you use to build?
[Android Software Development] desalesouche:
i used android 5.0 omni sources.

to compile it i had to use init.rc from twrp recovery folder and i had also to use my own graphic.rc file..

https://github.com/desalesouche/TWRP_device_huawei_u8860 that is older of my twrp device tree base
[Android Software Development] katinatez:
Where is the graphic.rc located, I'm on my phone right now, hard to find at the moment.

Thanks
[Android Software Development] desalesouche:
you have 2 of them .

path 1---> bootable/recovery/minuitwrp

path 2 ---> bootable/recovery/minui
[Android Software Development] katinatez:
Ok found the graphics.rc

Now are you saying you used the init.rc from omni source android-4.4? And where is the location of the init.rc? I had found it a while back but cant remember.

Thanks
[Android Software Development] desalesouche:
https://github.com/desalesouche/TWRP_device_huawei_u8860/blob/master/BoardConfig.mk#L79

check my twrp device tree and if you have similar line disable it... init.rc will be picked automatically during build.
[Android Software Development] :
on editing twrp's layout

[MENTION=912474]Dees_Troy[/MENTION]

hi, thank you for your work and effort,

i was hoping you would point me to the protion of the source i need to edit

to modify twrp's button layout. i need to replace the wipe dalvik/cache option after a rom flash

with reboot. i haven't compiled the new version yet so i don't know if the same holds true.

thank you for your time.

m
[Android Software Development] desalesouche:
any progress? :)
[Android Software Development] fawazahmed0:
It will be better to use toybox ,instead of busybox.

Add this in boardconfig.mk

TW_USE_TOOLBOX := true

Now, it will run perfectly
[Android Software Development] rINanDO:
Hi, I'm building twrp on top of LOS 16.0 for i9100. Build finishes, but the image size is 12.8mb. The official download is just 7.3mb. Anyone knows why my own build is bigger? The problem is the image doesn't fit in the recovery partition.
[Android Software Development] Commando2936:
TWRP Compilation Error

Hello this is my error : https://pastebin.com/1PUehavU

My device tree : https://github.com/CLickDev-Studio/android_device_honor_leland

My vendor : https://github.com/CLickDev-Studio/android_vendor_honor_leland

My kernel : https://github.com/penn5/android_kernel_honor_ieland

I didn't found the solution ...
[Android Software Development] _that:
The i9100 is ancient, so you need to build TWRP in an older Android tree that still has smaller runtime libraries.
[Android Software Development] vikasrmourya:
I want to build TWRP For my Yu Ace 2GB but i cant find the BoardConfig.mk file Anywhere in the rom
[Android Software Development] DiamondJohn:
You will probably have a better chance of someone helping you if you provide all the github sources for your device.
[Android Software Development] anmr2380:
greetings ..... can you please create twin recovery for Samsung Galaxy sm-a205g (a20) ...... octacore 3gb RAM 32gb internal 1 sim Android foot 9 .... thanks

Enviado desde mi SM-A205G mediante Tapatalk
[Android Software Development] The_Walking_Playground:
Hi,

BoardConfig isn't a file on your device - it's a file you create in your device tree for building with the correct parameters for your device. The easiest thing to do is find a device with the same processor and start with that BoardConfig, and then modify to reflect the specs for your device.

TWP
[Android Software Development] Android-Andi:
That's not how it works. You might want to read the first post again.
[Android Software Development] anmr2380:
thanks for your answer ....... android-andi ..... the truth is I'm new ..... if you help me and I'm on my way I'd appreciate it ..... what should I do ... like I must do it ..... I can do it ...... what tools would be needed

Enviado desde mi SM-A205G mediante Tapatalk
[Android Software Development] blakegriplingph:
I know this may sound like a rather silly question, but how do I change the build number string, e.g. from 3.3.0-0 to 3.3.0-1 to indicate an amended build for the device I'm porting TWRP to?
[Android Software Development] _that:
set TW_DEVICE_VERSION=1 in your environment when building.
[Android Software Development] Spaceminer:
Does anyone know how solve this error? I'm building twrp with some hacked together trees for the G6 Play, and omni 9.0. Looks like I'm very close to it finishing too.
[Android Software Development] ashyx:
Seems to suggest mkbootimg is missing from the home/android/jeter/out/host/linux-x86/bin directory.

You could just copy it there manually and then continue the build.
[Android Software Development] Spaceminer:
I will give it a try. I was hoping it would be that simple. I didn't want to mess up my files and have to resync. That's such a pain. You're a blessing to have around, and I appreciate your help.
[Android Software Development] AnhThi:
SM-885F samsung galaxy A8 Star not suport