yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Matt07211:
I haven't removed makefiles between my last working compile to my most recent commit.

I'll try these commands one more time.

But I've re-run these commands and even some -j1 so it would run in one thread soni could pinpoint the exact place or gets an error.

I have verifed the files are in the output you describe and also in the ramdisk (I've unpacked the recovery to check, the files look correct and don't seem malformed. )

The logs are complaining that it's unable to load into buffer, it's not complaining that it cannot find the file.

Last Commit I compiled on: https://github.com/Matt07211/androi...mmit/da8210346cd6a6b34d0538c4c3e527829413a930

Current Commit: https://github.com/Matt07211/androi...mmit/aac8cc4b1b9287fb1a545577e0b6f5a6bda40044

I believe that the binary file the loads the xml file is trying to load the xml file into memory being used/protected by the kernel.

Note: My device has a 64 Bit cpu, but running a 32 Bit instruction set (Mainly because of hardware limitations (1.5GB of ram, which is not enough space for 64 but addreses that'll be used when running an OS) I believe).

I have verified the TWRP binary files in the ramdisk are compiled as ARM, and compared it to the stock recovery binary files, which is also ARM, so I cN file out that problem.
[Android Software Development] _that:
Believe what you want, but the only error return in LoadFileToBuffer that doesn't print additional error messages is when stat() fails.
[Android Software Development] g465559090:
huawei RPA-AL00

I compiled according to Android 7 twrp, can not work properly,

When the brush into the root.zip will show system cache data partition parameters invalid

/3rdmodem	ext4	/dev/block/bootdevice/by-name/3rdmodem flags=display="3rdmodem";backup=1

/boot	emmc	/dev/block/bootdevice/by-name/boot

/recovery emmc /dev/block/bootdevice/by-name/recovery

/cache	ext4	/dev/block/bootdevice/by-name/cache

/cust ext4 /dev/block/bootdevice/by-name/cust flags=display="Cust";backup=1

/misc	emmc	/dev/block/bootdevice/by-name/misc	flags=display="Misc";backup=0

/oeminfo emmc /dev/block/bootdevice/by-name/oeminfo flags=display="OEMinfo";backup=1

/data	f2fs	/dev/block/dm-0

/system	ext4	/dev/block/bootdevice/by-name/system

/external_sd	vfat	/dev/block/mmcblk1p1	/dev/block/mmcblk1	flags=display="MicroSD Card";storage;wipeingui;removable

/usbotg	auto	/dev/block/sda1 /dev/block/sda flags=display="USB OTG";storage;removable;backup=0
[Android Software Development] Matt07211:
Okay, any Options I am able to enable that will give more debug info?

I have checked the XML file (both in the $OUT directory and unpacked the ramdisk from the recover.img) and it is there and it is not malformed or corrupt.

Sorry if I sounded rude before, would appreciate any help anyone is able to offer.

Is there an options that allow for me to be able to grab more debug info?

Edit: I can revert to an older working commit to compile and test stuff if there is extra optional debug options
[Android Software Development] _that:
You can edit gui/pages.cpp, look for the comment "// This isn't always an error" in LoadFileToBuffer, and add a LOGERR there with strerror(errno) similar to the "failed to open" message a few lines below.
[Android Software Development] Matt07211:
Thanks for that info, I'll try that later tonight when I fire up the Google cloud VM.

I'll roll back to a working commit as well :)

I'll report back the results later.
[Android Software Development] Matt07211:
First Thing, let's verify the XML's are actually there, so let's change directory and run the ls command.

Output:

username@pc-name:~/TWRP/out/target/product/xcover3lte/recovery/root/twres$ ls -1
fonts
images
languages
portrait.xml
splash.xml
twrp
ui.xml

This is the change I did to gui/pages.cpp before compile (as directed by [MENTION=4878287]_that[/MENTION]) for better debug info.

if (!package) {
// We can try to load the XML directly...
LOGINFO("PageManager::LoadFileToBuffer loading filename: '%s' directly\n", filename.c_str());
struct stat st;
if (stat(filename.c_str(),&st) != 0) {
// This isn't always an error, sometimes we request files that don't exist.
return NULL;
}

to

if (!package) {
// We can try to load the XML directly...
LOGERR("PageManager::LoadFileToBuffer loading filename: '%s' directly\n", filename.c_str(), strerror(errno));
struct stat st;
if (stat(filename.c_str(),&st) != 0) {
// This isn't always an error, sometimes we request files that don't exist.
return NULL;
}

But I see no difference in my TWRP revovery log.

Did I do it wrong?
[Android Software Development] _that:
I said "look for the comment and add a LOGERR there" (before or after the comment). I didn't say "change the LOGINFO 3 lines before".
[Android Software Development] Matt07211:
Oh, okay, I'll try that, thanks for correcting my stupid mistake.

Do I add it as a seperate own line (I belive this is what you orignaly ment, just double checking) or wrap it around the command below it ?
[Android Software Development] _that:
Before or after the comment on a separate line - similar to the one below about "open", but you should change the text to something like "stat failed".
[Android Software Development] Matt07211:
Okay, sorry to bug you, but.

so I just put something like this:

LOGERR("Custom Error Message\n", filename.c_str(), strerror(errno));

Just want to double check so I don't stuff up like last time.

It'll log it to the recovery log, correct? Or will I need to use adb logcat?

Sorry for the multiple questions
[Android Software Development] _that:
You forgot to add insertion characters (%s) in your custom error message for the arguments you're passing. Just look at the pattern of the existing messages and follow it closely. LOGERR logs to the screen console *and* to the recovery log - adb logcat has to enabled explicitly with a build flag in TWRP and it's only used for debugging issues with encryption blobs.
[Android Software Development] Matt07211:
Okay, I haven't messed with C++ before so it's new to me, I assumed /n terminated a string and thought %s was a variable (Butndidnt know to what so I just removed it from the example.

Useful knowledge, thamks for sharing.
[Android Software Development] iamnotstanley:
Hey guys!

I have a working, source-built TWRP for my device, but it has 1 issue. (TWRP 3.1.0, omnirom 5.1, 3.4.67 kernel, MT6582)

When I want flash or restore my boot or recovery partition (image) the TWRP throws out an error, but when I am installing a zip with a "package_extract_file ("path/to/the/image/file", "/dev/recovery");" or using the backup function it is working fully. I think I'll need to modify the TWRP source code, but I can't find the problematic part of the code.

How can I fix it?

And what exactly does that 2 error message means?

"I:Error writing destination fd (Invalid argument)" this happens when I want to flash or restore an image

"ioctl(): blank: Invalid argument" this happens randomly

Please help, and thanks!

dmesg/kernel log: https://pastebin.com/raw/KRBYZW1D

recovery log: https://pastebin.com/raw/KJfswpSf

device tree: https://github.com/iamnotstanley/android_device_huawei_h30u10
[Android Software Development] zameer_yus:
cwm recovery boot error

after long time working finally i manage to compile CWM recover from CM13 source

but when i flash it on device , it didnt boot up , when i try to boot into recovery mobile goes to download mode

device samsung G5520

please help
[Android Software Development] ashyx:
This thread is for twrp nor CWM.
[Android Software Development] skoar:
I'm getting this weird screen whenever I boot into twrp. It took a considerable effort to build as my recoveryimage partition size is only 8.5 mb. I disabled multiple things in Boardconfig and had to use xz in kernel in order to bring down the size. Any help would be appreciated.
[Android Software Development] _that:
Try setting RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH. If that still doesn't work, post your recovery log.
[Android Software Development] skoar:
After adding that my recovery.img size went up to more than 8.5 :crying::crying: Any way to bring it down ????
[Android Software Development] Captain_Throwback:
Anything else you can disable? What do you have disabled now? Did you already remove networking, sound, etc. from your kernel config?
[Android Software Development] skoar:
My boardconfig.

TARGET_BOARD_PLATFORM := tegra

TARGET_TEGRA_VERSION := t114

TARGET_NO_BOOTLOADER := true

TARGET_NO_RADIOIMAGE := true

# Architecture

TARGET_CPU_ABI := armeabi-v7a

TARGET_CPU_ABI2 := armeabi

TARGET_ARCH := arm

TARGET_ARCH_VARIANT := armv7-a-neon

TARGET_CPU_VARIANT := cortex-a15

TARGET_CPU_SMP := true

ARCH_ARM_HAVE_TLS_REGISTER := true

# Kernel

#TARGET_KERNEL_SOURCE := kernel/nvidia/tegratab

#TARGET_KERNEL_CONFIG := tegra_tegratab_android_defconfig

BOARD_RAMDISK_OFFSET := 0x11000000

BOARD_TAGS_OFFSET := 0x10000100

BOARD_KERNEL_BASE := 0x10000000

BOARD_KERNEL_OFFSET := 0x10008000

BOARD_KERNEL_PAGESIZE := 2048

BOARD_KERNEL_CMDLINE := androidboot.selinux=permissive

BOARD_MKBOOTIMG_ARGS := --kernel_offset $(BOARD_KERNEL_OFFSET) --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --tags_offset $(BOARD_TAGS_OFFSET)

# Partitions

BOARD_BOOTIMAGE_PARTITION_SIZE := 8388608

BOARD_CACHEIMAGE_PARTITION_SIZE := 805306368

BOARD_RECOVERYIMAGE_PARTITION_SIZE := 8388608

BOARD_SYSTEMIMAGE_PARTITION_SIZE := 805306368

BOARD_USERDATAIMAGE_PARTITION_SIZE := 13761511424

BOARD_FLASH_BLOCK_SIZE := 4096

#TARGET_PREBUILT_KERNEL := device/nvidia/tegratab/kernel

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

BOARD_HAS_LARGE_FILESYSTEM := true

TARGET_USERIMAGES_USE_EXT4 := true

TARGET_RECOVERY_DEVICE_DIRS += device/nvidia/tegratab

TARGET_RECOVERY_FSTAB := device/nvidia/tegratab/recovery/etc/twrp.fstab

BOARD_HAS_NO_SELECT_BUTTON := true

# TWRP specific build flags

TARGET_RECOVERY_PIXEL_FORMAT := "RGBA_8888"

TW_INCLUDE_CRYPTO := false

#RECOVERY_GRAPHICS_USE_LINELENGTH := true

RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH := true

TW_NO_BATT_PERCENT := true

TW_EXCLUDE_SUPERSU := true

TW_EXCLUDE_MTP := true

RECOVERY_SDCARD_ON_DATA := true

BOARD_HAS_NO_REAL_SDCARD := true

TW_THEME := portrait_hdpi

TW_BRIGHTNESS_PATH := "/sys/class/backlight/pwm-backlight/brightness"

TW_NO_REBOOT_BOOTLOADER := true

TW_NO_REBOOT_RECOVERY := true

tell me what else to add
[Android Software Development] Captain_Throwback:
What about the kernel? Did you strip it down? What tree are you building in? You may be able to add the BOARD_NEEDS_LZMA_MINIGZIP := true flag if you're building in an Omni tree.

EDIT: Also rather than TW_INCLUDE_CRYPTO := false, you should just comment out that flag. I don't know if false is actually recognized, so that might still be getting included. I didn't see a recovery log so I don't know for sure.

EDIT 2: Checked the code, and the crypto flag does require "true" so that should be okay.
[Android Software Development] skoar:
I haven't stripped it down. My knowledge about kernels is not so much and I fear I would disable something that shouldn't be disabled. Although I may be able to strip it down if you tell me what exactly the twrp needs from the kernel.

I'm using omni tree. As for LZMA I'll add it right away and see the results. I just need to decrease 1.5 mb
[Android Software Development] Captain_Throwback:
TWRP doesn't need much, so you can safely disable bluetooth, audio, wifi, netdevices (this is usually a good one to save space).
[Android Software Development] skoar:
adding LZMA reduced the size from 9.5 to 7.7. Good one. Gonna try it now :):):)

---------- Post added at 19:56 ---------- Previous post was at 19:50 ----------

Damn not booting it just loops. Did that flag messed it up ???
[Android Software Development] Captain_Throwback:
Does your kernel have LZMA support for both the kernel and ramdisk enabled?
[Android Software Development] skoar:
yeah I think so. I've used LZMA on this kerenl before
[Android Software Development] Captain_Throwback:
Better confirm both kernel and ramdisk lzma compression are supported ;).
[Android Software Development] zameer_yus:
please help me to setup device trees ,,

got device trees from stock recovery.img and modify them , it was working while i m compiling recovery in cm13 source ,

but when i copy same device tree folder from cm13 source to omni to build twrp , its gives me below error while using lunch command
[Android Software Development] Captain_Throwback:
Why not just continue compiling it in cm13?
[Android Software Development] zameer_yus:
accually i build cwm recovery, and i faced problem, device was unable to boot into recovery so i moved to omni

how i will try to build twrp in cm13 source i just download twrp 3.1.0 source
[Android Software Development] :
I appreciate that you are asking for help but this is a TWRP thread and you really should be asking for CWM help in a CWM thread. Try not to derail this thread, thanks for understanding

Regards

Sawdoctor
[Android Software Development] ashyx:
[MENTION=5172395]zameer_yus[/MENTION]

Why compile CWM anyway, dead isn't it?

TWRP is the modern up to date equivalent and the preferred recovery nowadays.
[Android Software Development] zameer_yus:
okey sir i will not ask regarding CWM here any more

by the way my last post was to ask if the device tries are correct or not

as i know devices tries are same for any recover so my question was a bit related to this thread

any ways

Now i have question regarding TWRP hope i will get anwer

when i try to build twrp from cm13 source i face this issue after 10 minutes of runing make recoveryimage

No rule to make target '/home/killer/cm13/out/target/product/on5xfltezc/obj/STATIC_LIBRARIES/liblz4_intermediates/export_includes',

needed by '/home/killer/cm13/out/target/product/on5xfltezc/obj/EXECUTABLES/recovery_intermediates/import_includes'. Stop.

#### make failed to build some targets (08:57 (mm:ss)) ####

Install: /home/killer/cm13/out/target/product/on5xfltezc/recovery/root/supersu/install-recovery.sh
target Prebuilt: 99SuperSUDaemon (/home/killer/cm13/out/target/product/on5xfltezc/obj/RECOVERY_EXECUTABLES/99SuperSUDaemon_intermediates/99SuperSUDaemon)
Install: /home/killer/cm13/out/target/product/on5xfltezc/recovery/root/supersu/99SuperSUDaemon
target Prebuilt: Superuser.apk (/home/killer/cm13/out/target/product/on5xfltezc/obj/RECOVERY_EXECUTABLES/Superuser.apk_intermediates/Superuser.apk)
Install: /home/killer/cm13/out/target/product/on5xfltezc/recovery/root/supersu/Superuser.apk
target Prebuilt: chattr.pie (/home/killer/cm13/out/target/product/on5xfltezc/obj/RECOVERY_EXECUTABLES/chattr.pie_intermediates/chattr.pie)
Install: /home/killer/cm13/out/target/product/on5xfltezc/recovery/root/supersu/chattr.pie
target Prebuilt: libsupol.so (/home/killer/cm13/out/target/product/on5xfltezc/obj/RECOVERY_EXECUTABLES/libsupol.so_intermediates/libsupol.so)
Install: /home/killer/cm13/out/target/product/on5xfltezc/recovery/root/supersu/libsupol.so
target Prebuilt: suarm (/home/killer/cm13/out/target/product/on5xfltezc/obj/RECOVERY_EXECUTABLES/suarm_intermediates/su)
Install: /home/killer/cm13/out/target/product/on5xfltezc/recovery/root/supersu/su
target Prebuilt: supolicy (/home/killer/cm13/out/target/product/on5xfltezc/obj/RECOVERY_EXECUTABLES/supolicy_intermediates/supolicy)
Install: /home/killer/cm13/out/target/product/on5xfltezc/recovery/root/supersu/supolicy
Export includes file: bootable/recovery-twrp/gui/Android.mk -- /home/killer/cm13/out/target/product/on5xfltezc/obj/STATIC_LIBRARIES/libguitwrp_intermediates/export_includes
make: *** No rule to make target '/home/killer/cm13/out/target/product/on5xfltezc/obj/STATIC_LIBRARIES/liblz4_intermediates/export_includes', needed by '/home/killer/cm13/out/target/product/on5xfltezc/obj/EXECUTABLES/recovery_intermediates/import_includes'. Stop.

#### make failed to build some targets (08:57 (mm:ss)) ####
[Android Software Development] Captain_Throwback:
So then add the lz4 repo...
[Android Software Development] zameer_yus:
can you guide me how to do it?

because i allready install lz4 using sudo apt-get install liblz4-dev

but now success
[Android Software Development] Captain_Throwback:
You need to add it as a local manifest. You can probably use this repo: https://github.com/LineageOS/android_external_lz4

You just have to pick a branch.
[Android Software Development] zameer_yus:
git clone https://github.com/LineageOS/android_external_lz4 -b cm-13.0 .repo/local_manifests

repo cync

even i use

repo sync --force-sync

eroor

File "/home/killer/cm13/.repo/repo/main.py", line 531, in <module>

_Main(sys.argv[1:])

File "/home/killer/cm13/.repo/repo/main.py", line 507, in _Main

result = repo._Run(argv) or 0

File "/home/killer/cm13/.repo/repo/main.py", line 180, in _Run

result = cmd.Execute(copts, cargs)

File "/home/killer/cm13/.repo/repo/subcmds/sync.py", line 821, in Execute

project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)

