Parcourir la source

scripts: linksys-image: add NAND devices

The larger switches of the Linksys LGS series (e.g. LGS352C) make
use of NAND. So the vendor firmware uses other commands to upload
an image through the WebUI.

Add the required scripts. With this we can upload an image to all
devices of that series. Independant of NOR or NAND.

Signed-off-by: Markus Stockhausen <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/16711
Signed-off-by: Robert Marko <[email protected]>
Markus Stockhausen il y a 1 an
Parent
commit
3098b4bf07
1 fichiers modifiés avec 21 ajouts et 3 suppressions
  1. 21 3
      scripts/linksys-image.sh

+ 21 - 3
scripts/linksys-image.sh

@@ -38,8 +38,8 @@ gen_fwinfo() {
 	echo 'FW_VERSION=1.01.100\nBOOT_VERSION=01.00.01'
 	echo 'FW_VERSION=1.01.100\nBOOT_VERSION=01.00.01'
 }
 }
 
 
-# The central upgrade script. It allows to install OpenWrt only to first partition.
-gen_imageupgrade() {
+# NOR upgrade script. It allows to install OpenWrt only to first partition.
+gen_nor_upgrade() {
 	echo '#!/bin/sh'
 	echo '#!/bin/sh'
 	echo 'flash_bank=65536'
 	echo 'flash_bank=65536'
 	echo 'filesize=`stat --format=%s ./series_vmlinux.bix`'
 	echo 'filesize=`stat --format=%s ./series_vmlinux.bix`'
@@ -58,16 +58,34 @@ gen_imageupgrade() {
 	echo 'esac'
 	echo 'esac'
 }
 }
 
 
+# NAND upgrade script. It allows to install OpenWrt only to first partition.
+gen_nand_upgrade() {
+	echo '#!/bin/sh'
+	echo 'case $1 in'
+	echo '1)'
+	echo 'flash_eraseall $2 >/dev/null 2>&1'
+	echo 'nandwrite -p $2 ./series_vmlinux.bix >/dev/null 2>&1'
+	echo 'mtd_debug read $2 0 100 image1.img >/dev/null 2>&1'
+	echo 'CreateImage -r ./image1.img > /tmp/app/image1.txt'
+	echo 'echo 0'
+	echo ';;'
+	echo '*)'
+	echo 'echo 1'
+	echo 'esac'
+}
+
 tmpdir="$( mktemp -d 2> /dev/null )"
 tmpdir="$( mktemp -d 2> /dev/null )"
 imgdir=$tmpdir/image
 imgdir=$tmpdir/image
 mkdir $imgdir
 mkdir $imgdir
 
 
 gen_imagecheck $3 > $imgdir/iss_imagecheck.sh
 gen_imagecheck $3 > $imgdir/iss_imagecheck.sh
-gen_imageupgrade > $imgdir/iss_imageupgrade.sh
+gen_nor_upgrade > $imgdir/iss_imageupgrade.sh
+gen_nand_upgrade > $imgdir/iss_nand_imageupgrade.sh
 gen_fwinfo > $imgdir/firmware_information.txt
 gen_fwinfo > $imgdir/firmware_information.txt
 
 
 chmod +x $imgdir/iss_imagecheck.sh
 chmod +x $imgdir/iss_imagecheck.sh
 chmod +x $imgdir/iss_imageupgrade.sh
 chmod +x $imgdir/iss_imageupgrade.sh
+chmod +x $imgdir/iss_nand_imageupgrade.sh
 
 
 cp $1 $imgdir/series_vmlinux.bix
 cp $1 $imgdir/series_vmlinux.bix