aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/base-files/lib
diff options
context:
space:
mode:
authorMatt Merhar <mattmerhar@protonmail.com>2018-08-27 09:59:09 -0400
committerMathias Kresin <dev@kresin.me>2018-08-27 19:31:17 +0200
commitd03c89838eca297dd6c364d3bccfb6bab440d7fb (patch)
tree57bf98e92008c3eb0581aea5723012228675c97e /target/linux/ath79/base-files/lib
parente348ccc4e6e9d16d56bec77b69628205d58e6750 (diff)
downloadupstream-d03c89838eca297dd6c364d3bccfb6bab440d7fb.tar.gz
upstream-d03c89838eca297dd6c364d3bccfb6bab440d7fb.tar.bz2
upstream-d03c89838eca297dd6c364d3bccfb6bab440d7fb.zip
ath79: initial support for Ubiquiti RouterStation and RouterStation Pro
This adds a shared ar7161_ubnt_routerstation.dtsi as well as two other .dts files that utilize it, ar7161_ubnt_routerstation.dts and ar7161_ubnt_routerstation-pro.dts. The modifications to generic-ubnt.mk, config-default, and base-files necessary for image generation, parsing RedBoot FIS partitions, network configuration, and sysupgrade are also included. This reintroduces vital bits from platform_do_upgrade_combined() and its supporting functions to /lib/upgrade/platform.sh, which were previously removed from ath79 in 3e9d9f62258f80298710441e0db557e59e152dcf "ath79: sysupgrade: drop unused platform checks". The new function is called "routerstation_do_upgrade" and will *only* work for the RouterStation series of boards. It does however retain the ability to downgrade (e.g. from master -> 17.01.x using sysupgrade -F). All hardware is functional including the AR8216 switch (for the Pro), wireless via ath5k/ath9k using the miniPCI slots, flash, USB, button, and LED. Switch and LAN/WAN configuration is the same as it is with the equivalent ar71xx targets. MAC addresses are assigned based upon the content stored in the RedBoot config partition. Flashing via both sysupgrade and TFTP has been confirmed to work. Also, the initramfs images are now raw .bin files instead of being wrapped in a uImage (as they currently are in ar71xx), which makes them bootable with RedBoot. One notable difference to ar71xx is the inclusion of the RedBoot "fconfig" utility (analogous to U-Boot’s fw_printenv/fw_setenv) in DEVICE_PACKAGES. The FIS partitions are probed using the RedBoot MTD parser’s DT binding, whose proper usage is mutually exclusive to defining a separate fixed-partitions node for "RedBoot config". This config partition contains the board's base MAC address. The lack of a hard-coded flash location means that the mtd-mac-address property cannot be used in the .dts, so instead fconfig is used to read the MAC addresses from flash in userspace during first boot. Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl> Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
Diffstat (limited to 'target/linux/ath79/base-files/lib')
-rw-r--r--target/linux/ath79/base-files/lib/upgrade/platform.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh b/target/linux/ath79/base-files/lib/upgrade/platform.sh
index 08039e0052..806b3f0787 100644
--- a/target/linux/ath79/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/base-files/lib/upgrade/platform.sh
@@ -5,6 +5,15 @@
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
+routerstation_do_upgrade() {
+ local append
+ local kern_length=0x$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null)
+
+ [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR"
+ dd if="$1" bs=64k skip=1 2>/dev/null | \
+ mtd -r $append -Fkernel:$kern_length:0x80060000,rootfs write - kernel:rootfs
+}
+
platform_check_image() {
return 0
}
@@ -17,6 +26,10 @@ platform_do_upgrade() {
PART_NAME="rootfs:kernel"
default_do_upgrade "$ARGV"
;;
+ ubnt,routerstation|\
+ ubnt,routerstation-pro)
+ routerstation_do_upgrade "$ARGV"
+ ;;
*)
default_do_upgrade "$ARGV"
;;