octeon: add support for Itus Shield Router
authorDonald Hoskins <grommish@gmail.com>
Wed, 22 Jul 2020 09:26:33 +0000 (05:26 -0400)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Sun, 16 Aug 2020 00:15:06 +0000 (02:15 +0200)
Itus Networks Shield - 1Ghz dual-core mips64 / Cavium Octeon 3 SoC,
1Gb RAM, 4Gb eMMC,3 GbE 10/100/1000 ports

Information regarding device can be found:
https://deviwiki.com/wiki/Itus_Networks_Shield_Pro

Installing OpenWrt on Itus Networks Shield:

1) Boot Shield
2) On device: mount /dev/mmcblk1p1 /mnt
3) scp openwrt-octeon-itus,shield-router-initramfs-kernel.bin to
   /mnt/ItusrouterImage
3a) Optionally: scp openwrt-octeon-itus,shield-router-initramfs-kernel.bin
    to /mnt/ItusgatewayImage to allow you to have an emergency recovery
    boot in the GATEWAY slot - this slot will have no permament storage and
    is used for emergency recovery only when booted in the (G)ateway
    position
4) On device: umount /mnt
5) reboot

Once booted, run the sysupgrade via cli or luCi on the
openwrt-octeon-itus,shield-router-squashfs-sysupgrade.tar file the mode
you are running.

Once rebooted, the system installation is complete. Your storage partition
for the mode is inialized and set.

Signed-off-by: Donald Hoskins <grommish@gmail.com>
[cut out sysupgrade-* changes, move a few lines,
drop case CVMX_BOARD_TYPE_ITUS_SHIELD]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/octeon/base-files/etc/board.d/01_network
target/linux/octeon/base-files/lib/preinit/01_sysinfo
target/linux/octeon/base-files/lib/preinit/79_move_config
target/linux/octeon/base-files/lib/upgrade/platform.sh
target/linux/octeon/image/Makefile
target/linux/octeon/patches-5.4/130-itus_shield_support.patch [new file with mode: 0644]

index f5c8175c54d2b8c324c18447dee1ebb0906a1bb6..c1b614f601f06afed43ad64e6afef5de3b9f13fd 100755 (executable)
@@ -8,6 +8,9 @@
 board_config_update
 
 case "$(board_name)" in
+itus,shield-router)
+       ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0"
+       ;;
 *)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
        ;;
index d8f467ed27715ebecfbfc3e0598da2b80b76c836..34fa7392d2267984901f3180b3906f1cbcc9d8d7 100644 (file)
@@ -17,6 +17,10 @@ do_sysinfo_octeon() {
                name="erpro"
                ;;
 
+       "ITUS_SHIELD"*)
+               name="itus,shield-router"
+               ;;
+
        *)
                name="generic"
                ;;
index 866bef495b4d1cd3f4e8bdf10801a2903d660f0f..fd780a9461c99d8d5dc2e663a0404ce36a46b63c 100644 (file)
@@ -10,6 +10,11 @@ move_config() {
                        [ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
                        umount /mnt
                        ;;
+               itus,shield-router)
+                       mount -t vfat /dev/mmcblk1p1 /mnt
+                       [ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
+                       umount /mnt
+                       ;;
        esac
 }
 
index c137609d7fca372210af9ba1c3e4d30895f68650..d938950906436661b13c52d2d52060ab562b7252 100755 (executable)
@@ -28,6 +28,11 @@ platform_copy_config() {
                cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
                umount /mnt
                ;;
+       itus,shield-router)
+               mount -t vfat /dev/mmcblk1p1 /mnt
+               cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
+               umount /mnt
+               ;;
        esac
 }
 
@@ -42,18 +47,29 @@ platform_do_flash() {
        [ -n "$board_dir" ] || return 1
 
        mkdir -p /boot
-       mount -t vfat /dev/$kernel /boot
 
-       [ -f /boot/vmlinux.64 -a ! -L /boot/vmlinux.64 ] && {
-               mv /boot/vmlinux.64 /boot/vmlinux.64.previous
-               mv /boot/vmlinux.64.md5 /boot/vmlinux.64.md5.previous
-       }
+       if [ $board = "itus,shield-router" ]; then
+               # mmcblk1p1 (fat) contains all ELF-bin images for the Shield
+               mount /dev/mmcblk1p1 /boot
+
+               echo "flashing Itus Kernel to /boot/$kernel (/dev/mmblk1p1)"
+               tar -Oxf $tar_file "$board_dir/kernel" > /boot/$kernel
+       else
+               mount -t vfat /dev/$kernel /boot
+
+               [ -f /boot/vmlinux.64 -a ! -L /boot/vmlinux.64 ] && {
+                       mv /boot/vmlinux.64 /boot/vmlinux.64.previous
+                       mv /boot/vmlinux.64.md5 /boot/vmlinux.64.md5.previous
+               }
+
+               echo "flashing kernel to /dev/$kernel"
+               tar xf $tar_file $board_dir/kernel -O > /boot/vmlinux.64
+               md5sum /boot/vmlinux.64 | cut -f1 -d " " > /boot/vmlinux.64.md5
+       fi
 
-       echo "flashing kernel to /dev/$kernel"
-       tar xf $tar_file $board_dir/kernel -O > /boot/vmlinux.64
-       md5sum /boot/vmlinux.64 | cut -f1 -d " " > /boot/vmlinux.64.md5
        echo "flashing rootfs to ${rootfs}"
        tar xf $tar_file $board_dir/root -O | dd of="${rootfs}" bs=4096
+
        sync
        umount /boot
 }
