Skip to content

Instantly share code, notes, and snippets.

@maurerle
Last active July 25, 2023 10:36
Show Gist options
  • Save maurerle/16e45abe540725373bdc42270110a30c to your computer and use it in GitHub Desktop.
Save maurerle/16e45abe540725373bdc42270110a30c to your computer and use it in GitHub Desktop.
Single Script to flash a fritzbox directly - superseded by https://github.com/maurerle/fritz-tools/blob/master/fritzflash.py
#!/bin/sh
# usage: skript.sh eno2 ./gluon-ffac-7520-sysupgrade.img
ip a a 192.168.178.2/24 dev $dev
set -e
image="$2"
dev="$1"
while ! ping -c 1 -w 1 192.168.178.1 > /dev/null 2>&1; do
echo "wait 1 second"
sleep 1
done
sleep 1
tnftp -n -v -q 150 -p "192.168.178.1" << EOF
quote USER adam2
quote PASS adam2
binary
quote MEDIA FLSH
put $image mtd1
EOF
# ./eva_ramboot.py --offset 0x85000000 192.168.178.1 uboot-fritz7530.bin
sleep 300
ip a d 192.168.178.2/24 dev $dev
ip a a 192.168.1.2/24 dev $dev
while ! ping -c 1 -w 1 192.168.1.1 > /dev/null 2>&1; do
echo "wait 1 second"
sleep 1
done
sleep 1
SCP="scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
SSH="ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
$SCP ./uboot-fritz7530.bin [email protected]:/tmp
$SCP ./avm_fritzbox-7530-squashfs-sysupgrade.bin [email protected]:/tmp
$SSH -c [email protected] "mtd write /tmp/uboot-fritz7530.bin uboot0 && mtd write /tmp/uboot-fritz7530.bin uboot1"
$SSH -c [email protected] "ubirmvol /dev/ubi0 --name=avm_filesys_0 && ubirmvol /dev/ubi0 --name=avm_filesys_1"
$SSH -c [email protected] "sysupgrade -n /tmp/avm_fritzbox-7530-squashfs-sysupgrade.bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment