Last active
November 7, 2022 10:54
-
-
Save devbis/1b71d1a18e6b0b41250154a35a17a614 to your computer and use it in GitHub Desktop.
Upgrade to 21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo "Updating OpenWRT from version 19.07 to 21.02.5" | |
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/u-boot-xiaomi_dgnwg05lm/u-boot.imx -O /tmp/u-boot.imx | |
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/openlumi-21.02.5-imx6-imx6ull-xiaomi-dgnwg05lm.dtb -O /tmp/openwrt-imx6-imx6ull-xiaomi-dgnwg05lm.dtb | |
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/openlumi-21.02.5-imx6-xiaomi_dgnwg05lm-squashfs-sysupgrade.bin -O /tmp/openwrt-imx6-xiaomi_dgnwg05lm-squashfs-sysupgrade.bin | |
echo "The files are downloaded to the /tmp folder." | |
echo "Replacing model marks to allow upgrade with new files for update OpenWRT 21.02.5" | |
sed -i 's/gw5/xiaomi,dgnwg05lm/' /lib/upgrade/platform.sh | |
sed -i 's/Wandboard i.MX6 Dual Lite Board/Xiaomi Gateway DGNWG05LM/' /lib/imx6.sh | |
sed -i 's/name="wandboard"/name="xiaomi,dgnwg05lm"/' /lib/imx6.sh | |
echo 'xiaomi,dgnwg05lm' > /tmp/sysinfo/board_name | |
echo 'Xiaomi Gateway DGNWG05LM' > /tmp/sysinfo/model | |
sed -i 's/"id": "[-a-z\.,]*"/"id": "xiaomi,dgnwg05lm"/' /tmp/board.json | |
sed -i 's/board_name="$1"/board_name="${1\/,\/_}"/' /lib/upgrade/nand.sh | |
echo "Writing new uboot" | |
opkg update && opkg install kobs-ng | |
[ -f /tmp/u-boot.imx ] && kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 /tmp/u-boot.imx | |
echo "Writing new DTB" | |
[ -f /tmp/openwrt-imx6-imx6ull-xiaomi-dgnwg05lm.dtb ] && flash_erase /dev/mtd2 0 0 && nandwrite -p /dev/mtd2 -p /tmp/openwrt-imx6-imx6ull-xiaomi-dgnwg05lm.dtb | |
echo "Run sysupgrade in console" | |
[ -f /tmp/openwrt-imx6-xiaomi_dgnwg05lm-squashfs-sysupgrade.bin ] && sysupgrade -v -n /tmp/openwrt-imx6-xiaomi_dgnwg05lm-squashfs-sysupgrade.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo "Updating OpenWRT from version 19.07 to 21.02.5" | |
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/u-boot-xiaomi_dgnwg05lm/u-boot.imx -O /tmp/u-boot.imx | |
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/openlumi-21.02.5-imx6-imx6ull-aqara-zhwg11lm.dtb -O /tmp/openwrt-imx6-imx6ull-aqara-zhwg11lm.dtb | |
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/openlumi-21.02.5-imx6-aqara_zhwg11lm-squashfs-sysupgrade.bin -O /tmp/openwrt-imx6-aqara_zhwg11lm-squashfs-sysupgrade.bin | |
echo "The files are downloaded to the /tmp folder." | |
echo "Replacing model marks to allow upgrade with new files for update OpenWRT 21.02.5" | |
sed -i 's/gw5/aqara,zhwg11lm/' /lib/upgrade/platform.sh | |
sed -i 's/Wandboard i.MX6 Dual Lite Board/Aqara Gateway ZHWG11LM/' /lib/imx6.sh | |
sed -i 's/name="wandboard"/name="aqara,zhwg11lm"/' /lib/imx6.sh | |
echo 'aqara,zhwg11lm' > /tmp/sysinfo/board_name | |
echo 'Aqara Gateway ZHWG11LM' > /tmp/sysinfo/model | |
sed -i 's/"id": "[-a-z\.,]*"/"id": "aqara,zhwg11lm"/' /tmp/board.json | |
sed -i 's/board_name="$1"/board_name="${1\/,\/_}"/' /lib/upgrade/nand.sh | |
echo "Writing new uboot" | |
opkg update && opkg install kobs-ng | |
[ -f /tmp/u-boot.imx ] && kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 /tmp/u-boot.imx | |
echo "Writing new DTB" | |
[ -f /tmp/openwrt-imx6-imx6ull-aqara-zhwg11lm.dtb ] && flash_erase /dev/mtd2 0 0 && nandwrite -p /dev/mtd2 -p /tmp/openwrt-imx6-imx6ull-aqara-zhwg11lm.dtb | |
echo "Run sysupgrade in console" | |
[ -f /tmp/openwrt-imx6-aqara_zhwg11lm-squashfs-sysupgrade.bin ] && sysupgrade -v -n /tmp/openwrt-imx6-aqara_zhwg11lm-squashfs-sysupgrade.bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment