Last active
December 4, 2023 10:58
-
-
Save minhng99/b8d80199e984706ab5ea0d41161a6b55 to your computer and use it in GitHub Desktop.
OpenWRT flash script for Nokia Airscale AC220i
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 | |
HOST=http://192.168.10.2 | |
KERNEL=openwrt-ipq40xx-generic-nokia_ac220i-squashfs-uImage.itb | |
ROOTFS=openwrt-ipq40xx-generic-nokia_ac220i-squashfs-rootfs.sqsh | |
HASH=sha256sums | |
echo "Going to /tmp" | |
cd /tmp | |
echo "Cleaning up to get some extra space" | |
rm -rf /var/log/* /alarm* | |
echo "Downloading new firmware" | |
wget $HOST/$KERNEL -q | |
wget $HOST/$ROOTFS -q | |
echo "Verifying firmware" | |
wget $HOST/$HASH -O - -q | grep -e "$KERNEL\|$ROOTFS" | sha256sum -c | |
if [ $? -ne 0 ] | |
then | |
echo "ERROR: File corrupted" | |
echo "Aborting, cleaning up..." | |
rm -rf $KERNEL $ROOTFS | |
exit | |
fi | |
echo "Creating fw_env for uboot-envtools" | |
echo "/dev/mtd12 0x0000 0x10000 0x10000" > /etc/fw_env.config | |
echo "Setting primaryboot to partA" | |
echo 0 > /proc/boot_info/rootfs/primaryboot | |
mtd write /proc/boot_info/getbinary_bootconfig /dev/mtd5 | |
mtd write /proc/boot_info/getbinary_bootconfig /dev/mtd10 | |
echo "Disabling partB" | |
fw_setenv partAversion OpenWRT | |
fw_setenv partBversion Wi-Fi16A_AP.xx.xx.xx | |
#mtd erase /dev/mtd1 | |
echo "Backing up MAC, SN to u-boot env" | |
fw_setenv ethaddr $(cat /proc/eidData/MACAddress | sed -e 's/\([0-9A-Fa-f]\{2\}\)/\1:/g' -e 's/\(.*\):$/\1/') | |
fw_setenv serialnumber $(cat /proc/eidData/SerialNumber) | |
echo "Detaching UBI" | |
ubidetach -p /dev/mtd0 -f 2> /dev/null | |
ubidetach -p /dev/mtd1 -f 2> /dev/null | |
echo "Creating new UBI in partA" | |
ubiformat /dev/mtd0 -y | |
ubiattach -p /dev/mtd0 | |
echo "Creating new UBI Volume" | |
ubimkvol /dev/ubi0 -s $(wc -c $KERNEL | awk '{print $1}') -N kernel | |
ubimkvol /dev/ubi0 -s $(wc -c $ROOTFS | awk '{print $1}') -N ubi_rootfs | |
ubimkvol /dev/ubi0 -m -N rootfs_data | |
echo "Writing image..." | |
ubiupdatevol /dev/ubi0_0 $KERNEL | |
ubiupdatevol /dev/ubi0_1 $ROOTFS | |
echo "Done, system will force reboot NOW!" | |
sleep 2 | |
echo b > /proc/sysrq-trigger |
bác có nhận flash dòng này ko vậy, tks!
Nokia WI2A-AC200i
Nokia WI2B-AC220i
Connect TTL althought UART with CP210x cable
Jumper Header:
(1). VCC (Not connect)
(2). TX
(3).GND
(4). RX
(5). Unknow (Not connect)
After that understanding UBI Commandline
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dear Mr.Minh,
Could you sharing share me file KERNEL and ROOTFS?