I've extracted some fw4uboot.sh parts from GEL files:
Command used:
openssl aes-128-cbc -in 1.bin.aes -out 1.bin -d -K "BAD8CFFEBBAAB5C4C3D8D4BFCAFDBEDD" -iv "0" -nopad
Also, fw4linux.sh seems to be encoded using some other key.
FW 1.80
#upgrade_shell
#check version first
showMessage 'Upgrading(1/4), check version...' 7 14
if checkVer "00.01.00.11.01"; then \
echo New version; \
else \
echo Old version; \
showMessage 'Upgrading failed, not new version!' 7 14;\
fi;
#check all md5
progress 16
showMessage 'Upgrading(2/4), check images...' 7 14
progress 17
if tar_find 0x88000000 Sardine.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} 856ee251bb839a7c231c2920903939c3; then \
echo check Sardine.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check Sardine.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find Sardine.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 app_gz.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} e3260cf08c98485d8d51c2fd83142c61; then \
echo check app_gz.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check app_gz.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find app_gz.img.gz error!;\
exit_from_shell;\
fi;
#update spi flash images
progress 19
showMessage 'Upgrading(3/4), flash images...' 7 14
#update nand images
mtdparts default;
echo 'set mtdparts environment';
setenv mtdparts "mtdparts=nand.0:1m(NAND.bootpic-usr),1m(NAND.bootpic-def)ro,1m(NAND.bootpic-def.bak)ro,512k(NAND.uboot-env),512k(NAND.uboot-env.bak),512k(NAND.fdt)ro,512k(NAND.fdt.bak)ro,8m(NAND.kernel)ro,8m(NAND.kernel.bak)ro,31m(NAND.reserved),180m(NAND.sardine)ro,100m(NAND.filesystem),20m(NAND.cal),-(NAND.userspace)"
echo 'del partitions';
mtdparts del NAND.reserved
mtdparts del NAND.sardine
echo 'add partitions';
mtdparts add nand0 0x01f00000@0x01500000 NAND.reserved
mtdparts add nand0 0x0b400000@0x03400000 NAND.sardine
saveenv
echo 'set mtdparts environment OK!';
if tar_find 0x88000000 Sardine.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.sardine; then \
progress 70;\
if nand write 0x82000000 NAND.sardine ${filesize}; then \
progress 74;\
else \
nand erase.part NAND.sardine; \
if nand write 0x82000000 NAND.sardine ${filesize}; then \
progress 74;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip Sardine.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar Sardine.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 app_gz.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.reserved; then \
progress 94;\
if nand write 0x82000000 NAND.reserved ${filesize}; then \
progress 98;\
else \
nand erase.part NAND.reserved; \
if nand write 0x82000000 NAND.reserved ${filesize}; then \
progress 98;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip app_gz.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar app_gz.img.gz error!;\
exit_from_shell;\
fi;
#env
echo 'set some env';
showMessage 'Upgrading(4/4), set some env...' 7 14
progress 99
setenv softver '00.01.00.11.01'
setenv builddate '2018.08.30 16:39:44'
setenv bootcmd nandboot
showMessage 'Upgrade OK, please reboot.' 7 14
progress 100
saveenv
echo 'System download OK!';
##end##
FW 2.02
#upgrade_shell
#check version first
showMessage 'Upgrading(1/4), check version...' 7 14
if checkVer "00.01.09.00.01"; then \
echo New version; \
else \
echo Old version; \
showMessage 'Upgrading failed, not new version!' 7 14;\
exit_from_shell;\
fi;
#check all md5
progress 16
showMessage 'Upgrading(2/4), check images...' 7 14
progress 17
if tar_find 0x88000000 Sardine.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} ac0f5b34f8b37c3648ad2995b911c611; then \
echo check Sardine.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check Sardine.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find Sardine.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 app_gz.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} 9d6a5188b8f2cc5254ed1b5d62b0f431; then \
echo check app_gz.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check app_gz.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find app_gz.img.gz error!;\
exit_from_shell;\
fi;
#update spi flash images
progress 19
showMessage 'Upgrading(3/4), flash images...' 7 14
#update nand images
mtdparts default;
if tar_find 0x88000000 Sardine.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.sardine; then \
progress 70;\
if nand write 0x82000000 NAND.sardine ${filesize}; then \
progress 74;\
else \
nand erase.part NAND.sardine; \
if nand write 0x82000000 NAND.sardine ${filesize}; then \
progress 74;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip Sardine.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar Sardine.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 app_gz.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.reserved; then \
progress 94;\
if nand write 0x82000000 NAND.reserved ${filesize}; then \
progress 98;\
else \
nand erase.part NAND.reserved; \
if nand write 0x82000000 NAND.reserved ${filesize}; then \
progress 98;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip app_gz.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar app_gz.img.gz error!;\
exit_from_shell;\
fi;
#env
echo 'set some env';
showMessage 'Upgrading(4/4), set some env...' 7 14
progress 99
setenv softver '00.01.09.00.01'
setenv builddate '2019.10.29 18:31:33'
setenv bootcmd nandboot
showMessage 'Upgrade OK, please reboot.' 7 14
progress 100
saveenv
echo 'System download OK!';
##end##
FW 2.04
#upgrade_shell
#check version first
showMessage 'Upgrading(1/4), check version...' 7 14
if checkVer "00.01.09.00.01"; then \
echo New version; \
else \
echo Old version; \
showMessage 'Upgrading failed, not new version!' 7 14;\
exit_from_shell;\
fi;
#check all md5
progress 16
showMessage 'Upgrading(2/4), check images...' 7 14
progress 17
if tar_find 0x88000000 logo.bmp.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} c1963c37d1742018cc1658103b48d969; then \
echo check logo.bmp.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check logo.bmp.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find logo.bmp.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 uImage.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} 683c8c204a06c9d5a15535973e1b991d; then \
echo check uImage.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check uImage.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find uImage.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 fdt.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} 4b38335267ccfa51bfeb5c361d6ffb1c; then \
echo check fdt.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check fdt.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find fdt.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 rootfs.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} c21426ba480b4cff028d819a7e2865a3; then \
echo check rootfs.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check rootfs.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find rootfs.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 Sardine.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} 03a9b8fc7d6a86f08679809af56ca86a; then \
echo check Sardine.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check Sardine.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find Sardine.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 logo.bmp.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} c1963c37d1742018cc1658103b48d969; then \
echo check logo.bmp.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check logo.bmp.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find logo.bmp.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 logo.bmp.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} c1963c37d1742018cc1658103b48d969; then \
echo check logo.bmp.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check logo.bmp.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find logo.bmp.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 uImage.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} 683c8c204a06c9d5a15535973e1b991d; then \
echo check uImage.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check uImage.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find uImage.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 fdt.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} 4b38335267ccfa51bfeb5c361d6ffb1c; then \
echo check fdt.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check fdt.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find fdt.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 app_gz.img.gz; then \
if md5sum -v ${tar_find_addr} ${filesize} 74ce13e40ae4fd1535f02e4e88d730e2; then \
echo check app_gz.img.gz success; \
else \
showMessage 'Upgrading failed, bad images!' 7 14;\
echo check app_gz.img.gz error; \
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar_find app_gz.img.gz error!;\
exit_from_shell;\
fi;
#update spi flash images
progress 19
showMessage 'Upgrading(3/4), flash images...' 7 14
#update nand images
mtdparts default;
if tar_find 0x88000000 logo.bmp.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.bootpic-def; then \
progress 39;\
if nand write 0x82000000 NAND.bootpic-def ${filesize}; then \
progress 43;\
else \
nand erase.part NAND.bootpic-def; \
if nand write 0x82000000 NAND.bootpic-def ${filesize}; then \
progress 43;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip logo.bmp.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar logo.bmp.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 uImage.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.kernel; then \
progress 46;\
if nand write 0x82000000 NAND.kernel ${filesize}; then \
progress 50;\
else \
nand erase.part NAND.kernel; \
if nand write 0x82000000 NAND.kernel ${filesize}; then \
progress 50;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip uImage.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar uImage.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 fdt.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.fdt; then \
progress 54;\
if nand write 0x82000000 NAND.fdt ${filesize}; then \
progress 58;\
else \
nand erase.part NAND.fdt; \
if nand write 0x82000000 NAND.fdt ${filesize}; then \
progress 58;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip fdt.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar fdt.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 rootfs.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.filesystem; then \
progress 62;\
if nand write 0x82000000 NAND.filesystem ${filesize}; then \
progress 66;\
else \
nand erase.part NAND.filesystem; \
if nand write 0x82000000 NAND.filesystem ${filesize}; then \
progress 66;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip rootfs.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar rootfs.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 Sardine.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.sardine; then \
progress 70;\
if nand write 0x82000000 NAND.sardine ${filesize}; then \
progress 74;\
else \
nand erase.part NAND.sardine; \
if nand write 0x82000000 NAND.sardine ${filesize}; then \
progress 74;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip Sardine.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar Sardine.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 logo.bmp.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.bootpic-usr; then \
progress 76;\
if nand write 0x82000000 NAND.bootpic-usr ${filesize}; then \
progress 80;\
else \
nand erase.part NAND.bootpic-usr; \
if nand write 0x82000000 NAND.bootpic-usr ${filesize}; then \
progress 80;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip logo.bmp.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar logo.bmp.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 logo.bmp.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.bootpic-def.bak; then \
progress 82;\
if nand write 0x82000000 NAND.bootpic-def.bak ${filesize}; then \
progress 86;\
else \
nand erase.part NAND.bootpic-def.bak; \
if nand write 0x82000000 NAND.bootpic-def.bak ${filesize}; then \
progress 86;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip logo.bmp.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar logo.bmp.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 uImage.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.kernel.bak; then \
progress 88;\
if nand write 0x82000000 NAND.kernel.bak ${filesize}; then \
progress 92;\
else \
nand erase.part NAND.kernel.bak; \
if nand write 0x82000000 NAND.kernel.bak ${filesize}; then \
progress 92;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip uImage.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar uImage.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 fdt.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.fdt.bak; then \
progress 94;\
if nand write 0x82000000 NAND.fdt.bak ${filesize}; then \
progress 98;\
else \
nand erase.part NAND.fdt.bak; \
if nand write 0x82000000 NAND.fdt.bak ${filesize}; then \
progress 98;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip fdt.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar fdt.img.gz error!;\
exit_from_shell;\
fi;
if tar_find 0x88000000 app_gz.img.gz; then \
if unzip ${tar_find_addr} 0x82000000 0x6000000; then \
if nand erase.part NAND.reserved; then \
progress 94;\
if nand write 0x82000000 NAND.reserved ${filesize}; then \
progress 98;\
else \
nand erase.part NAND.reserved; \
if nand write 0x82000000 NAND.reserved ${filesize}; then \
progress 98;\
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
fi; \
else \
showMessage 'Upgrading failed, write failed!' 7 14;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, unzip image error!' 7 14;\
echo unzip app_gz.img.gz error!;\
exit_from_shell;\
fi; \
else \
showMessage 'Upgrading failed, image not found!' 7 14;\
echo tar app_gz.img.gz error!;\
exit_from_shell;\
fi;
#env
echo 'set some env';
showMessage 'Upgrading(4/4), set some env...' 7 14
progress 99
setenv softver '00.01.09.00.01'
setenv builddate '2020.02.18 08:59:53'
setenv bootcmd nandboot
setenv kernel_size '0x409000'
setenv kernel_check '0x1174efc5'
setenv fdt_size '0x9140'
setenv fdt_check '0x614e138a'
showMessage 'Upgrade OK, please reboot.' 7 14
progress 100
saveenv
echo 'System download OK!';
##end##
FW 2.04 seems to have many changes to the previous.
I wondering how to patch this 1.08 script to downgrade my 2.02 unit. I get "ERROR: bad script!" message when trying to flash 1.08 FW.