yashsingh1/xdaforums huggingface dataset:
[Android Software Development] DiamondJohn:
The error below was with an upgraded bootloader (and corresponding TWRP build), and it appears my upgrade was not perfect. So I carefully re-flashed it all, and the following error disappeared. sorry.:o

I can build TWRP 3.1.1 using LineageOS sources, and it boots and appears to be working fine. However, I do get thye following in the log:

I:wipe_path '/cache'
Formatting Cache using mkfs.f2fs...
Error: Device not specified

Usage: fsck.f2fs [options] device
[options]:
-a check/fix potential corruption, reported by f2fs
-d debug level [default:0]
-f check/fix entire partition
-p preen mode [default:0 the same as -a [0|1]]
-t show directory tree [-d -1]
mkfs.f2fs -t 0 /dev/block/mmcblk0p35 process ended with ERROR: 1
Unable to wipe Cache.
Unable to wipe /cache.
Updating partition details...

Dont know if its related, but my actual cache is formatted as f2fs (not ext4. but the above appears to be correctly using f2fs) but the fstab file has the format as ext4 :confused: the line in the fstab is

/cache [COLOR="Red"]ext4[/COLOR] /dev/block/platform/msm_sdcc.1/by-name/cache

Is there anything I should be fixing/changing for either or both of the above?
[Android Software Development] fOmey:
Hello mate, I came across this reply while searching for a fix for a issue I'm having.. I know it's quite a old reply, the discussion you were replying to was regarding manually patching a kernel with no public source in order to enable touch..

I would love to pick your brain and get a little more information regarding this, I would appreciate any info you can supply.. This is the first time I've had to consider doing this, so any information is good information !

The device I'm attempting to port TWRP to is a DOOGEE MIX, it runs a MediaTek MT6757 which appears to be extremely common.. however surprisingly I cant find ANY kernel source for any devices that use this CPU ! It's very frustrating.. I've contacted the manufacture a few times with no avail..

I'm going into this blind with no experience, so pardon my ignorance.. please be specific in your reply's.

Any tips, hints, advice would be greatly appreciated.

Cheers
[Android Software Development] ashyx:
Have you tried flashing the recovery to the boot partition to see if touch works?
[Android Software Development] fOmey:
I have not as this particular phone has a dedicated /recovery partition.
[Android Software Development] ashyx:
Sure, but touch is being disabled by the kernel when it realises its booted to recovery mode.

If you flash to the boot partition the kernel will assume it's booting the OS and touch may work.

It's just a test.
[Android Software Development] fOmey:
Ahhhh I see what your saying.. it is worth a shot I guess.. I'll give it a try now.

Also experiencing a very odd issue... if the device boots into TWRP the screen will remain black untill the screen timeout expires (60 seconds) and once the unlock screen is displayed the screen turns on..

I just compiled a build with the following flags:

TW_NO_SCREEN_BLANK := true
TW_NO_SCREEN_TIMEOUT := true

The screen never turned on... strange..

EDIT: Touchscreen appears to be working when flashed to /boot... nice suggestion wouldnt have thought of testing that.. thanks.

Meaning a boot.img patch is the only way to get the touch screen working I pressume.

Argh it's so nice having proper touch support!!!
[Android Software Development] ashyx:
I have experienced it in the past. You need the timeout to kick start the display driver.

Disabling it just leaves it hanging on a blank screen.

A work around is setting time out to minimum.
[Android Software Development] fOmey:
I see, I'll give that a try..

Any ideas on getting touch working without kernel sources ? :confused: :p
[Android Software Development] ashyx:
I fixed it in the source. Why doesn't your device manufacturer release the kernel source as they are obliged to do?
[Android Software Development] DodoGTA:
Because MediaTek is weird
[Android Software Development] danerrickcuba@gmail.com:
An educative interaction you guys had, I'm facing more or less similar problem, my recovery compiled, installs, boots, but no touch, even after installing to /boot ....anyone had faced this anomaly and solved it?
[Android Software Development] vampirefo:
It's not really MediaTek is weird, all my MediaTek phones have source code released, I had to asked Blu and wait for them to release it.

Anyway you have a few choices, boot twrp, build recovery that allows for hardkey navigation, ask for kernel source from manufacturer, try and find similar source for your device released through other manufacturer.

Blu the manufacturer of the phones I use, has released many kernel source, you may even be able to use their source.

---------- Post added at 10:44 AM ---------- Previous post was at 10:38 AM ----------

I have only seen one person release the info on how to do this, it's way to complex, you need to be great at disassembling binary files.

