commit 6ed69c9df6fa042689a464f2b8489a584c96cf6d Author: Piotr Dobrowolski Date: Wed Jan 27 02:08:18 2016 +0100 Initial commit diff --git a/data/config b/data/config new file mode 100644 index 0000000..34d999d --- /dev/null +++ b/data/config @@ -0,0 +1,2 @@ +openwrt-ar71xx-generic-zsun-sdreader-kernel.bin:S:/dev/mtd3 +openwrt-ar71xx-generic-zsun-sdreader-rootfs-squashfs.bin:S:/dev/mtd2 diff --git a/data/minreboot b/data/minreboot new file mode 100755 index 0000000..a8e104e Binary files /dev/null and b/data/minreboot differ diff --git a/data/mtd_write b/data/mtd_write new file mode 100755 index 0000000..88d8c88 --- /dev/null +++ b/data/mtd_write @@ -0,0 +1,10 @@ +#!/bin/sh + +cp ./minreboot /tmp +chmod +x /tmp/minreboot + +./mtd_write.actual write openwrt-ar71xx-generic-zsun-sdreader-kernel.bin /dev/mtd3 +./mtd_write.actual write openwrt-ar71xx-generic-zsun-sdreader-rootfs-squashfs.bin /dev/mtd2 + +/tmp/minreboot +# aaaaand there we go ,_, diff --git a/data/mtd_write.actual b/data/mtd_write.actual new file mode 100755 index 0000000..f3a4711 Binary files /dev/null and b/data/mtd_write.actual differ diff --git a/flashfirmware b/flashfirmware new file mode 100755 index 0000000..57ed355 --- /dev/null +++ b/flashfirmware @@ -0,0 +1,21 @@ +#!/bin/bash + +echo "** Building firmware" +. ./makefirmware + +UPDATEFILE=${MODEL}-update.tar.gz + +echo -n "** Switching mode..." +curl http://10.168.168.1:8080/goform/Setcardworkmode?workmode=0 +echo + +echo "** Uploading firmware" +while ! smbclient \\\\10.168.168.1\\public -U Admin%xxx -c "mkdir .update ; cd .update ; put ${UPDATEFILE}"; do + echo -n "!! smbclient failed, retrying ... " + sleep 3 +done + +echo -n "** Now doing system update ... " +curl http://10.168.168.1:8080/goform/upFirmWare + +echo '** If command above returned {"status":2} your device should now blink for a while and then reboot' diff --git a/makefirmware b/makefirmware new file mode 100755 index 0000000..475b99d --- /dev/null +++ b/makefirmware @@ -0,0 +1,10 @@ +#!/bin/bash + +VERSION=${VERSION:-1.1} +MODEL=${MODEL:-SD100} +OUTDIR=${OUTDIR:-$(dirname $0)} +DATADIR=${DATADIR:-$(dirname $0)/data} + +tar zcvf $OUTDIR/intermediate-v${VERSION}.tar.gz -C $DATADIR . +md5sum $OUTDIR/intermediate-v${VERSION}.tar.gz | cut -d ' ' -f 1 > md5 +tar zcvf $OUTDIR/${MODEL}-update.tar.gz $OUTDIR/intermediate-v${VERSION}.tar.gz md5 diff --git a/minreboot.c b/minreboot.c new file mode 100644 index 0000000..288db5a --- /dev/null +++ b/minreboot.c @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART, NULL); + return 0; +}