@@ -72,6 +88,9 @@ platform_do_upgrade() {
        erlite)
                kernel=sda1
                ;;
+       itus,shield-router)
+               kernel=ItusrouterImage
+               ;;
        *)
                return 1
        esac
@@ -79,7 +98,6 @@ platform_do_upgrade() {
        platform_do_flash $tar_file $board $kernel $rootfs
 
        return 0
-       
 }
 
 platform_check_image() {
@@ -92,7 +110,8 @@ platform_check_image() {
 
        case "$board" in
        er | \
-       erlite)
+       erlite | \
+       itus,shield-router)
                local kernel_length=$(tar xf $tar_file $board_dir/kernel -O | wc -c 2> /dev/null)
                local rootfs_length=$(tar xf $tar_file $board_dir/root -O | wc -c 2> /dev/null)
                [ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
index e083e823c2211b2228c6f84cf3aae26422234ad5..1dbb60edbcccbf4b2615afa298b046031cd6b585 100644 (file)
@@ -29,6 +29,15 @@ define Device/generic
 endef
 TARGET_DEVICES += generic
 
+ITUSROUTER_CMDLINE:=console=ttyS0,115200 root=/dev/mmcblk1p2 rootfstype=squashfs,ext4,f2fs rootwait
+define Device/itus_shield-router
+  DEVICE_VENDOR := Itus Networks
+  DEVICE_MODEL := Shield Router
+  CMDLINE := $(ITUSROUTER_CMDLINE)
+  IMAGE/sysupgrade.tar/squashfs += | append-metadata
+endef
+TARGET_DEVICES += itus_shield-router
+
 ER_CMDLINE:=-mtdparts=phys_mapped_flash:640k(boot0)ro,640k(boot1)ro,64k(eeprom)ro root=/dev/mmcblk0p2 rootfstype=squashfs,ext4 rootwait
 define Device/ubnt_edgerouter
   DEVICE_VENDOR := Ubiquiti
diff --git a/target/linux/octeon/patches-5.4/130-itus_shield_support.patch b/target/linux/octeon/patches-5.4/130-itus_shield_support.patch
new file mode 100644 (file)
index 0000000..37c75bb
--- /dev/null
@@ -0,0 +1,42 @@
+--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h
++++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
+@@ -297,7 +297,7 @@ enum cvmx_board_types_enum {
+       CVMX_BOARD_TYPE_UBNT_E100 = 20002,
+       CVMX_BOARD_TYPE_UBNT_E200 = 20003,
+       CVMX_BOARD_TYPE_UBNT_E220 = 20005,
+-      CVMX_BOARD_TYPE_CUST_DSR1000N = 20006,
++      CVMX_BOARD_TYPE_ITUS_SHIELD = 20006,
+       CVMX_BOARD_TYPE_KONTRON_S1901 = 21901,
+       CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
+@@ -400,7 +400,7 @@ static inline const char *cvmx_board_typ
+               ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100)
+               ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E200)
+               ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E220)
+-              ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_DSR1000N)
++              ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_ITUS_SHIELD)
+               ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_KONTRON_S1901)
+               ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
+       }
+--- a/arch/mips/cavium-octeon/octeon-platform.c
++++ b/arch/mips/cavium-octeon/octeon-platform.c
+@@ -771,7 +771,7 @@ int __init octeon_prune_device_tree(void
+       if (fdt_check_header(initial_boot_params))
+               panic("Corrupt Device Tree.");
+-      WARN(octeon_bootinfo->board_type == CVMX_BOARD_TYPE_CUST_DSR1000N,
++      WARN(octeon_bootinfo->board_type == CVMX_BOARD_TYPE_ITUS_SHIELD,
+            "Built-in DTB booting is deprecated on %s. Please switch to use appended DTB.",
+            cvmx_board_type_to_string(octeon_bootinfo->board_type));
+--- a/arch/mips/pci/pci-octeon.c
++++ b/arch/mips/pci/pci-octeon.c
+@@ -211,8 +211,6 @@ const char *octeon_get_pci_interrupts(vo
+               return "AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+       case CVMX_BOARD_TYPE_BBGW_REF:
+               return "AABCD";
+-      case CVMX_BOARD_TYPE_CUST_DSR1000N:
+-              return "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC";
+       case CVMX_BOARD_TYPE_THUNDER:
+       case CVMX_BOARD_TYPE_EBH3000:
+       default: