Add logs for commands
This commit is contained in:
parent
d2a7abb9bc
commit
59436a2251
|
@ -16,10 +16,11 @@ echo "Make sure your Game & Watch is turned on and in the time screen. Press ret
|
|||
read -n 1
|
||||
|
||||
mkdir -p backups
|
||||
mkdir -p logs
|
||||
|
||||
echo "Attempting to dump flash using adapter $1."
|
||||
echo "Running OpenOCD... (This will take roughly 30 seconds, you Game and Watch screen will blink in between.)"
|
||||
if ! openocd -f openocd/flash_"$1".cfg >/dev/null 2>&1; then
|
||||
if ! openocd -f openocd/flash_"$1".cfg >>logs/2_openocd.log 2>&1; then
|
||||
echo "Failed to dump SPI flash from device. Verify debug connection and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -8,6 +8,7 @@ if [[ $# -ne 1 ]]; then
|
|||
fi
|
||||
|
||||
ADAPTER=$1
|
||||
mkdir -p logs
|
||||
|
||||
if test -f backups/internal_flash_backup.bin; then
|
||||
echo "Already have a backup in backups/internal_flash_backup.bin, refusing to overwrite."
|
||||
|
@ -40,7 +41,7 @@ if ! openocd -f openocd/interface_"$1".cfg \
|
|||
-c "init;" \
|
||||
-c "halt;" \
|
||||
-c "dump_image backups/internal_flash_backup.bin 0x24000000 131072" \
|
||||
-c "exit;" >/dev/null 2>&1; then
|
||||
-c "exit;" >>logs/3_openocd.log 2>&1; then
|
||||
echo "Dumping internal flash failed."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,7 @@ if [[ $# -ne 1 ]]; then
|
|||
fi
|
||||
|
||||
ADAPTER=$1
|
||||
|
||||
mkdir -p logs
|
||||
|
||||
echo "Unlocking your device will erase its internal flash. Even though your backup"
|
||||
echo "is validated, this still can go wrong. Are you sure? (Y/y)"
|
||||
|
@ -28,7 +28,7 @@ echo "Unlocking device... (Takes up to 30 seconds.)"
|
|||
if ! openocd -f openocd/interface_"$1".cfg \
|
||||
-c "init;" \
|
||||
-c "halt;" \
|
||||
-f openocd/rdp0.cfg >/dev/null 2>&1; then
|
||||
-f openocd/rdp0.cfg >>logs/4_openocd.log 2>&1; then
|
||||
echo "Unlocking device failed."
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -18,7 +18,7 @@ if ! test -f backups/flash_backup.bin; then
|
|||
fi
|
||||
|
||||
ADAPTER=$1
|
||||
|
||||
mkdir -p logs
|
||||
echo "Ok, restoring original firmware! (We will not lock the device, so you won't have to repeat this procedure!)"
|
||||
|
||||
|
||||
|
@ -27,7 +27,7 @@ if ! openocd -f openocd/interface_"$1".cfg \
|
|||
-c "init;" \
|
||||
-c "halt;" \
|
||||
-c "program backups/internal_flash_backup.bin 0x08000000 verify;" \
|
||||
-c "exit;" >/dev/null 2>&1; then
|
||||
-c "exit;" >>logs/5_openocd.log 2>&1; then
|
||||
echo "Restoring internal flash failed. Check debug connection and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -40,3 +40,4 @@ if ! ./scripts/flashloader.sh $ADAPTER backups/flash_backup.bin; then
|
|||
fi
|
||||
|
||||
echo "Success, your device should be running the original firmware again!"
|
||||
echo "(You should power-cycle the device now)"
|
|
@ -40,7 +40,7 @@ if ! openocd -f openocd/interface_"$1".cfg \
|
|||
-c "reg sp [mrw 0x20000000];" \
|
||||
-c "reg pc [mrw 0x20000004];" \
|
||||
-c "echo \"Starting flash process\";" \
|
||||
-c "resume; exit;" >/dev/null 2>&1; then
|
||||
-c "resume; exit;" >>logs/flashloader.log 2>&1; then
|
||||
echo "Loading failed."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -48,9 +48,9 @@ fi
|
|||
|
||||
echo "Loaded flashloader, flashing SPI, please wait."
|
||||
|
||||
echo "(If this takes more than 2 minutes something went wrong.)"
|
||||
echo "(If the screen blinks rapidly, something went wrong.)"
|
||||
echo "(If the screen blinks slowly, everything worked but the script didn't detect it)"
|
||||
echo "\t(If this takes more than 2 minutes something went wrong.)"
|
||||
echo "\t(If the screen blinks rapidly, something went wrong.)"
|
||||
echo "\t(If the screen blinks slowly, everything worked but the script didn't detect it)"
|
||||
while true; do
|
||||
DONE_MAGIC=$(openocd -f openocd/interface_${1}.cfg -c "init; mdw ${VAR_program_done}" -c "exit;" 2>&1 | grep ${VAR_program_done} | cut -d" " -f2)
|
||||
if [[ "$DONE_MAGIC" == "cafef00d" ]]; then
|
||||
|
|
Loading…
Reference in New Issue