yashsingh1/xdaforums huggingface dataset:
[HTC Pico (Explorer)] Phil3759:
Ok,

Looked at it and I can propose this change diff from twrp:

static int write_block(MtdWriteContext *ctx, const char *data)
{
const MtdPartition *partition = ctx->partition;
int fd = ctx->fd;

off_t pos = lseek(fd, 0, SEEK_CUR);
if (pos == (off_t) -1) return 1;

ssize_t size = partition->erase_size;
while (pos + size <= (int) partition->size) {
loff_t bpos = pos;
int ret = ioctl(fd, MEMGETBADBLOCK, &bpos);
if (ret != 0 && !(ret == -1 && errno == EOPNOTSUPP)) {
add_bad_block_offset(ctx, pos);
fprintf(stderr,
"mtd: not writing bad block at 0x%08lx (ret %d errno %d)\n",
pos, ret, errno);
pos += partition->erase_size;
continue; // Don't try to erase known factory-bad blocks.
}

struct erase_info_user erase_info;
erase_info.start = pos;
erase_info.length = size;
int retry;
for (retry = 0; retry < 2; ++retry) {
if (ioctl(fd, MEMERASE, &erase_info) < 0) {
fprintf(stderr, "mtd: erase failure at 0x%08lx (%s)\n",
pos, strerror(errno));
continue;
}
if (lseek(fd, pos, SEEK_SET) != pos ||
write(fd, data, size) != size) {
fprintf(stderr, "mtd: write error at 0x%08lx (%s)\n",
pos, strerror(errno));
}

char verify[size];
if (lseek(fd, pos, SEEK_SET) != pos ||
read(fd, verify, size) != size) {
fprintf(stderr, "mtd: re-read error at 0x%08lx (%s)\n",
pos, strerror(errno));
continue;
}
if (memcmp(data, verify, size) != 0) {
fprintf(stderr, "mtd: verification error at 0x%08lx (%s)\n",
pos, strerror(errno));
continue;
}

if (retry > 0) {
fprintf(stderr, "mtd: wrote block after %d retries\n", retry);
}
fprintf(stderr, "mtd: successfully wrote block at %llx\n", pos);
return 0; // Success!
}

// Try to erase it once more as we give up on this block
add_bad_block_offset(ctx, pos);
fprintf(stderr, "mtd: skipping write block at 0x%08lx\n", pos);
ioctl(fd, MEMERASE, &erase_info);
pos += partition->erase_size;
}

// Ran out of space on the device
errno = ENOSPC;
return -1;
}

You think you can try it and let me know? I am really busy in porting to some new devices before starting to look at these bugs
[HTC Pico (Explorer)] Nihar.G:
I'll give it a try. PMed you about it.
[HTC Pico (Explorer)] icspanneer:
I can't port this recovery for my micromax a89 mobile.... :(
[HTC Pico (Explorer)] Nihar.G:
Huh ?
[HTC Pico (Explorer)] icspanneer:
I change the zimage ..

But not going on recovery mode...

My device processor is mediatek
[HTC Pico (Explorer)] Phil3759:
Uploaded 5.03.7 that mainly fixes touch in double tap and highlight only modes
[HTC Pico (Explorer)] Nihar.G:
Hey man, sorry, I didn't remember that all next updates were going to be in that folder.

Got it now, will test and release soon.

My bad, extremely sorry.
[HTC Pico (Explorer)] Phil3759:
Was about to awaken you :D

But, extremely busy in fixing some bugs. What I love in porting to new devices, is the new bugs you discover

By the way, actually, custom backup mode is giving you tar files I guess? I just fixed it to use again cwm yaffs2 wrapper.

I am being done with bugs and hopefully could release an update for all devices in the next couple of days

Maybe this bug fix version could solve some issues with your wipe cache

