aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mvebu/cortexa9/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mvebu/cortexa9/base-files')
-rw-r--r--target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds9
-rw-r--r--target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network3
-rw-r--r--target/linux/mvebu/cortexa9/base-files/lib/upgrade/fortinet.sh54
-rwxr-xr-xtarget/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh3
4 files changed, 69 insertions, 0 deletions
diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds b/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds
index 2b045d0945..bfc589e6c0 100644
--- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds
+++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/01_leds
@@ -15,6 +15,15 @@ ctera,c200-v2)
ucidef_set_led_usbport "usb2" "USB2" "green:usb-2" "usb1-port1" "usb2-port1"
ucidef_set_led_usbport "usb3" "USB3" "green:usb-1" "usb1-port2" "usb2-port2"
;;
+fortinet,fg-50e)
+ ucidef_set_led_netdev "wan1_link" "WAN1 Link" "green:speed_wan1" "eth1" "link"
+ ucidef_set_led_netdev "wan2_link" "WAN2 Link" "green:speed_wan2" "eth2" "link"
+ ucidef_set_led_netdev "lan1_link" "LAN1 Link" "green:speed_lan1" "lan1" "link"
+ ucidef_set_led_netdev "lan2_link" "LAN2 Link" "green:speed_lan2" "lan2" "link"
+ ucidef_set_led_netdev "lan3_link" "LAN3 Link" "green:speed_lan3" "lan3" "link"
+ ucidef_set_led_netdev "lan4_link" "LAN4 Link" "green:speed_lan4" "lan4" "link"
+ ucidef_set_led_netdev "lan5_link" "LAN5 Link" "green:speed_lan5" "lan5" "link"
+ ;;
kobol,helios4)
ucidef_set_led_usbport "USB" "USB" "helios4:green:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1" "usb5-port1"
;;
diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network
index d2229fe6bf..9db29d52df 100644
--- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network
+++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network
@@ -18,6 +18,9 @@ mvebu_setup_interfaces()
cznic,turris-omnia)
ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" "eth2"
;;
+ fortinet,fg-50e)
+ ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "eth1 eth2"
+ ;;
iptime,nas1dual)
ucidef_set_interface_lan "eth0 eth1" "dhcp"
;;
diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/fortinet.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/fortinet.sh
new file mode 100644
index 0000000000..a2742aa374
--- /dev/null
+++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/fortinet.sh
@@ -0,0 +1,54 @@
+. /lib/functions.sh
+
+fortinet_fwinfo_blocks() {
+ local fwinfo_mtd="$(find_mtd_part firmware-info)"
+ local offset="$1"
+ local len="$2"
+ local blks
+
+ if [ -z "$fwinfo_mtd" ]; then
+ echo "WARN: MTD device \"firmware-info\" not found"
+ return 1
+ fi
+
+ blks=$((len / 0x200))
+ [ $((len % 0x200)) -gt 0 ] && blks=$((blks + 1))
+ blks=$(printf "%04x" $blks)
+ printf "fwinfo: offset-> 0x%x, blocks-> 0x%s (len: 0x%08x)\n" \
+ $offset $blks $len
+
+ printf "\x${blks:2:2}\x${blks:0:2}" | \
+ dd bs=2 count=1 seek=$((offset / 2)) conv=notrunc of=${fwinfo_mtd}
+}
+
+fortinet_do_upgrade() {
+ local board_dir="$(tar tf "$1" | grep -m 1 '^sysupgrade-.*/$')"
+ local kern_mtd="$(find_mtd_part kernel)"
+ local root_mtd="$(find_mtd_part rootfs)"
+ local kern_len root_len
+
+ board_dir="${board_dir%/}"
+
+ if [ -z "$kern_mtd" ] || [ -z "$root_mtd" ]; then
+ echo "ERROR: MTD device \"kernel\" or \"rootfs\" not found"
+ umount -a
+ reboot -f
+ fi
+
+ kern_len=$( (tar xOf "$1" "$board_dir/kernel" | wc -c) 2> /dev/null)
+ root_len=$( (tar xOf "$1" "$board_dir/root" | wc -c) 2> /dev/null)
+
+ if [ -z "$kern_len" ] || [ -z "$root_len" ]; then
+ echo "ERROR: failed to get length of new kernel or rootfs"
+ umount -a
+ reboot -f
+ fi
+
+ fortinet_fwinfo_blocks "0x184" "$kern_len"
+ fortinet_fwinfo_blocks "0x18c" "$root_len"
+
+ tar xOf "$1" "$board_dir/kernel" | \
+ mtd write - "kernel"
+ tar xOf "$1" "$board_dir/root" | \
+ mtd ${UPGRADE_BACKUP:+-j "${UPGRADE_BACKUP}"} write - "rootfs"
+}
diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh
index 9019c1aeff..fbbb68e05e 100755
--- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh
@@ -52,6 +52,9 @@ platform_do_upgrade() {
solidrun,clearfog-pro-a1)
legacy_sdcard_do_upgrade "$1"
;;
+ fortinet,fg-50e)
+ fortinet_do_upgrade "$1"
+ ;;
linksys,wrt1200ac|\
linksys,wrt1900ac-v1|\
linksys,wrt1900ac-v2|\