yashsingh1/xdaforums huggingface dataset:
[Android Software Development] _that:
That's the source for the HAL module that loads and uses libQSEEComAPI.so. It might work as a replacement for the binary one, but you still need libQSEEComAPI.so and its dependencies.

To find dynamic library dependencies I wrote a script a while ago, maybe someone finds it helpful: https://github.com/that1/ldcheck/blob/master/ldcheck (it doesn't magically figure out what's loaded via dlopen and dlsym though).
[Android Software Development] Surge1223:
Since we're sharing tricks of the trade, I see your readelf script and offer patchelf as another way. I don't have a ndk build script but it was easy to configure with both host and target for android, so instead i figured id attach my configure line. Source is 0.10.

$ ./configure --host=aarch64-linux-android target=aarch64-linux-android --prefix=/data/toolchain --disable-shared --enable-static --disable-option-checking CFLAGS='-O2 -DARM64 -fPIC -I/opt/androideabi/include' LDFLAGS='-static -L/opt/androideabi/sysroot/usr/lib -I/opt/androideabi/sysroot/usr//include -lc -lgcc -ldl -lm -lc++_static -llog' CC=aarch64-linux-android-gcc CXX=aarch64-linux-android-g++

Few notes:

for the libs i have in ld libs (-lc -lgcc -ldl -lm -lc++_static -llog), I used aosp build system versions ($OUT/obj/STATIC_LIBRARIES/) and replaced ndks (in instances where they already existed) and after configuring, i just changed to the src dir and compiled manually

e.g.

$ aarch64-linux-android-g++ -static -L$SYSROOT/usr/lib -fPIC patchelf.cc -o patchelf
[Android Software Development] morfikov:
Thanks for the tool.

What about these options? Here's more info.

BOARD_USES_QCOM_HARDWARE := true
TW_TARGET_USES_QCOM_BSP := true

What is needed to build the TWRP image with these options?
[Android Software Development] morfikov:
I have another question.

Basically in the /system/build.prop file of the stock firmware, there are the following entries:

ro.product.model=Neffos Y5
ro.product.brand=Neffos
ro.product.name=TP802A
ro.product.device=Y5
ro.product.manufacturer=TP-LINK

So what should the device tree path look like in this case?

device/tp-link/y5/
device/TP-LINK/Y5/
device/tp-link/tp802a/
device/TP-LINK/TP802A/
[Android Software Development] MSe1969:
TWRP build error using omni minimal-manifest-twrp

Hello experts,

I am trying to build TWRP for osprey device using the omni manifest from above URL. I am getting the following errors, all related to omni project android_system_core:

n file included from system/core/healthd/healthd_mode_android.cpp:19:0:
system/core/healthd/healthd.h:20:43: fatal error: batteryservice/BatteryService.h: No such file or directory
#include <batteryservice/BatteryService.h>
^
compilation terminated.
In file included from system/core/healthd/healthd.cpp:20:0:
system/core/healthd/healthd.h:20:43: fatal error: batteryservice/BatteryService.h: No such file or directory
#include <batteryservice/BatteryService.h>
^
compilation terminated.
build/core/binary.mk:706: recipe for target '/mnt/storage/Android/twrp-o/out/target/product/osprey/obj/EXECUTABLES/healthd_intermediates/healthd.o' failed
make: *** [/mnt/storage/Android/twrp-o/out/target/product/osprey/obj/EXECUTABLES/healthd_intermediates/healthd.o] Error 1
make: *** Warte auf noch nicht beendete Prozesse...
build/core/binary.mk:706: recipe for target '/mnt/storage/Android/twrp-o/out/target/product/osprey/obj/EXECUTABLES/healthd_intermediates/healthd_mode_android.o' failed
make: *** [/mnt/storage/Android/twrp-o/out/target/product/osprey/obj/EXECUTABLES/healthd_intermediates/healthd_mode_android.o] Error 1
system/core/healthd/healthd_mode_charger.cpp:36:43: fatal error: batteryservice/BatteryService.h: No such file or directory
#include <batteryservice/BatteryService.h>
^
compilation terminated.
build/core/binary.mk:706: recipe for target '/mnt/storage/Android/twrp-o/out/target/product/osprey/obj/EXECUTABLES/healthd_intermediates/healthd_mode_charger.o' failed
make: *** [/mnt/storage/Android/twrp-o/out/target/product/osprey/obj/EXECUTABLES/healthd_intermediates/healthd_mode_charger.o] Error 1

Any suggestions on what needs to be corrected are appreciated.

Thanks in advance, M
[Android Software Development] kirito9:
Use the manufacturer and name.
[Android Software Development] morfikov:
Yes, but should I use lower case characters in the names? So TP-LINK or tp-link?
[Android Software Development] kirito9:
Yup, lower case. tp_link. I'm not to sure if hyphens work.
[Android Software Development] MSe1969:
Hi _that,

thanks for your reply; I am however not sure, that I am really getting your point:

Yes, I do have frameworks/native (as it is part of the minimal manifest) and yes, frameworks/native/include/batteryservice/BatteryService.h exists in my tree.

However, I am getting the shown build error.

I am not an expert on how the whole plays together, to me it somehow seems, that a file system/core/include/batteryservice/BatteryService.h is expected, which is not present and hence the error. . .

Any advice how I should fix it?

Thanks, M
[Android Software Development] Surge1223:
Check to see the Android.mk file in question has the below for the module in question

might want to even add the below if it's needed more (probably not)

LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_C_INCLUDES)
[Android Software Development] _that:
Yes, this should help, but why is it not needed when compiling the ROM?

If I understood the build system correctly, either the library is supposed to define LOCAL_EXPORT_C_INCLUDE_DIRS so that all users of the library get the include path automatically (but libbatteryservice apparently doesn't), or the user of the library needs to add it to LOCAL_C_INCLUDES.
[Android Software Development] MSe1969:
Thanks, that brought me one step further, but now comes this error:

make: *** No rule to make target '/mnt/storage/Android/twrp-o/out/target/product/osprey/obj/STATIC_LIBRARIES/libbatteryservice_intermediates/libbatteryservice.a', needed by '/mnt/storage/Android/twrp-o/out/target/product/osprey/obj/EXECUTABLES/healthd_intermediates/LINKED/healthd'.

Regards, M
[Android Software Development] morfikov:
So I did it finally :D

https://github.com/morfikov/android_device_tp-link_tp802a

https://github.com/morfikov/android_device_tp-link_tp801a

But I think I still have some work to do, for instance this, and of course I have to find out how to compile the recovery image with BOARD_USES_QCOM_HARDWARE and TW_TARGET_USES_QCOM_BSP .
[Android Software Development] ashyx:
I had this issue and IIRC you need to add this repo:

https://github.com/omnirom/android_device_qcom_common

But I now dont bother with those flags and I never have an issue.
[Android Software Development] Surge1223:
Well to be honest, I'm not sure, I haven't compiled just TWRP in a while but id imagine it would work if you say, cd'd into the recovery directory and typed mma, but if you type make bootimage, or whatever the target was, I'm not sure if it will grab all dependencies like that. (I mean I'm just thinking out load this is just speculation)

The only other thing I can think of, that I encountered myself was the order of LOCAL_STATIC_LIBRARIES required by a module, I had an error once that was somewhat similar and it was because of the order I had liblog and libziparchive in.

I guess I wasn't too worried because I know that a lot of modules, especially ramdisk files like init, and adb for target (when it was still buildable in default android tree) set flags and includes depending on if you're building eng, userdebug, user etc, and also I know people build on all different tags so their /system/core could be on master or another tag, I guess you never know lol.

Unless of course TWRP now requires a manifest?

Hmm is this not defined in your Android.mk for healthd?

LOCAL_STATIC_LIBRARIES += libbatteryservice
[Android Software Development] morfikov:
I added the following to the omni-twrp-6.0/.repo/local_manifests/local_manifest.xml file:

<remove-project path="device/qcom/common" name="android_device_qcom_common" remote="TeamWin" revision="android-6.0" />
<project path="device/qcom/common" name="android_device_qcom_common" remote="omnirom" revision="android-6.0" />

But it didn't change anything and still the build fails. Should I make some other changes to the device config files in order to make it work?

BTW: when I add/delete some repos using the local_manifest.xml file, should I add some info about that to some file?
[Android Software Development] Captain_Throwback:
The build fails how?
[Android Software Development] morfikov:
When I use the minimal OMNI source and add:

BOARD_USES_QCOM_HARDWARE := true

I get this:

make: *** No rule to make target '/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libbatteryservice_intermediates/export_includes', needed by '/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/EXECUTABLES/healthd_intermediates/import_includes'. Stop.
make: *** Waiting for unfinished jobs....

When I add this:

TW_TARGET_USES_QCOM_BSP := true

I get this:

bootable/recovery/minui/graphics_overlay.cpp:35:10: fatal error: 'linux/msm_mdp.h' file not found
#include <linux/msm_mdp.h>
^
target StaticLib: libdrm (/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libdrm_intermediates/libdrm.a)
target asm: libpng <= external/libpng/arm/filter_neon.S
1 error generated.
build/core/binary.mk:706: recipe for target '/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libminui_intermediates/graphics_overlay.o' failed
make: *** [/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libminui_intermediates/graphics_overlay.o] Error 1
make: *** Waiting for unfinished jobs....

After changing the manifest and adding the suggested repo, this flag:

BOARD_USES_QCOM_HARDWARE := true

results in:

make: *** No rule to make target '/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libbatteryservice_intermediates/export_includes', needed by '/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/EXECUTABLES/healthd_intermediates/import_includes'. Stop.
make: *** Waiting for unfinished jobs....

And adding this:

TW_TARGET_USES_QCOM_BSP := true

gives this errror:

bootable/recovery/minui/graphics_overlay.cpp:35:10: fatal error: 'linux/msm_mdp.h' file not found
#include <linux/msm_mdp.h>
^
target StaticLib: libdrm (/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libdrm_intermediates/libdrm.a)
target asm: libpng <= external/libpng/arm/filter_neon.S
1 error generated.
build/core/binary.mk:706: recipe for target '/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libminui_intermediates/graphics_overlay.o' failed
make: *** [/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libminui_intermediates/graphics_overlay.o] Error 1
make: *** Waiting for unfinished jobs....

So no matter what repo I use, there's no difference in the building process. That's why I asked whether some additional steps are required in order to make it work. Or maybe some other repo is missing?
[Android Software Development] ashyx:
You can probably bypass the missing file error by changing :

#include <linux/msm_mdp.h>

To

#include "linux/msm_mdp.h"

I'll have to come back on the other errors because it's been some time since I had that issue so will need to look over my sources to see if I can figure out what it was that solved it.
[Android Software Development] morfikov:
No. It also fails:

bootable/recovery/minui/graphics_overlay.cpp:35:10: fatal error: 'linux/msm_mdp.h' file not found
#include "linux/msm_mdp.h"
^
1 error generated.
target thumb C: libpng <= external/libpng/pngerror.c
build/core/binary.mk:706: recipe for target '/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libminui_intermediates/graphics_overlay.o' failed
make: *** [/media/Kabi/Android/omni-twrp-6.0/out/target/product/tp802a/obj/STATIC_LIBRARIES/libminui_intermediates/graphics_overlay.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes. Stop.
[Android Software Development] _that:
You only want to use TW_TARGET_USES_QCOM_BSP to enable overlay graphics if you can't get a display with the standard fbdev graphics code. And if you define it, you need to build the kernel from source together with the recovery, or TARGET_CUSTOM_KERNEL_HEADERS must be pointing to the include directory for the kernel headers. Or you need to fix minui/Android.mk and replace $(commands_recovery_local_path)/minui/include with $(commands_recovery_local_path)/minui.old/include.
[Android Software Development] morfikov:
OK, so I don't really need that option.
[Android Software Development] mustang_ssc:
Don't want to repeat this but can please anyone help a bit with this guys?

Link to the original post: 2746
[Android Software Development] ashyx:
Build it with the KITKAT branch of OMNI not CM 14.1.

You can use the minimal manifest if you don't want to download the whole source.

Your stock kernel and DT.img should be fine.
[Android Software Development] mcvisster:
One request. We on Galaxy A5 (2017) SM-A520F are having trouble with TWRP it`s not fully functional (... unable to mount). ON TREAD IT SAYS "fully working" but it`s not (you can see that if you scroll bit down). We dont know how to fix it so PLEASE if someone with bit more knolige could help TNX.

https://xdaforums.com/samsung-a-series-2017/how-to/samsung-sm-a520f-2017-kernel-source-t3557622
[Android Software Development] NepoRood:
The above post reminds me of something I've been meaning to ask:

What would cause TWRP forever to boot? Large data partition? I have it on several devices, some I've made myself, others by, well, others. But, on my phone, it takes a good 2-3 minutes to boot...

Any insight would be appreciated :good:
[Android Software Development] Android-Andi:
Recovery.IMG to big for recovery partition caused endless twrp logo on my devices in the past.

Gesendet von meinem A0001 mit Tapatalk
[Android Software Development] _that:
There's a big difference between "2-3 minutes" and "forever". A known reason for slow TWRP startup is an f2fs filesystem with a lot of files. For some reason, the f2fs implementation of the "stat" syscall is extremely slow. Even "ls -l" is slow on those devices (in a dir with many files).
[Android Software Development] m.ksy:
Hi! My device (Motorola Droid X) supports only fakeflash recovery. For CWM Recovery to build it I use "make -j# recoveryzip". Does TWRP support fakeflash building?
[Android Software Development] Ryuinferno:
Yes, but no point as you need a modded init.rc with the custom path included...
[Android Software Development] gls9:
I'am a little confused about specifying device in recovery.fstab.

If I look at a few recovery.fstab in different recovery's (MTK device) I see devices for /data as:

- /emmc@usrdata

- /dev/block/mmc.....

What is the differences ?

Will both work in TWRP ?

Which one is preferable ?
[Android Software Development] cruizz:
hi... i am able to build twrp and able to use adb ,but after flash twrp the screen always blinking, i've follow the OP instruction...anyone can give advice? :)
[Android Software Development] ne0zone75:
[Q] Building TWRP 2.7 from CM 10.2 / 11 ... [TF300T]

[MENTION=912474]Dees_Troy[/MENTION]

Hello,

I'm trying to build latest TWRP from official GitHub repository with CM 10.2 /11 sources ... it builds correctly but the recovery file is deleted automatically at the end of the compilation process because it's too big :

error: ... CyanogenMod/system/out/target/product/tf300t/recovery.img too large (8845416 > [8650752 - 88704])

-> kernel size is : 5.4 MB

-> recovery ramdisk size is : 3.5 MB

With Omni 4.3 /4.4 sources it builds correctly ...

Can you explain how can i reduce output recovery file size when building from CM sources please ?

NB : Where can i find a complete list of TWRP build flags because i'd like to port the recovery to LG Optimus Fx series [3, 5, 6 & 7] when CM sources will be ready for these devices (someone has a WIP for this ...)

Thank you so much for taking care about my questions ;)
[Android Software Development] Dees_Troy:
The /emmc@userdata notation is something that MTK did. TWRP is not programmed to use this method. I could probably make it work but I see no reason to use MTK's bastardized methods when /dev/block/mmblk0p## works just fine.

While the TWRP screen is blinking, adb pull /tmp/recovery.log and take a look at the log. It will probably give you clue as to what is wrong. If you can't figure it out, post the log.

You can reduce the size of the kernel by changing the defconfig for the kernel. Most kernels use gzip which is fast but not very efficient in terms of size. XZ will probably offer the smallest kernel size and can easily save 1 or 2MB of space.

The first post of this thread documents most of the TWRP build flags and how to format your fstab.
[Android Software Development] gls9:
Actually I saw this used in a TWRP 2.5.0.0 recovery image. So probally it is or was already working.

No reason to make this work. Was just curious about this.
[Android Software Development] ne0zone75:
I did manage to use XZ compression for the kernel ... then rebuilt CM 10.2 -> now TWRP builds correctly along with CM sources :) and CM also !

Thank you for your assistance :thumbup:

Tapatalked from my TF300T
[Android Software Development] ne0zone75:
[Q] Building TWRP 2.7 along with CM sources ... [TF300T] ... continued ...

Hello,

As i said yesterday, TWRP now builds successfully for me from CM 10.2 / 11 sources for my TF300T AND GT-I9195 : :cool:

-> TF300T : the recovery is not working as it is intended to because boot and recovery partitions do not show up ! It is not coming from the recovery's fstab because i've extracted the file from a working blob downloaded over the TeamWin official website ... :confused:

TWRP build flags :

HAVE_SELINUX := true
TARGET_RECOVERY_FSTAB := device/asus/tf300t/ramdisk/twrp.fstab
DEVICE_RESOLUTION := 1280x800
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true
TW_NO_USB_STORAGE := true
TW_NO_REBOOT_BOOTLOADER := true
TW_NO_REBOOT_RECOVERY := true
TW_INCLUDE_JB_CRYPTO := true

TW_INTERNAL_STORAGE_PATH := "/data/media"
TW_INTERNAL_STORAGE_MOUNT_POINT := "data"
TW_EXTERNAL_STORAGE_PATH := "/external_sdcard"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "external_sdcard"

TW_CRYPTO_FS_TYPE := "ext4"
TW_CRYPTO_REAL_BLKDEV := "/dev/block/mmcblk0p8"
TW_CRYPTO_MNT_POINT := "/data"

TW_CRYPTO_FS_OPTIONS := "data=ordered,delalloc"
TW_CRYPTO_FS_FLAGS := "0x00000406"
TW_CRYPTO_KEY_LOC := "footer"
TWRP_CUSTOM_KEYBOARD := ../../../device/asus/tf300t/recovery/hardwarekeyboard.cpp

TWRP fstab :

/system	ext4	/dev/block/mmcblk0p1
/cache	ext4	/dev/block/mmcblk0p2
/misc	emmc	/dev/block/mmcblk0p3
/staging	emmc	/dev/block/mmcblk0p4
/data	ext4	/dev/block/mmcblk0p8	ignoreblkid;length=-16384
/recovery	emmc	/dev/block/mmcblk0p9
/boot	emmc	/dev/block/mmcblk0p10
/external_sdcard	vfat	/dev/block/mmcblk1p1	/dev/block/mmcblk1	flags=display="microSD Card";storage;wipeingui;removable
/sd-ext	ext4	/dev/block/mmcblk1p2

Any ideas why these two partitions do not show up ?

The strange thing is that i proceeded the same way for my GT-I9195 and TWRP is working fine for this second device ...

-> GT-I9195 : Everything is working :victory: ... except one little thing :

i cannot set correctly the timezone for the recovery

... i can set it BUT it does not update correctly the time of the device ...

So, you may say : "Why don't you stick with official TWRP 2.5 which is working perfectly for the TF300T ???" The only feature that is not available in 2.5 and is present in 2.6 (official versions) is the ability to wipe internal storage AND i find it very usefull ... BUT 2.6 has the same issue than my own build : boot / recovery partitions not showing up !

scanno's TWRP build for the TF300T (KK compatible) has almost everything working : backing up, restoring and installing BUT installing is working only for KK ROM's, the JB ROM's i tried to flash using it failed ! (installing the zip that failed with scanno's build can flash successfully through official TWRP 2.5 ... i'm very :confused:)

Does anybody can help me for these two issues please,

Have a nice day
[Android Software Development] cruizz:
thanks for reply my question...here my recovery.log, :)
[Android Software Development] gls9:
Can you tell what you exactly did to archive this ?

