Changed…
#!/bin/sh
if (! grep -q /dev/sda1 /proc/mounts); then echo "No install media mounted; couldn't find /dev/sda in /proc/mounts" exit 1; fi
echo
echo "This process will completely restore your E3's NAND." echo This will try and restore The Amstrad firmware on the device. Are you echo -n "sure you wish to continue? [y/N]: "
read i
if [ ! "x$i" = "xy" -a ! "x$i" = "xY" ]; then echo echo Aborting. exit 1 fi
echo echo Starting restore.. This might take a while...
perhaps_write_flash() { p=${1?} erase=${2?} f=/media/sda1/e3-nand.$p dev=/dev/mtd$p
test -e $f || return
echo found $f echo erasing $erase on $dev flash_erase $dev 0 $erase echo writing flash nandwrite -on $dev $f }
perhaps_write_flash 0 224 perhaps_write_flash 1 16 perhaps_write_flash 2 16 perhaps_write_flash 3 16 perhaps_write_flash 4 1728 perhaps_write_flash 5 48
echo "Finished restoring the Amstrad E3 Firmware," echo "Type Reboot or unplug E3 to see if the Amstrad E3 Splash Screen" echo "comes up (Fingers Crossed) If not just reinstall E3 Linux with the" echo "pbltool with the -n in the line to stop Handshaking otherwise it will" echo "not find PBL V4.9 Build:1311 bootloader."
Spanner..
http://amstrad-e3-hacking.freeforums.net
From: Ralph Corderoymailto:ralph@inputplus.co.uk Sent: Wednesday, 24 April 2019 12:48 To: Discussion of the Amstrad E3 emailer hardware/softwaremailto:e3-hacking@earth.li
Hi Nick,
is this right…??
perhaps_write_flash() { p=${1?} erase=${2?} f=/media/sda1/e3-nand-backup.$p dev=/dev/mtd$p
test -e $f || return echo found $f echo erasing $erase on $dev flash_erase $dev 0 $erase echo writing flash nandwrite -on $dev $f
}
That bit is.
perhaps_write_flash 0 224 perhaps_write_flash 0 16 perhaps_write_flash 0 16 perhaps_write_flash 0 16 perhaps_write_flash 0 1728 perhaps_write_flash 0 48
The function takes two parameters, in $1 and $2 at the start. The first parameter, copied into p, is the partition number, and so it needs to go 0, 1, ...
perhaps_write_flash 0 224 perhaps_write_flash 1 16 perhaps_write_flash 2 16 perhaps_write_flash 3 16 perhaps_write_flash 4 1728 perhaps_write_flash 5 48
I also think you might want to remove the `-backup' in f's definition near the start because your script said they were called e3-nand.0, etc.
What you've given here replaces the six blocks of if...then...fi lines in your original script, leaving the bit before and after.
-- Cheers, Ralph.
_______________________________________________ e3-hacking mailing list e3-hacking@earth.li https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.earth....