View Single Post
Old 07-04-2015, 05:03 PM   #4
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Do you want me to look at it or do you want me to actually test it?

It LOOKS okay. I can test it tomorrow with another SD card if you like.

A different take: (only works if u-boot.mmc is identical to present u-boot)

Code:
recovery() {
    dd if=/dev/mmcblk0 bs=128k count=1 skip=6 of=/tmp/u-boot.cur

    for uboot in /etc/u-boot/*/u-boot.mmc
    do
        cmp /tmp/u-boot.cur $uboot \
        && dd if=$(dirname $uboot)/u-boot.recovery of=/dev/mmcblk0 bs=128k count=1 seek=6 \
        && success
    done

    failure
}
Could also use /mnt/sd/u-boot.backup instead of /tmp/u-boot.cur so - if it doesn't actually boot afterwards you could undo by writing u-boot.backup back to the internal microsd.

Quote:
There are people around who could tell just by reading the script!
I'm not so sure. I remember I tried this recovery u-boot at some point and even though I think I did the same things rcS does, it didn't actually work for me. Maybe my mistake, maybe something missing, but testing is important in any case.

Last edited by frostschutz; 07-04-2015 at 05:11 PM.
frostschutz is offline   Reply With Quote