I have little windows experience, Linux dissemblers couldn't do it, or I wasn't able to follow along.

DeckerSu is the only person, I know that did it, and posted a how to. Again it's to complex to follow unless your source code is exactly as his is.

---------- Post added at 10:49 AM ---------- Previous post was at 10:44 AM ----------

You may need a different recovery, or you may need modules, depends on your kernel.
[Android Software Development] fOmey:
If you flash to /boot, allow the phone to boot normally.. should automatically boot into recovery.. do not force it into recovery mode.
[Android Software Development] danerrickcuba@gmail.com:
When I flash my modded trwp to /boot, and do normal reboot, it boots the recovery that has no touch support, and when I force device to recovery via buttons, it boots the older(v2.8) version that is flashed to /recovery....it seems as suggested above by [MENTION=2472806]vampirefo[/MENTION] I might need more mods to the kernel, by device is galaxy tab active LTE by the way
[Android Software Development] fOmey:
Really come's down to the independant manufactures... MediaTek technically arnt responsible for releasing kernel source.. Unfortunately Doogee are being very difficult... I have sent them 3 emails already, they keep reffering me to system images they posted on their forum.. haha

Kernel source in this situation really is the way to go.. would allow further modification also.

Funny enough the Xperia XA1 uses the same socket as the doogee... I have contact Sony requested they release their kernel source, which they are normally very willing to... so I'm interested to see how that goes..

Yes well, modifying binary's is never a fun/easy task.. I might have to hunt [MENTION=5660972]DeckerSU[/MENTION] down and ask for a little advice on the matter..

EDIT: I tracked down a post by [MENTION=1162986]Captain_Throwback[/MENTION], surprisingly his method is relatively simple.. however obviously this method doesn't apply to ALL kernels.. only those that use a similar method to disable touch.

Might be able to figure out a slightly more elegant solution and replace only the necessary string's.. but it's a start !

EDIT 2: [MENTION=4544860]osm0sis[/MENTION], If you would be kind enough to chime in ? What would you consider to be the best method of patching a kernel keeping in mind no kernel source is currently available for the device.. nor is there any similar kernel source currently available ?

Would Android Image Kitchen be cutout for the task ? Or is this outside the scope of it's intended use ?

Your a wizard! I'm hoping you hold the answers I seek.. The method I quoted above seems like a great start, I'm just a little concerned how I'm going to re-compress... Would really appreciate your input.

EDIT 3: Came across these interesting notes:

A big zimage file consist of bootsect.o, setup.o, misc.o and piggy.o files. The original vmlinux kernel image compressed in piggy.o file.

Could possibly compress (gzip ?) the binary and replace piggy.o in bzImage... no idea all theoretical..

Decompressing without extract-vmlinux.. has the kernel be compiled with gzip compression tho ? We shall see..

$ dd if=vmlinuz skip=`grep -a -b -o -m 1 -P '\x1f\x8b\x08\x00' vmlinuz | cut -d: -f 1` bs=1 | zcat > /tmp/vmlinux
gzip: stdin: decompression OK, trailing garbage ignored

Very interested to see if the output files are identical... dd vs. extract-vmlinux...
[Android Software Development] osm0sis:
Well if you can dump the boot image, AIK can probably split the image and give you access to the ramdisk files, and then the b/zImage could be decompressed with gunzip or bunzip2 and then you could see about some hexpatch stuff like Captain mentioned.
[Android Software Development] fOmey:
After the patch, simply re-compress with gzip and place back into AIK and re-build ? Perhaps I was over thinking this entire process.. because it sounds relatively straight forward.

I'm sure I'll hit a bump somewhere along the way.. I was expecting some voodoo android magic..

Thanks for taking the time to reply.
[Android Software Development] osm0sis:
Yes exactly, just recompress the uncompressed kernel again with whatever format it was, then replace the -zImage file in split_img in AIK with that and repack. :good: :)
[Android Software Development] ugohemma:
Can this tutorial still work for mtk devices with 6.0 firmware
[Android Software Development] fOmey:
As I suspected some android voodoo magic... Appears when I decompress and recompress zImage the file size differs by 1mb even tho max compression is set... results in a bootloop with no modifications..

Been at it for 3 or so hours now, burnt out.. will look at it again tomorrow with a fresh set of eyes..
[Android Software Development] vampirefo:
I just don't see this working, perhaps on zImage but not on Image.gz-dtb.
[Android Software Development] fOmey:
What I'm attempting to do is unpack zImage and patch piggy.gz which supposedly is a gunzip compressed kernel binary.... Finally replace zImage in boot.img... seems like the only logical way to patch the kernel without source.. I'm open to suggestions tho..
[Android Software Development] ashyx:
What are you using to extract the zImage?