Else, we look at my suggested changes I did a few days ago
[HTC Pico (Explorer)] Nihar.G:
The GUI restart after 'Wipe Data/Factory Reset' is not fixed in 5.03.7. :(
[HTC Pico (Explorer)] Phil3759:
/boot mtd boot
/cache yaffs2 cache
/data yaffs2 userdata
/misc mtd misc
/recovery mtd recovery
/sdcard vfat /dev/block/mmcblk0p1 /dev/block/mmcblk0
/system yaffs2 system
/sd-ext ext4 /dev/block/mmcblk0p2
/devlog mtd devlog

Can I have the corresponding mmcblk device name for the partitions missing it?

That should improve backup size detection for some partitions
[HTC Pico (Explorer)] <JohnCarter>:
maybe yes..
[HTC Pico (Explorer)] Phil3759:
Surely yes
[HTC Pico (Explorer)] Nihar.G:
For which partitions exactly ?
[HTC Pico (Explorer)] Phil3759:
Boot and recovery
[HTC Pico (Explorer)] Nihar.G:
I don't know the mmcblk address for these :\

I can give you mtd though.

dev: size erasesize name

mtd0: 00100000 00040000 "misc"

mtd1: 00500000 00040000 "recovery"

mtd2: 00400000 00040000 "boot"

mtd3: 0eb40000 00040000 "system"

mtd4: 03b00000 00040000 "cache"

mtd5: 09600000 00040000 "userdata"

mtd6: 00a00000 00040000 "devlog"
[HTC Pico (Explorer)] Harkunwar:
Love the recovery !!
[HTC Pico (Explorer)] Phil3759:
v5.06.1

5.03.7 --> 5.06.1

Download latest update:

http://d-h.st/users/philz_touch/?fld_id=16058#files

I am done with maintenance releases.

So, I will try to debug the mtd issues remaining here and see what's up with virtual keys

Be back to you soon

Meanwhile, please update to new version as it contains a lot of bug fixes
[HTC Pico (Explorer)] cornholio_rules:
It doesn't format in ext4, just ext3. :thumbdown:
[HTC Pico (Explorer)] Phil3759:
LoL

You probably don't even know what's a recovery or the diff between ext4, ext3 and yaffs2

Now, instead of useless emoticons, you could try to explain a bit more what you mean or what you expect it to do :confused:
[HTC Pico (Explorer)] cornholio_rules:
Lulz

In fact I do know all those things Mr Phil (you are very funny), that's why I gave it a shot this version of CWM recovery. Later I saw that support of ext4 was fixed in a newer release of your recovery. Unfortunately the OP hasn't updated for the explorer (pico).
[HTC Pico (Explorer)] Phil3759:
Permanent download link with latest updates:

http://d-h.st/users/philz_touch/?fld_id=16058#files
[HTC Pico (Explorer)] Phil3759:
delete
[HTC Pico (Explorer)] cornholio_rules:
Downloading, thanks! :thumbup:

---------- Post added at 05:33 PM ---------- Previous post was at 04:51 PM ----------

Still formatting in ext3 :( while creating sd-ext partition and in a factory reset (coming from a ext4 partition). Ver. 5.0.6.1
[HTC Pico (Explorer)] Phil3759:
In fact

I looked at cwm source and we have this:

sdparted -es %s -ss %s -efs ext3 -s

So, original cwm applies ext3 always when partitionning sdcard

On my side, I added ext4 to the recovery.fstab

So, try to partition in PC/Linux first into ext4, then you could mount it and use it as ext4

I could change it to ext3 on next update, but will need more testing and reading as I am not used to sdparted command line

To be honest, I always format/partition sdcards in desktop
[HTC Pico (Explorer)] cornholio_rules:
That's what I don't understand, why keep using outdated ext3?

The problem is that in the first wipe of sd-ext it will change format to ext3, so it's useless to format in ext4 in the first time.

Thanks Philz for your help but this is a very old issue and it seems nobody care, everybody's happy with ext3.
[HTC Pico (Explorer)] Phil3759:
I went a bit more in that, but it is not the case with my recovery

When you partition, it will call sdparted which is set to ext3, as shown in my code above

However, in fstab, I switched it to ext4. That is, now, when you wipe/factory reset or format in Mounts and Storage menu, it will be forced to ext4

Only first partitioning is ext3. That I did not notice as I never partition on phone anyway, but will look at it if sdparted supports it

Let me know please if the above doesn't apply for you
[HTC Pico (Explorer)] Nihar.G:
The OP has been updated with the download link of latest release.
[HTC Pico (Explorer)] Red Devil:
The GUI reboot on the earlier version on wiping to install clean ROM is gone.. :good:.. Sdcard is mounting properly.. So.. Much better than the previous version :thumbupv
[HTC Pico (Explorer)] Phil3759:
Great, I did not do anything in that regard, but could be the many bug fixes, happy it is fixed without messing deeper in yaffs2 code

I still have question:

On nandroid backup: do you have partition sizes correctly detected?

I expect it to be no as I am still using mtd short name in the fstab file

If not, provide a log just when the backup starts (you can cancel it to spare time) and I will provide needed commands to get full partition name
[HTC Pico (Explorer)] Phil3759:
cat /proc/emmc
cat /proc/mtd
mount

Run this in adb shell under recovery and post output for each command

We'll see if we need more
[HTC Pico (Explorer)] Phil3759:
Thank you a lot

Now, only one thing left to see if we need this:

Go to Custom Backup menu

Select boot, recovery and misc partitions (mtd ones)

Continue to backup these 3 partitions

When backup starts, check if we could get size of the partitions or if you get unknown size for the 3

In that last case, I would add the mtd full path in fstab as device2 option to stat size
[HTC Pico (Explorer)] cornholio_rules:
Ok Philz, I'll check those changes out in your next release.

Edit:

I can confirm that it can´t mount the ext4 partition, but it can wipe it and convert it into ext3 (factory reset). I provide a full log of the failed mount. Hope it can help.
[HTC Pico (Explorer)] Phil3759:
Strange as ext4 sd-ext does work for me and was reported to work for other devices

Now, if it is formatted to anything other than ext4, it will fail to mount obviously. That's set in fstab

Do not use the partition menu

Format your sd-ext to ext4 either on linux box or in phone using Mounts and Storage / format sd-ext menu

Now, it should mount as ext4

If you partition in phone, it will be ext3 and fail to mount

I did not care as cwm only partitions vfat volumes. On all phones where I enable sd-ext, I do not set vfat, but auto as fstype for sdcard. So, in all cases, no one can partition it in CWM

I will look at that part of cwm later to enhance things

For now, stick to above steps and ext4 should work normally
[HTC Pico (Explorer)] Nihar.G:
Actually, our kernel uses ext4 driver to mount ext2 and ext3. Hence, I told you to set sd-ext as ext4 in fstab. What that does is, no matter what is the format of sd-ext it mounts the partition. This is confirmed by me and many other people too.
[HTC Pico (Explorer)] Phil3759:
Thank you for confirming sd-ext working

Any answer to my small question above about backup size detection? That way i fix it for good and release the debug version for virtual kies
[HTC Pico (Explorer)] Nihar.G:
Nope, backup size doesn't get detected on boot, misc and recovery.
[HTC Pico (Explorer)] Phil3759:
5.06.3: debug version for virtual keys

http://d-h.st/eIc

It also fixes fstab to allow size detection of mtd partitions during backup (please, give feedback if now it is ok)

About touch:

- Boot into recovery

- do not touch anything except following:

- touch and lift finger, once each of your device virtual keys (not the recovery buttons that you can toggle, but those of your device)

- start from left button to right one

Once done, using vol-up/down keys, go to advanced menu / report error and attach the log

Also, describe what happens when you touch your device keys

After this, you'd, hopefully, have all bugs sorted out
[HTC Pico (Explorer)] cornholio_rules:
The thing is that everything I do within recovery works good, except that it does only in ext3. When I format outside recovery (MiniTool Partition) with ext4 is when it fails to mount in recovery. I have no f... Idea what's going on, perhaps MiniTool is bugged?
[HTC Pico (Explorer)] Nihar.G:
Why are you so concerned about sd-ext format -.-

Just format sd-ext with recovery and you are done.
[HTC Pico (Explorer)] cornholio_rules:
Ext4 has become an obsession for me. :( ;)

Edit:

Ok, I'll explain a little more. Pico needs to use top notch software e.g. ext4, Linaro, etc. to overcome the serious handicap of internal memory and clock speed. Furthermore, ext4 is not experimental, why keep using legacy?

By the way, I'll never ask for sd-ext ext4 in I9100, it doesn't need it. :D
[HTC Pico (Explorer)] Phil3759:
1- Boot into recovery

2- Mounts and Storage / format sd-ext

3- Mounts and Storage / mount sd-ext

Provide a log after these exact 3 steps
[HTC Pico (Explorer)] bhuman.patel:
sh: sdcard not found

.

y it comes like this...

plz reply asap
[HTC Pico (Explorer)] Nihar.G:
Where exactly ?
[HTC Pico (Explorer)] cornholio_rules:
Ok, here it goes.
[HTC Pico (Explorer)] bhuman.patel:
Never mind...

I wanted to flash recovery through emulator.

BT just found an easy way...

in android emulator
[HTC Pico (Explorer)] Phil3759:
You used the last debug version for that. I cannot see anything in log except touch events

Use last touch debug version only to provide em a log to debug virtual keys

Use last non debug version to give a log about your sd-ext issue as I asked

In both cases, please follow exact steps
[HTC Pico (Explorer)] cornholio_rules:
Sorry, how do I use that? Is it in other menu?
[HTC Pico (Explorer)] Nihar.G:
Dowload the 5.06 version from OP. Flash it. and provide logs for sd-ext problem.
[HTC Pico (Explorer)] cornholio_rules:
Ok sorry, I thought that version had fixes.

So, I took an sd card and made a fat32 and ext4 partitions with MiniTool. Then I did as you say and here's the log.
[HTC Pico (Explorer)] Phil3759:
What i see in the log:

- sd-ext was formatted, necessarily in ext4 as that's the fstype set in fstab

- no mount error: means, if you mounted it, that it could mount sd-ext

Am i missing something?
[HTC Pico (Explorer)] cornholio_rules:
Just that MiniTool 'says' it was converted to ext3.

I think something in the kernel of pico overrides what it's in the code of the recovery, because when kernel 2.x was used, there was no problem at all with ext4. Respected devs say that kernel 3.x still needs some work, maybe this issue too.

Edit:

By the way, official TWRP has the same issue, too much coincidence isn't it?

http://xdaforums.com/showthread.php?p=42243989
[HTC Pico (Explorer)] Phil3759:
Well, really, on my side, there is nothing i can do. Formatting in cwm is using mke2fs cm-10.1 source
[HTC Pico (Explorer)] cornholio_rules:
Ok, I appreciate very much your concern. I wish the best for your recovery but, I'd really love if you worked for TWRP, I'm nor a big fan of cwm.
[HTC Pico (Explorer)] Nihar.G:
[MENTION=4666971]Phil3759[/MENTION] : About touch debug version:

When I press home key, (left most) recovery scrolls up but it keeps doing that for a moment. and stops after scrolling through all the menu items.

Same happens with the options button which is the second button from left but in downward direction.

The back button, which is the third button from left, make you go back in the recovery. But again, registers multiple touches.

The right most button which is the search button, selects the highlighted menu item, but again, it registers multiple touches. It automatically selects the current highlighted menu item and the next highlighted menu item in the submenu that comes after the first registered touch. (Hope I'm clear enough.).

The problem isn't solved by disabling key repeat.

Log attached.
[HTC Pico (Explorer)] Phil3759:
Big thanks, you made evident a nice touch bug that probably would affect other devices

Fixed here: 5.06.4

http://d-h.st/users/philz_touch/?fld_id=16058#files

Please, report about:

1- touch device capacitive buttons

2- when you do a backup: recovery, boot and misc partition size should be now detected correctly, unlike previous debug version
[HTC Pico (Explorer)] @rcane:
1. capacitive button on phone working great.

2.I try to take backup only boot.img

IT SAYS,

REQUIRED space : 54 mb

and after taking backup it shows in summery BACKUP SIZE : 4.01 mb so i think its fine now.
[HTC Pico (Explorer)] Phil3759:
Thank you for the feedback

Finally, we got a working recovery for pico

However, the size estimation of 54Mb is probably related to a smaller block size of your actual mtd partition, as reported by cat /proc/partitions

Anyone can post the output from adb shell:

cat /proc/partitions
[HTC Pico (Explorer)] ru5l4n12:
Why when to recharge the battery while turned off, the battery icon does not appear ... ???:confused:
[HTC Pico (Explorer)] Nihar.G:
Here:

major minor #blocks name

7 0 16664 loop0

31 0 1024 mtdblock0

31 1 5120 mtdblock1

31 2 4096 mtdblock2

31 3 240896 mtdblock3

31 4 60416 mtdblock4

31 5 153600 mtdblock5

31 6 10240 mtdblock6

179 0 15558144 mmcblk0

179 1 14510080 mmcblk0p1

179 2 1036288 mmcblk0p2

254 0 16663 dm-0
[HTC Pico (Explorer)] Nihar.G:
Thats because offline charging is not present in the recovery. I'll be working on it after I'm done with fixing 4.2.2 bugs.
[HTC Pico (Explorer)] Phil3759:
I also never include png for recharge. Should I do?
[HTC Pico (Explorer)] Red Devil:
[MENTION=4666971]Phil3759[/MENTION] Hope this helps you Post

Our bootloader sends our phone into the recovery as soon as it detects the charging while the phone is off.

Probably this behaviour was in stock. Where the recovery contained the charging animations.

Problem with our phone is that the recovery partition is too small.

So the .rles dont fit into the recovery.img.

That was the problem faced in TWRP as well..

UPDATE : This recovery has the offline charging enabled. This is a custom recovery [MENTION=3267652]Yannou90[/MENTION]

UPDATE 2 : Stock recovery for our phone : View attachment recovery_signed.img.zip..
[HTC Pico (Explorer)] Phil3759:
Strange.

/boot is mtdblock2

It has 4096 blocks of 1024 bytes. This should give 4mb exactly. I cannot believe stats show 54mb estimation just for /boot.

Any one else can post a log just aftet you start a backup (you can cancel it to spare time)?
[HTC Pico (Explorer)] Red Devil:
http://pastie.org/8018750
[HTC Pico (Explorer)] Phil3759:
That's from old 5.06.1. I fixed issues in 5.06.4. Please provide log from latest version
[HTC Pico (Explorer)] Red Devil:
oops seem to have missed the newer post.. my bad. :(

Will do it right away..

here another Log http://pastie.org/8019075
[HTC Pico (Explorer)] Phil3759:
This is just perfect now

All issues seem fixed, recovery wise

Many thanks for the log. Backup size is precisely detected now
[HTC Pico (Explorer)] cornholio_rules:
Great! Now big names in Pico Dev have acknowledge the ext4 issue resides in kernel, when it's fixed this recovery will have to be updated too, right?
[HTC Pico (Explorer)] Phil3759:
Probably no. All in recovery is done for ext4
[HTC Pico (Explorer)] Nihar.G:
What the heck is problem with ext4? -.-
[HTC Pico (Explorer)] cornholio_rules:
Even partition sd-ext now?

Haven't you read the posts? Ok, in TWRP there's also a problem with ext4 and [MENTION=4621813]legen_dary[/MENTION] has committed to fix this issue related to the kernel. This recovery also needs pico kernel, doesn't it?
[HTC Pico (Explorer)] Nihar.G:
ext2/3/4 all partitions work properly for me.
[HTC Pico (Explorer)] Phil3759:
Recovery needs a kernel

Without NiharG, this CWM mod would never have seen the light for pico. He modded kernel, enabled lza compression and helped a lot in debugging and porting it. It took a lot of time and many pre-releases before you saw a first public version. All the behind the scene debugging was done by NiharG. He also helped a lot through PM in debugging recent touch issues, he provided adb shell outputs to debug partition size detection...

So, be comprehensive with him

So, as you see, we are all willing to fix bugs and help.

Now, it would be more helpful to link NiharG to the threads proving your assumption about kernel.

Instead of posting: the big names proved, @ xxx-SomeOne proved, post a link to the discussion and fixes. That way, we could help you
[HTC Pico (Explorer)] cornholio_rules:
I know Nihar has done a great job, I've already told that to him. I didn't put the link because I think of 'bad taste' to publish someone's work in this thread, but sure I'll tell him when the fix in kernel is done.

Good job both of you. :thumbup:
[HTC Pico (Explorer)] Phil3759:
I see no harm in posting links to others work. As long as it is open source and credits are given, it is a fair game and completely allowed on xda
[HTC Pico (Explorer)] cornholio_rules:
I:Checking for extendedcommand & OpenRecoveryScript...

I:Skipping execution of extendedcommand, file not found...

I:Skipping execution of OpenRecoveryScript, file not found...

mtd: successfully wrote block at 0

I:Set boot command ""

W:failed to mount /dev/block/mmcblk0p2 /sd-ext ext4 (Invalid argument)

Error mounting /sd-ext!

W:failed to mount /dev/block/mmcblk0p2 /sd-ext ext4 (Invalid argument)

Error mounting /sd-ext!

mtd: successfully wrote block at 0

I:Set boot command ""

Log copied to /sdcard/clockworkmod/philz_recovery.log
[HTC Pico (Explorer)] IronFistYo:
Here I also have a log

When I was making nandroid backup, there was error in mounting this ext4 partition..

Log - http://pastebin.com/FU3QHqtJ
[HTC Pico (Explorer)] Phil3759:
1- you are using an older version

2- more info are needed about your sd-ext:

http://xdaforums.com/showpost.php?p=42239682&postcount=96

Till now, no one provided a log showing a mount failure with above steps :rolleyes:
[HTC Pico (Explorer)] IronFistYo:
Ok wait I will give you the log within an hour or two.. Bit busy now..

Will post the link in this post only...

And for your information, I am using the latest version of your recovery.. 5.06.1

Edit:

Here's the recovery log as you mentioned .. For v 5.06.1 - http://pastebin.com/rz7TsnwE

I have an ext3 partition.. I checked

Sorry couldn't provide the log for latest version..
[HTC Pico (Explorer)] Phil3759:
Latest version is 5.06.4

http://d-h.st/users/philz_touch/?fld_id=16058#files

OP did not update the post
[HTC Pico (Explorer)] Nihar.G:
Updated :p
[HTC Pico (Explorer)] cornholio_rules:
If you add to the log which FS is mounting, maybe we could help. You'll never see a fail mounting ext3. -.- Greetings Nihar :)
[HTC Pico (Explorer)] IronFistYo:
LOL.!

In my case , while backing up, it failed to mount the sd-ext partition. and as i mentioned , i have an ext3 FS ...

In the recovery log of backup that i posted before, it says it failed to mount ext4... but i have ext3 ....!

dafaq is that? :laugh:
[HTC Pico (Explorer)] Nihar.G:
Thats because sd-ext is defined as ext4 in fstab.

However, When I checked, ext2/3/4 all worked fine. I don't know whats going wrong with you phones :p
[HTC Pico (Explorer)] IronFistYo:
Well, we provided you logs, you are the developers, you should figure that out... We don't know much...

But the thing is... the sd-ext partition is not working now and it is a must feature for many user...

So, you should try to fix the already best recovery for our dear little pico...:good:

--_--_-- PEACE-OUT --_--_--
[HTC Pico (Explorer)] Phil3759:
I already said it many times

If you partition in recovery, it will be ext3, that's cwm for now

You have to format it to ext4 using above steps I gave you

After that, you'll have sd-ext in ext4 and happy mounting

Now, if this doesn't work, it would need a second look
[HTC Pico (Explorer)] Phil3759:
[MENTION=4626557]Nihar.G[/MENTION]

I am releasing 5.06.6 with sdparted option for ext3 and ext4

Should I sync kernel to your cm-10.1 branch?

I am still sticking to master, which I just noticed is not updated

If yes, I keep same device tree or some changes are needed with newer kernel?

Note: I added option to partition in recovery directly in ext4 instead of default ext3 (v5.06.6)
[HTC Pico (Explorer)] Nihar.G:
Nope. The branch is only for ROMs. Using it will break the compression and will make the size greater than 5 Mb and hence it wont flash. Use master / recoveries branch. (both are same at this moment.)

If there are any further updates to kernel which are needed / beneficial for recovery, Ill update this branch. :)
[HTC Pico (Explorer)] Phil3759:
Thank you,

Had a doubt too since you built it specifically for recovery
[HTC Pico (Explorer)] Phil3759:
5.06.6 (13.06.2013)

http://d-h.st/users/philz_touch/?fld_id=16058#files
[HTC Pico (Explorer)] Nihar.G:
Thank you!

OP updated with latest link. :)