gemini: Fix up firmware checksum on DIR-685
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 15 May 2019 20:37:26 +0000 (22:37 +0200)
committerChristian Lamparter <chunkeey@gmail.com>
Sat, 18 May 2019 14:37:30 +0000 (16:37 +0200)
Using the same method as the D-Link DAP-2695 A1 we use
the "mtd" tool to augment the firmware checkum in flash
on first boot of a new firmware on the D-Link DIR-685.
We need to augment the Makefile for "mtd" to build in
the special WRGG fixup support for Gemini as well.

This works around the problem of the machine not booting
after factory install unless the sysupgrade is applied
immediately.

Based on commit e3875350f3e4185020b64e0588bba521cd1d6e64
"ar71xx: add support for D-Link DAP-2695 rev. A1"

Cc: Stijn Tintel <stijn@linux-ipv6.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
package/system/mtd/src/Makefile
target/linux/gemini/base-files/etc/uci-defaults/09_fix-checksum [new file with mode: 0644]

index e469e23ef7b3fbcb694156347312f6b2f77b0564..e08a824cf8e476ebe70c95f4e3094e69037be1d4 100644 (file)
@@ -8,6 +8,7 @@ obj.wrg = wrg.o md5.o
 obj.wrgg = wrgg.o md5.o
 obj.tpl = tpl_ramips_recoveryflag.o
 obj.ar71xx = trx.o $(obj.seama) $(obj.wrgg)
+obj.gemini = $(obj.wrgg)
 obj.brcm = trx.o
 obj.brcm47xx = $(obj.brcm)
 obj.bcm53xx = $(obj.brcm) $(obj.seama)
diff --git a/target/linux/gemini/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/gemini/base-files/etc/uci-defaults/09_fix-checksum
new file mode 100644 (file)
index 0000000..5f79d1a
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Copyright (C) 2019 OpenWrt.org
+#
+
+. /lib/functions.sh
+
+board=$(board_name)
+
+fixwrgg() {
+       local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"kernel".*/\1/p' /proc/mtd)
+
+       [ "$kernel_size" ] && mtd -c 0x$kernel_size fixwrgg firmware
+}
+
+case "$board" in
+dlink,dir-685)
+       fixwrgg
+       ;;
+esac