Use AIK that will give you boot.img-zImage which is the kernel.

Decompress it with 7zip if it's compressed.

Even after all that it's going to be like looking for a needle in a haystack using a hex editor if you don't know where to patch.
[Android Software Development] fOmey:
I've discovered zImage isn't a standard image per say... That's exactly what I was trying yesterday.

Unfortunately I have no other options than to search for the needle in the haystack.. otherwise believe me I wouldn't be going down this route.
[Android Software Development] ashyx:
I think you misunderstood. I wasn't suggesting you could mount a zImage :silly:

I meant the kernel could be compressed.

---------- Post added at 09:53 PM ---------- Previous post was at 09:43 PM ----------

I'm entirely lost at what you're attempting to do here. :confused:

Why can't you just use AIK kitchen to unpack the boot image? Are you saying it doesn't work on this particular boot image?

All you need is the kernel image itself as that is where the change needs to be made.
[Android Software Development] fOmey:
Read my previous post, I attempted this.. AIK unpacks the boot image, spits out zImage.. sure. When you send zImage through gunzip to decompress and recompress that results in a bootloop.. without any modification.

So it's not as simple as I initially thought.. although if you have any other suggestions on how to decompress & modify zImage I'm all ears...
[Android Software Development] ashyx:
See this is where I missed it. I hadn't seen an indication of how far AIK had actually got with the unpacking.

With most boot images it has no problem decompressing the zImage too.

It seems you have one of these non standard jobs.

Why not post the boot image and let [MENTION=4544860]osm0sis[/MENTION] try his wizardry on it?
[Android Software Development] fOmey:
I haven't conceded yet, I'm pretty confident I'm on the right track now.. argh these non-standard jobs are all part of the fun right..

I will post the boot.img when I get home however, just in case anyone would like to take a poke around.. I welcome any help...

Would be nice to document this entire process once I figure out the in's and out's so others in a similar situation who are keen enough to get stuck into it have something to refer to..
[Android Software Development] osm0sis:
If it's an Image.gz-dtb like another user suggested you just need to separate the dtb off before you gunzip (the "trailing garbage" warning you got could be an indicator of this).

Then when re-gzipping you need to be sure to do it in the specific way kernels like, without a filesystem header.

See here where I do exactly that for repacking some former ELF files into AOSP format for unlocked Sony bootloaders: https://github.com/osm0sis/Android-Image-Kitchen/blob/AIK-Linux/unpackimg.sh#L212
[Android Software Development] fOmey:
AIK dumps a zImage.

Pretty sure I tried --no-name flag when compressing, however I will try again tonight to be sure.. so your saying I should simply be able to decompress zImage and it should spit out the raw kernel binary ?

The reason why I ask is because when I compared the result I was getting from the decompressed zImage to the dump that "extract-vmlinux.sh" generates they are very different.. The dump result of extract-vmlinux has tons more strings, it appeared to me like a proper dump.

I mean I've never had to do this before, so I've got no idea ill be honest.. Just learning as I go along... but from what I tested last night it's doesn't appear to be a matter of simply decompressing zImage, I need to extract the kernel binary from the zImage and most likely decompress that.

No idea, I'm keen to take another stab at it tonight tho... Very interesting stuff.
[Android Software Development] osm0sis:
zImage = Image.gz, arm vs. arm64 naming difference only. They can easily have dtb's attached as well, unpackbootimg doesn't know the difference.

What I'm saying is the "trailing garbage" warning you got indicates that there's something attached to the zImage. If there's a dtb on the end you need to split it with a hex editor so that you can rejoin it again after you recompress your kernel binary.

I'm not sure what that extract-vmlinux.sh is or does. If you're right and you've got something else going on with multiple catenated gzips, well that's the first I've heard of that, but OEMs be crazy and love to do overcomplicated, unnecessary, incompatible non-standard things, so I can't say I'd be entirely surprised either. :p
[Android Software Development] strubedo:
Where do I start for the US Samsung Galaxy S7 edge?
[Android Software Development] fOmey:
Right right, what your saying does make sense regarding the trailing garbage..

extract-vmlinux.sh is a script which dumps the raw kernel binary from a boot.img, it also decompresses if necessary.. however you'll need to apply this patch to support ARM.

I'll give it another shot tonight, hopefully I have a little more luck..

EDIT: I thought I would upload boot.img... just incase anyone wanted to take a look.

