aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/base-files/lib
diff options
context:
space:
mode:
authorMathew McBride <matt@traverse.com.au>2018-04-30 22:42:39 +1000
committerJohn Crispin <john@phrozen.org>2018-07-30 10:53:57 +0200
commit08714738d2c8d7710f8fd2b7deac795f49e7d7c2 (patch)
treeda058038a138d0ab98d7928d9806f4f77ddbef65 /target/linux/layerscape/base-files/lib
parent481f870a02a29974eca943f3b926434d5e517679 (diff)
downloadupstream-08714738d2c8d7710f8fd2b7deac795f49e7d7c2.tar.gz
upstream-08714738d2c8d7710f8fd2b7deac795f49e7d7c2.tar.bz2
upstream-08714738d2c8d7710f8fd2b7deac795f49e7d7c2.zip
layerscape: add Traverse LS1043-S support
The Traverse LS1043-S board is a router board based on NXP/Freescale's LS1043 SoC, with 4x1GBase-T, 1 SFP and 1 SFP+, as well as miniPCIe and M.2 LTE. Unlike the Layerscape reference boards, the LS1043-S board has NAND flash and uses the mainline U-Boot. This patch implements support for the LS1043-S board, as well as the earlier LS1043-V board. It is our intention that all boards in this family (LS1043-S and later, Five64) will boot the same binary. Not included in this patchset are the hwmon drivers not in the kernel (emc1704,pac1934) or the bootloader. Signed-off-by: Mathew McBride <matt@traverse.com.au>
Diffstat (limited to 'target/linux/layerscape/base-files/lib')
-rw-r--r--target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth28
-rw-r--r--target/linux/layerscape/base-files/lib/upgrade/platform.sh94
2 files changed, 122 insertions, 0 deletions
diff --git a/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth b/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth
new file mode 100644
index 0000000000..c4feec42bc
--- /dev/null
+++ b/target/linux/layerscape/base-files/lib/preinit/05_layerscape_reorder_eth
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+reorder_layerscape_interfaces() {
+ if [ ! -f /tmp/sysinfo/board_name ]; then
+ echo "No board name found, not doing reorder_layerscape_interfaces"
+ return 0
+ fi
+
+ board=$(cat /tmp/sysinfo/board_name)
+ case "$board" in
+ "traverse,ls1043v" | \
+ "traverse,ls1043s")
+
+ # Reorder ethernet interfaces to match the physical order
+ ip link set eth2 name fm1-mac3
+ ip link set eth4 name eth2
+ ip link set eth3 name fm1-mac4
+ ip link set eth5 name eth3
+ ip link set fm1-mac3 name eth4
+ ip link set fm1-mac4 name eth5
+ ;;
+ default)
+ echo "Unknown board $board"
+ ;;
+ esac
+}
+
+boot_hook_add preinit_main reorder_layerscape_interfaces
diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
new file mode 100644
index 0000000000..9cc960a5fc
--- /dev/null
+++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# Copyright 2015-2018 Traverse Technologies
+#
+platform_do_upgrade_traverse_nandubi() {
+ bootsys=$(fw_printenv bootsys | awk -F= '{{print $2}}')
+ newbootsys=2
+ if [ "$bootsys" -eq "2" ]; then
+ newbootsys=1
+ fi
+ mkdir -p /tmp/image
+ cd /tmp/image
+ get_image "$1" > image.tar
+ ls -la image.tar
+ files=$(tar -tf image.tar)
+ echo "Files in image:"
+ echo $files
+ for f in $files
+ do
+ part_name=$(echo $f | awk -F '/' '{{print $2}}')
+ if [ -z "$part_name" ] || [ "$part_name" = "CONTROL" ]; then
+ continue
+ fi
+
+ [ "$part_name" = "root" ] && part_name="rootfs"
+
+ volume=$part_name
+ if [ "$part_name" = "kernel" ] || [ "$part_name" = "rootfs" ]; then
+ volume="${part_name}${newbootsys}"
+ fi
+ volume_id=$(ubinfo -d 0 --name $volume | awk '/Volume ID/ {print $3}')
+ file_size=$(tar -tvf image.tar $f | awk '{{print $3}}')
+ echo "$f size $file_size"
+ tar -xOf image.tar $f | ubiupdatevol -s $file_size /dev/ubi0_$volume_id -
+
+ echo "$volume upgraded"
+ done
+ fw_setenv bootsys $newbootsys
+ echo "Upgrade complete"
+}
+platform_copy_config() {
+ bootsys=$(fw_printenv bootsys | awk -F= '{{print $2}}')
+ rootvol=rootfs$bootsys
+ volume_id=$(ubinfo -d 0 --name $rootvol | awk '/Volume ID/ {print $3}')
+ mkdir -p /mnt/oldsys
+ mount -t ubifs -o rw,noatime /dev/ubi0_$volume_id /mnt/oldsys
+ cp -af "$CONF_TAR" /mnt/oldsys
+ umount /mnt/oldsys
+}
+platform_check_image() {
+ local board=$(board_name)
+
+ case "$board" in
+ traverse,ls1043v | \
+ traverse,ls1043s | \
+ traverse,five64)
+ local tar_file="$1"
+ local kernel_length=$( (tar xf $tar_file sysupgrade-traverse-five64/kernel -O | wc -c) 2> /dev/null)
+ local rootfs_length=$( (tar xf $tar_file sysupgrade-traverse-five64/root -O | wc -c) 2> /dev/null)
+ [ "$kernel_length" -eq 0 -o "$rootfs_length" -eq 0 ] && {
+ echo "The upgrade image is corrupt."
+ return 1
+ }
+ return 0
+ ;;
+ *)
+ echo "Sysupgrade is not currently supported on $board"
+ ;;
+ esac
+
+ return 1
+}
+platform_do_upgrade() {
+ local board=$(board_name)
+
+ case "$board" in
+ traverse,ls1043v | \
+ traverse,ls1043s | \
+ traverse,five64)
+ platform_do_upgrade_traverse_nandubi "$ARGV"
+ ;;
+ *)
+ echo "Sysupgrade is not currently supported on $board"
+ ;;
+ esac
+}
+platform_pre_upgrade() {
+ # Force the creation of fw_printenv.lock
+ mkdir -p /var/lock
+ touch /var/lock/fw_printenv.lock
+
+ export RAMFS_COPY_BIN="/usr/sbin/fw_printenv /usr/sbin/fw_setenv /usr/sbin/ubinfo /bin/echo ${RAMFS_COPY_BIN}"
+ export RAMFS_COPY_DATA="/etc/fw_env.config /var/lock/fw_printenv.lock ${RAMFS_COPY_DATA}"
+}