File "/home/killer/cm13/.repo/repo/project.py", line 1363, in Sync_LocalHalf

lost = self._revlist(not_rev(revid), HEAD)

File "/home/killer/cm13/.repo/repo/project.py", line 2501, in _revlist

return self.work_git.rev_list(*a, **kw)

File "/home/killer/cm13/.repo/repo/project.py", line 2700, in rev_list

(self._project.name, str(args), p.stderr))

error.GitError: CyanogenMod/android_external_lz4 rev-list ('^7cb39f582a924ee6bb0125da96e7e1f2bb3d718d', 'HEAD', '--'):

fatal: Not a git repository (or any of the parent directories): .git
[Android Software Development] Captain_Throwback:
That's not how local manifests work...do some searching/research.
[Android Software Development] Matt07211:
Okay, I am really stumped.

I'll just layout what I have done. Hope someone is able to give me insight to why this isnt working.

Firstly, per your instructions i have modified gui/pages.cpp so I can get a better error message.

This is what I've changed;

- Code before

if (!package) {
// We can try to load the XML directly...
LOGINFO("PageManager::LoadFileToBuffer loading filename: '%s' directly\n", filename.c_str());
struct stat st;
if (stat(filename.c_str(),&st) != 0) {
// This isn't always an error, sometimes we request files that don't exist.
return NULL;
}

- Code After

if (!package) {
// We can try to load the XML directly...
LOGINFO("PageManager::LoadFileToBuffer loading filename: '%s' directly\n", filename.c_str());
struct stat st;
if (stat(filename.c_str(),&st) != 0) {
// This isn't always an error, sometimes we request files that don't exist.
LOGERR("PageManager::LoadFileToBuffer failed to load to buffer '%s' - (%s)\n", filename.c_str(), strerror(errno));
return NULL;
}

It prints out this errror message in TWRP log (multiple times cause it has trouble loading any xml file)

I:Loading package: splash (/twres/splash.xml)
I:Load XML directly
I:PageManager::LoadFileToBuffer loading filename: '/twres/splash.xml' directly
[B]E:PageManager::LoadFileToBuffer failed to load to buffer '/twres/splash.xml' - (No such file or directory)[/B]
E:Package splash failed to load.
E:Failed to load splash screen XML.

So the first thing j do is verify the XML files are there in the ramdisk.

The XML files are present in the unpacked recovery.img

$:~/TWRP/out/target/product/xcover3lte/temp$ ls
charger property_contexts
data res
default.prop sbin
dev seapp_contexts
etc selinux_version
file_contexts sepolicy
fstab.goldfish service_contexts
fstab_lpm.pxa1908 sys
fstab.pxa1908 system
init tmp
init.rc twres
init.recovery.service.rc ueventd.goldfish.rc
init.recovery.usb.rc ueventd.pxa1908.rc
license ueventd.rc
proc

$:~/TWRP/out/target/product/xcover3lte/temp$ ls twres/
fonts languages splash.xml ui.xml
images portrait.xml twrp

The XML files are also in the $OUT staging directory.

$:~/TWRP/out/target/product/xcover3lte$ cd recovery/root/

$:~/TWRP/out/target/product/xcover3lte/recovery/root$ ls
charger property_contexts
data res
default.prop sbin
dev seapp_contexts
etc selinux_version
file_contexts sepolicy
fstab.goldfish service_contexts
fstab_lpm.pxa1908 sys
fstab.pxa1908 system
init tmp
init.rc twres
init.recovery.service.rc ueventd.goldfish.rc
init.recovery.usb.rc ueventd.pxa1908.rc
license ueventd.rc
proc

$:~/TWRP/out/target/product/xcover3lte/recovery/root$ ls twres/
fonts languages splash.xml ui.xml
images portrait.xml twrp

So as you can see, the error states that there is no such file or directory, but as you can see from my terminal output the files themselve are present in both the $OUT staging dorectpry and when i manually unpack the recovery.img and the ramdisk that resides inside of it.

Full TWRP booting log attached.
[Android Software Development] skoar:
[MENTION=1162986]Captain_Throwback[/MENTION] from yesterday I've made multiple builds since yesterday (and yes I've enabled LZMA support for kernel and ramdisk) but each one led to bootloops. I have tried with custom bootimg.mk and off course the LZMA flag in Boardconfig. I've tried with prebuilt kernel and by building it but each time it gave bootloops. So now I'm left with the conclusion that lzma really won't work. Now making the zImage smaller is my only way. After xz compression it gives 4.0 mb, the recovery.img size is 9.5 mb and my recovery partition is 8.0 mb if only I cold get the zImage to be 2.5 mb (which sounds kinda impossible). Is there any other way or this is the end of the road ???
[Android Software Development] Captain_Throwback:
Did you remove the unnecessary items from the kernel config like I suggested yesterday?
[Android Software Development] skoar:
That's where I need your help
[Android Software Development] Captain_Throwback:
I told you what to disable...
[Android Software Development] ashyx:
Older versions and branches build a smaller binary, so maybe you might want to try that too.

Theres probably stuff you can still remove from Sbin, but at expense of losing functionality.

It is also possible to reduce the size of the images in the RES folder.
[Android Software Development] mike-developer:
port TWrp for SM-G5510

hi

i ported twrp recovery 3.1.0-0 from SM-G550T for my device SM-G5510 ! and when i want to wipe data from twrp recovery or install custom rom below error occurred

invalid block device 'emmc' in fstab line '/dev/block/bootdevice/by-name/apnhlos

invalid block device 'emmc' in fstab line '/dev/block/bootdevice/by-name/dsp

invalid block device 'emmc' in fstab line '/dev/block/bootdevice/by-name/system

invalid block device 'emmc' in fstab line '/dev/block/bootdevice/by-name/cache

invalid block device 'emmc' in fstab line '/dev/block/bootdevice/by-name/boot

error creating fstab

unable to find partition for path '/system'

how to update partiotion block ! pls help me to fix problem
[Android Software Development] _that:
Do you see the files when you do the ls with TWRP booted (via adb shell)? Post the output of "adb shell ls -l /twres".

These messages can't be from TWRP - TWRP's message starts with a capital "I" and prints the whole fstab lines, not only the device path.

Apparently your trwp.fstab is wrong. Without you posting any details (e.g. your fstab or a complete recovery log) that's all I can say.
[Android Software Development] ashyx:
Are you attempting to use the stock fstab or just copied the contents?

TWRP needs to have the fstab in the right format.

MOUNT POINT - FS TYPE - PATH TO PARTITION - FLAGS
[Android Software Development] ashyx:
You need to use the right button combo. POWER + HOME + VOL UP.
[Android Software Development] mike-developer:
thank u for answer

i just copied "recovery.img-dtb" and 'recovery.img-zImage' from stock recovery to ported recovery

and lastly i copied recovery.fstab from stock recovery to ported recovery

nothing more ...

how to fix fstab ?
[Android Software Development] zameer_yus:
thanks for answer

i m pressing right buttons combination as you told me

but there is some other problem while compiling not from POWER + HOME + VOL UP.
[Android Software Development] _that:
Read the OP, it's documented there.