[MENTION=4544860]osm0sis[/MENTION] if you get a chance I would appreciate it if you could take a look and tell me what I'm dealing with here... because I'm a little frazzled, no idea what my next move is going to be.
[Android Software Development] mike_slovakian:
I'm trying to compile for MT6580 / MM6.0 but I don't get very far. Is anyone familiar with these errors.

>Your device can't be found in device sources..

>Traceback (most recent call last):

> File "build/tools/roomservice.py", line 353, in <module>

> fetch_device(device)

when I 'make recoveryimage' ,, I get

including ./android/system/external/bzip2/Android.mk ...

including ./android/system/external/clang/Android.mk ...

including ./android/system/external/compiler-rt/Android.mk ...

build/core/binary.mk:107: *** android/system/external/compiler-rt/lib/asan: Unknown LOCAL_NDK_STL_VARIANT none. Stop.

#### make failed to build some targets (27 seconds) ####

I did download a sht load of sources but can't pass that error
[Android Software Development] fOmey:
Little update for those interested...

I made another boot.img dump.. started fresh tonight. I decompressed zImage, worked fine.. opened it up in the hex editor, tons of strings?! Looked much better...

Proceeded to recompress zImage and add the trailing crap (dtb) removed by gzip, flashed my new boot.img... bam booted fine.

I cant explain it, I must of screwed my original boot.img up somehow I've got no idea... but I was totally overthinking the entire thing... DOH ! Wasted so much time working in a contaminated workspace, but what ever its working !! Finally.... I can patch my kernel!!!

I'm an idiot... lol

Now the real work begins, finding the needle in the haystack... I started running through all the obvious things to replace in attempts to enable touch, no luck yet.. I might just code a script to replace sequential bytes untill touch works or something I don't even know.

I also came across this weird debug/testing menu on the phone (DOOGEE MIX), it's all in chinese I've got no idea what I'm looking at.. I'll get one of the guys from work to translate it for me.. It had a interesting page tho, had like a kernel info dump... there tons of menu entrys also, it's probably nothing related to what I'm attempting here but hey it's something ?

I've edited my previous post's that contained any misleading information, dont want to lead anyone a stray that is attempting the same thing.

Thank you everyone who chipped in friendly words of advice, I appreciate it.
[Android Software Development] nkk71:
Just looked at you boot.img, the dtb is appended at offset 0x7BB59A (8107418 decimal) so if you remove that gunzip works just fine.

However looking through your kernel the *recovery to rec0very* patch probably won't work, I don't see that string in there (well yes lots of references to recovery, but mostly text or identifiers)

EDIT: maybe a dmesg could shed some light
[Android Software Development] fOmey:
Yeah, I'm such an idiot.. haha

You absolutely right, recovery to rec0very patch did not work...

Does look like there are a few touch related logs: https://pastebin.com/BazVj9bz

I found this interesting:

<3>[ 1.110264] (2)[6:kworker/u16:0]mtk-tpd: MediaTek touch panel driver init
<3>[ 1.110692] (2)[6:kworker/u16:0]mtk-tpd: enter tpd_probe, 531
<3>[ 1.110754] (2)[6:kworker/u16:0]Lomen 0
<3>[ 1.110760] (2)[6:kworker/u16:0]mtk-tpd: [tpd -1] mt_tpd_pinctrl+++++++++++++++++
<3>[ 1.110766] (2)[6:kworker/u16:0]Lomen 0.1
<3>[ 1.110933] (2)[6:kworker/u16:0]Lomen 0.2
<3>[ 1.110941] (2)[6:kworker/u16:0]mtk-tpd touch: fwq Cannot find touch pinctrl default -19!
<3>[ 1.110950] (2)[6:kworker/u16:0]mtk-tpd: [tpd-1] mt_tpd_pinctrl----------
<3>[ 1.110956] (2)[6:kworker/u16:0]Lomen 1
<3>[ 1.110972] (2)[6:kworker/u16:0]mtk-tpd: [mtk-tpd]cap touch and Generic touch both are not loaded!!

And this dmesg from booting into OS: https://paste.ee/p/TANPZ
[Android Software Development] nkk71:
From a quick look:

Booting OS:

