@@ -32,6 +32,67 @@ redboot_fis_do_upgrade() {
fi
}
+nand_nor_do_upgrade() {
+ local upgrade_file="$1"
+
+ local magic
+ local found_nor_part
+
+ # If here, the metadata check has already passed (or --force)
+ # ath79:nand so far only uses uImage and tar files
+
+ magic=$(get_magic_long "$upgrade_file")
+ case "$magic" in
+
+ "27051956") #define IH_MAGIC 0x27051956 /* [U-Boot] Image Magic Number */
+
+ found_nor_part="Not yet"
+ for pn in "$PART_NAME" "nor_${PART_NAME}" ; do # firmware
+
+ if [ "$(find_mtd_index "$pn")" ] ; then
+ PART_NAME="$pn"
+ found_nor_part=''
+ >&2 printf "Running NOR upgrade\n"
+ default_do_upgrade "$upgrade_file"
+ fi
+ done
+ if [ -n "$found_nor_part" ] ; then
+ >&2 printf "ERROR: UPGRADE FAILED: Unable to locate '$PART_NAME' or 'nor_${PART_NAME}'\n"
+ sleep 5
+ exit 1
+ fi
+ ;;
+
+
+ *) # has to be a tar file of some sort
+
+ for pn in "$CI_KERNPART" "nand_${CI_KERNPART}" ; do # kernel
+
+ if [ "$(find_mtd_index "$pn")" ] ; then
+ CI_KERNPART="$pn"
+ break
+ fi
+ done
+ for pn in "$CI_UBIPART" "nand_${CI_UBIPART}" ; do # ubi
+
+ if [ "$(find_mtd_index "$pn")" ] ; then
+ CI_UBIPART="$pn"
+ break
+ fi
+ done
+ for pn in "$CI_ROOTPART" "nand_${CI_ROOTPART}" ; do #rootfs
+
+ if [ "$(find_mtd_index "$pn")" ] ; then
+ CI_ROOTPART="$pn"
+ break
+ fi
+ done
+ >&2 printf "Running NAND upgrade\n"
+ nand_upgrade_tar "$upgrade_file"
+ ;;
+ esac
+}
+
platform_check_image() {
return 0
}
@@ -47,6 +108,10 @@ platform_do_upgrade() {
ubnt,routerstation-pro)
redboot_fis_do_upgrade "$ARGV" kernel
;;
+ glinet,gl-ar300m-nand |\
+ glinet,gl-ar300m-nor)
+ nand_nor_do_upgrade "$ARGV"
+ ;;
*-nand)
nand_do_upgrade "$ARGV"
;;