OpenELEC Testbuilds for RaspberryPi
(2013-01-28, 16:17)popcornmix Wrote: Have you changed the kernel, or the init script to do this? Can you post your change?

Just the init script. The full patch is here (it should be in github too, but it's playing up for me right now). The patch also includes fixes for NFS and USB auto-update.

As for the anti-corruption check, it's a right old hack, but seems to reliably detect potential SD card problems.

Rather than rely on dmesg to detect SD problems (which isn't included by default in the initramfs build, and the relevant mmc0 messages appear too late anyway, see boot log), the modified init script (function media_check) times how long it takes to write a ~1MB file to the FAT partition, and reboots if it takes too long. This all happens before the ext4 partition is mounted, which usually ends up being corrupted if the SD card is misbehaving.

In normal circumstances writing a 1MB file to SD card should take about 1/10th of a second, but when the SD card is not initialised correctly (which I believe leads to later file and/or partition corruption), the same file takes up to 40 seconds to write. Whenever the write takes longer than 5000 milliseconds (which is the default value for iotimeout, change it in cmdline.txt, or disable the check entirely with iotimeout=0), then the Pi will reboot and keep rebooting until it can write the file in under 5 seconds (it normally only takes one boot, very occasionally I've seen it need two reboots).

When the SD card is working correctly, you'll not notice any difference in the boot sequence (you might notice "Media check - please wait..." flash on the screen), but on those occasions when the SD card is not working correctly you'll experience a 10-40 second delay, and an extra reboot, but at least your partition won't be trashed, and you can still auto-update with some degree of certainty that it will actually work.

It's obviously not an ideal solution, but that would be the elimination of the initialisation problem from happening in the first place!

Somewhat counter-intuitively the fix involves writing a file to the FAT partition, but this seems to be more resilient than ext4, although often the files that are written when the SD card is misbehaving - such as kernel.img, bootcode.bin, etc. - will be corrupt, fortunately I'm not really interested in the integrity of the 1MB test file, only how long it takes to write.
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.


Messages In This Thread
MythTV PVR: No Video - by hkramski - 2012-11-13, 20:32
RE: OpenELEC Testbuilds for RaspberryPi - by Milhouse - 2013-01-28, 16:38
Cumulative Small Skip forward ... - by xandy - 2013-02-03, 15:46
:00 - by Koloss - 2013-07-14, 12:09
RE: :00 - by popcornmix - 2013-07-14, 12:28
Logout Mark Read Team Forum Stats Members Help
OpenELEC Testbuilds for RaspberryPi12