[ 1.241991] (0)[199:kworker/u16:2]BOOTPROF: 1241.990387:probe: probe=i2c_device_probe drv=gt1x(ffffffc001261080) 169.342078ms
[ 1.242190] (0)[199:kworker/u16:2]<<GTP-INF>>[tpd_local_init:912] end tpd_local_init, 912
[ 1.242190]
[ 1.242206] (0)[199:kworker/u16:2]mtk-tpd: [mtk-tpd]tpd_probe, tpd_driver_name=gt1x
[ 1.242218] (0)[199:kworker/u16:2]touch type has find break !!
[B][ 1.242393] (1)[199:kworker/u16:2]mtk-tpd: Cap touch panel driver
[ 1.242645] (1)[199:kworker/u16:2]input: mtk-tpd as /devices/virtual/input/input8[/B]
[ 1.242996] (1)[199:kworker/u16:2]input: mtk-tpd-kpd as /devices/virtual/input/input9

whereas in recovery almost nothing, lots of mtk-tpd notifications in booting os.

It does differentiate between normal boot and recovery:

[ 0.517525] (6)[1:swapper/0]kpd: Normal Boot long press reboot selection

vs

<4>[ 0.553354] (7)[1:swapper/0]kpd: Other Boot Mode long press reboot selection

But not sure if that's the problem, guess you'll have to look at some kernel sources, and see if you can find anything.
[Android Software Development] mike_slovakian:
Do you guys have an up to date source / tree for MT6580 ? I have downloaded the ones recommended but keep getting this error.

>Your device can't be found in device sources..

>Traceback (most recent call last):

> File "build/tools/roomservice.py", line 353, in <module>

> fetch_device(device)
[Android Software Development] iykeDROID™:
Touch Input not working on TWRP 3.1.1 for Mediatek MT6753 Device.

First of all i will say congratulations for making Android awesome with TWRP Touch Recovery.

Team, anytime i compile TWRP for y device, Touch Input does not work.

I am asking fir there are some things missing or i have to edit in other to the touch to work.

Thank You.
[Android Software Development] Bradley W:
Hi everyone

Anyone can help me about how to build a twrp for my lg k520

I have baught this phone 3 month ago

Everyday i try to get root on the device

But still no root access..

If anyone here can help me..

Thanks..

Android 6.0.1
[Android Software Development] S.faraaz:
I have a rooted reach allure running android 5.1, resolution 540*960.

I ported twrp for my phone using android image kitchen using stock boot.img instead of stock recovery.img because when i used stock recovery it showed an error saying boot.img required.

After repacking twrp using boot.img i flashed it on my phone. Everything went fine except that i have a flipped screen when i boot into recovery.

The screen display is rotated but touch areas remain the same.

The display and touch are completely disoriented.

Kindly provide me with any solution.

Thank You
[Android Software Development] desalesouche:
read op, solution is provided .
[Android Software Development] S.faraaz:
What is op?

---------- Post added at 07:55 PM ---------- Previous post was at 07:47 PM ----------

I actually read that but i dont know how to do it.

I dont know how to add flags in the recovery.

Can u please suggest a way so that i may do it?

Any help is appreciated.
[Android Software Development] pix106:
This thread is about actually building twrp from source, not about porting it from some other device to your device using automatic tools.

You have to be building to set build flags.
[Android Software Development] Guner24:
Where can I find an image of this?
[Android Software Development] Professor Woland:
this error is hunting me how to solve?

here is my device tree and as you can see tw_theme is set https://github.com/ProfessorWoland/android_device_lge_mm1v_recovery
[Android Software Development] ashyx:
Try completely removing the whole line, save, then type the line again.

I've had this issue in the past and it was something wrong with the line, so it wasn't picking up the flag correctly, even though it looked just fine.
[Android Software Development] Professor Woland:
I didn't launch device LOL

here is trouble again https://i.imgur.com/PMGY2es.jpg

Solved commit
[Android Software Development] ZawZaw:
Hi...all,

I want to build latest TWRP version for Sony Xperia Z Ultra from OmniROM minimal source or LineageOS source.

I have already omni minimal manifest source.

I need device tree, kernel and vendor.

What other need for Sony Xperia Devices?

If you possible, please sent me links.

please help me.

•••
[Android Software Development] Professor Woland:
Now it compiles just fine but when i try to boot it from fastboot on phone screen it prompts me : waiting RAM Dump.

This is device tree https://github.com/ProfessorWoland/android_device_lge_mm1v_recovery/tree/ProfessorWoland-patch-1

Halp :)
[Android Software Development] ashyx:
Are you just trying to boot it without installing? Also no dtb for this device?
[Android Software Development] Professor Woland:
Yes yes, wanted to try so I don't kill recovery, so I used "fastboot boot". I guess there isn't dtb since it's mediatek device, or at least I couldn't find it, it's not in boot image, any hint where to look? Also boot image uses lz4 compression maybe that is cause of trouble, how to point him to encryption?