openwrt/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
Sheng Huang 985af21123 ramips: add support for JDCloud RE-CP-02
- Soc: MediaTek MT7621AT
- RAM: 512 MB (DDR3)
- Flash: 16 MB (SPI NOR)
- WiFi: MediaTek MT7905DAN, MediaTek MT7975DN
- Ethernet: 1 WAN, 3 LAN (Gigabit)
- Buttons: Reset, Joylink
- LEDs: (red, blue, green), routed to one indicator in the top of the
  device
- Power: DC 12V 1A tip positive
- 1 TF Card Slot

The pins for the serial console are already labeled on the board
J4(V, R, T, G). Serial settings: 3.3V, 115200

MAC addresses:

|         | MAC               | Algorithm |
| ------- | ----------------- | --------- |
| label   | dc:d8:xx:xx:xx:01 | label     |
| LAN     | dc:d8:xx:xx:xx:01 | label     |
| WAN     | dc:d8:xx:xx:xx:02 | label+1   |
| WLAN 2g | dc:d8:xx:xx:xx:03 | label+2   |
| WLAN 5g | de:d8:xx:xx:xx:04 | label+3   |

1. rename the
   openwrt-ramips-mt7621-jdcloud_re-cp-02-squashfs-sysupgrade.bin
   to JDCOS.bin

2. start a TFTP server from IP address 192.168.68.10 and serve the
   image named JDCOS.bin

3. connect your device to the LAN port

4. power up the router and press any key on the console to interrupt
   the boot process.

5. enter the following commands on the router console

   1. setenv bootcount 6

   2. saveenv

   3. reset

      > NOTE: wait for the restart, it will automatically fetch the
      > image named JDCOS.bin from the TFTP server and write it into
      > the flash. After the writing is completed, the router will be
      > automatically restarted.

Unable to recognize large-capacity TF card, see #14042. But the patch
https://github.com/openwrt/openwrt/issues/14042#issuecomment-1910769942
works

Co-Authored-By: Jianti Chen <clbcjt@outlook.com>
Signed-off-by: Sheng Huang <shenghuang147@gmail.com>
2024-05-11 17:24:10 +02:00

48 lines
1.4 KiB
Bash
Executable File

#!/bin/sh /etc/rc.common
START=99
boot() {
case $(board_name) in
alfa-network,quad-e4g)
[ -n "$(fw_printenv bootcount bootchanged 2>/dev/null)" ] &&\
echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s -
;;
beeline,smartbox-turbo|\
beeline,smartbox-turbo-plus|\
rostelecom,rt-sf-1)
[[ $(hexdump -n 1 -e '/1 "%1d"' -s $((0x20001)) /dev/mtd3) == \
$((0xff)) ]] || printf '\xff' | dd of=/dev/mtdblock3 \
count=1 bs=1 seek=$((0x20001))
;;
jdcloud,re-cp-02)
echo -e "bootcount 0\nbootlimit 5\nupgrade_available 1" | /usr/sbin/fw_setenv -s -
;;
linksys,e5600|\
linksys,ea6350-v4|\
linksys,ea7300-v1|\
linksys,ea7300-v2|\
linksys,ea7500-v2|\
linksys,ea8100-v1|\
linksys,ea8100-v2)
mtd resetbc s_env || true
;;
belkin,rt1800|\
linksys,e7350|\
samknows,whitebox-v8)
fw_setenv bootcount 0
;;
zyxel,lte3301-plus)
[ $(printf %d $(fw_printenv -n DebugFlag)) -gt 0 ] || fw_setenv DebugFlag 1
[ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1
[ $(printf %d $(fw_printenv -n Image1Try)) -gt 0 ] && fw_setenv Image1Try 0
;;
zyxel,lte5398-m904|\
zyxel,nr7101)
[ $(printf %d $(fw_printenv -n DebugFlag)) -gt 0 ] || fw_setenv DebugFlag 0x1
[ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1
[ $(printf %d $(fw_printenv -n Image1Try)) -gt 0 ] && fw_setenv Image1Try 0
;;
esac
}