(what to change where)
[Android Software Development] ne0zone75:
It's an easy thing ... open up a terminal in the root of your android working directory, then issue this command (after replacing 'your device's codename' by your real device codename, like 'serranoltexx' and without the quotes for the Galaxy S4 Mini ...) :

find ./ -name BoardConfig*.mk | grep device | grep 'your device's codename'

Open up this file in a text editor and find the line matching :

TARGET_KERNEL_

There are two line matching this string in general :

TARGET_KERNEL_SOURCE := 'a defconfig files base directory path'
TARGET_KERNEL_CONFIG := 'a defconfig filename'

TIP : To quickly get your device's defconfig files full directory path, just type this inside a terminal still from the root of your working directory :

find ./ -name configs | grep arm

Congratulations, you have successfully identified the name and location of your device's defconfig kernel configuration file :highfive:

Open up this file also in a text editor and search for the string :

CONFIG_KERNEL_

... you'll have three lines matching inside it like this :

CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_LZO is not set

this means gzip is active for kernel compression ... just change to :

# CONFIG_KERNEL_GZIP is not set
CONFIG_KERNEL_LZMA=y
# CONFIG_KERNEL_LZO is not set

to activate xz one for saving kernel filesize :good:

IMPORTANT NOTE : when modifying the defconfig file for your device, saving the modifications AS a custom defconfig file (by changing it's name in the same location) is a safe option BUT do not forget to update the defconfig filename in the first file (*.mk one) AND before modifying the *.mk file you can copy it first in a safe place ... just in case ...

Be well ...

EDIT : if you can't find the 'TARGET_KERNEL_' string inside the *.mk file, it's the wrong one ! So issue this command instead of the one above :

find ./ -name BoardConfig*.mk | grep device | grep 'your device's brand'

... where 'your device's brand' is 'samsung' ... still without the quotes ... for example !

It will return more than one *.mk file and you've just already opened one of them; open up the others untill you find the 'TARGET_KERNEL_" string ... then follow the remaining instructions !
[Android Software Development] v_superuser:
Hello,

I followed the guide and compiled TWRP 2.7 for my device. It got compiled successfully but flashing it gave me the following error -

sending 'recovery' (5774 KB)...
OKAY [ 1.110s]
writing 'recovery'...
FAILED (remote: image update error)
finished. total time: 1.123s

I used a 4.4 based device tree, maybe that caused the error? :confused: Somebody help me with this, please. :)
[Android Software Development] thewisenerd:
Hi there!

The answer to your question lies above your question itself. The recovery is large, and ain't fitting into recovery partition.

I think we gotta use some other kernel compression, or try removing some stuff from the kernel (which I wouldn't recommend though)...

I got Omni sources, so, TWRP 2.6.3.0 is the correct version, I guess...

Good luck with your builds too :)
[Android Software Development] v_superuser:
I already got the solution and currently compiling. :p
[Android Software Development] hell_lock:
Hello guys. I am trying to build twrp for Desire X and I am facing some visual problems over here. First of all, the UI is going out of the screen(little bit) and whenever I touch something it fits the screen, when I release the touch it goes to the previous bugged state. The next problem which I am facing is the orange UI. I guess twrp is in blue colour right? :p
[Android Software Development] AbduL_PT:
Change pixel format and resolucion

Sent from my mobile
[Android Software Development] hell_lock:
Resolution is fine.