Note: While issuing the SCP commands detailed bellow, you might encounter errors related to option -O
not being recongnized. In such a case, simply leave out the -O
option from all SCP commnands.
This happens if you are using an SCP version older than 8.7 (use ssh -V
to check your version). The option is required on recent SCP versions due to deprecation of the old SCP/RCP protocol.
More details here.
Advanced > Status > System Information
and take note of the currently running stock firmware version.RAC2V1K-SSH.zip
. If the firmware is newer than what is listed in the zip, choose the latest available file.Advanced > Admin > Configuration
and use the restore from file option to upload the chosen configuration file. The router will reboot.stock4230w
and uncomment the SSH username and password corresponding to the your stock firmware version../stock4230w ssh '$HOST "cat /proc/version"'
Linux version 3.14.77 (jenkins@ci-server) (gcc version 5.2.0 (OpenWrt GCC 5.2.0 r35193) ) #1 SMP PREEMPT Thu Nov 15 03:39:25 UTC 2018
./stock4230w ssh '$HOST sh' <mtd-backup.sh
./stock4230w scp -O '$HOST:/tmp/lanchon/mtd-backup.tar .'
./stock4230w ssh '$HOST "rm /tmp/lanchon/mtd-backup.tar"'
./stock4230w ssh '$HOST sh' <ubi-backup.sh
./stock4230w scp -O '$HOST:/tmp/lanchon/ubi-backup.tar .'
./stock4230w ssh '$HOST "rm /tmp/lanchon/ubi-backup.tar"'
Make sure you have backups of the stock firmware (see previous section); each device is different.
./stock4230w scp -O 'openwrt-[...]-askey_rt4230w-rev6-initramfs-uImage $HOST:/tmp/recovery.bin'
./stock4230w ssh '$HOST sh' <install-recovery.sh
Flash image...
and choose the squashfs image.You can skip this procedure if the install script above did not recommend it.
ssh root@192.168.1.1 'ubirmvol /dev/ubi0 -N rootfs_data && ubimkvol /dev/ubi0 -N recovery -n 9 -s 12MiB && ubimkvol /dev/ubi0 -N rootfs_data -m'
scp -O openwrt-[...]-askey_rt4230w-rev6-initramfs-uImage root@192.168.1.1:/tmp/recovery.bin
ssh root@192.168.1.1 'ubiupdatevol /dev/ubi0_9 /tmp/recovery.bin && rm /tmp/recovery.bin'
A recovery image will run automatically if the main OS ever gets corrupted, for example due to an interrupted sysupgrade. Recovery will allow you to reinstall the main OS without needing access the serial interface, thus avoiding a soft-brick. The associated boot configuration will also cause the router to attempt a TFTP boot if main and recovery OSes are both corrupt. If you originally installed OpenWrt following the instructions above, you already have a recovery image installed. You can follow these steps to install a recovery image if you installed OpenWrt through any other method.
WARNING: This procedure modifies your bootloader configuration. In case of issues, the possibility of a soft-brick cannot be ruled out.
ssh root@192.168.1.1 "fw_setenv -s -" <<"EOF"
boot_setup_512M set mtdids nand0=nand0 && set mtdparts mtdparts=nand0:416M@0x2400000(mtd_ubi) boot_setup_256M set mtdids nand0=nand0 && set mtdparts mtdparts=nand0:220M@0x2400000(mtd_ubi)
boot_ubi_main ubi part mtd_ubi && ubi read 0x44000000 kernel && bootm boot_ubi_recovery ubi part mtd_ubi && ubi read 0x44000000 recovery && bootm
boot_main run boot_setup_512M; run boot_ubi_main; run boot_setup_256M; run boot_ubi_main boot_recovery run boot_setup_512M; run boot_ubi_recovery; run boot_setup_256M; run boot_ubi_recovery boot_main_or_recovery run boot_setup_512M; run boot_ubi_main; run boot_ubi_recovery; run boot_setup_256M; run boot_ubi_main; run boot_ubi_recovery
boot_tftp test -n "$ipaddr" || set ipaddr 192.168.1.1; test -n "$serverip" || set serverip 192.168.1.2; tftpboot recovery.bin && bootm
boot_custom test -n "$boot_pre" && run boot_pre; run boot_main_or_recovery; run boot_tftp
bootcmd run boot_custom bootdelay 2
EOF
echo "Exit code: $? (zero means no error)"
3. Reboot the router.
4. Restore the router configuration if applicable.
### Update the recovery image
There is usually no reason to upgrade the recovery image. This is provided for completeness.
1. [Download](https://firmware-selector.openwrt.org/?target=ipq806x%2Fgeneric&id=askey_rt4230w-rev6) the OpenWrt initramfs (kernel) image for this router.
2. Pop up a terminal and write the recovery image (replace 192.168.1.1 with the address of your router):
scp -O openwrt-[...]-askey_rt4230w-rev6-initramfs-uImage root@192.168.1.1:/tmp/recovery.bin ssh root@192.168.1.1 'ubiupdatevol /dev/ubi0_9 /tmp/recovery.bin && rm /tmp/recovery.bin'