aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq40xx/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ipq40xx/base-files')
-rw-r--r--target/linux/ipq40xx/base-files/etc/board.d/02_network8
-rw-r--r--target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata21
-rw-r--r--target/linux/ipq40xx/base-files/lib/upgrade/netgear.sh76
-rw-r--r--target/linux/ipq40xx/base-files/lib/upgrade/platform.sh6
4 files changed, 111 insertions, 0 deletions
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index a675acc8db..50b460e441 100644
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -106,6 +106,14 @@ ipq40xx_setup_interfaces()
"0u@eth0" "3:lan:2" "4:lan:1"
ucidef_set_interface_wan "eth1"
;;
+ netgear,rbr50|\
+ netgear,rbs50|\
+ netgear,srr60|\
+ netgear,srs60)
+ ucidef_add_switch "switch0" \
+ "0u@eth0" "2:lan" "3:lan" "4:lan"
+ ucidef_set_interface_wan "eth1"
+ ;;
qxwlan,e2600ac-c1 |\
qxwlan,e2600ac-c2)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 87876ad844..505182bb65 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -46,6 +46,13 @@ case "$FIRMWARE" in
# OEM assigns 4 sequential MACs
ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4))
;;
+ netgear,rbr50|\
+ netgear,rbs50|\
+ netgear,srr60|\
+ netgear,srs60)
+ caldata_extract_mmc "0:ART" 0x9000 0x2f20
+ ath10k_patch_mac $(mmc_get_mac_binary ARTMTD 0x12)
+ ;;
esac
;;
"ath10k/pre-cal-ahb-a000000.wifi.bin")
@@ -150,6 +157,13 @@ case "$FIRMWARE" in
caldata_extract "ART" 0x1000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary dnidata 0x0)
;;
+ netgear,rbr50|\
+ netgear,rbs50|\
+ netgear,srr60|\
+ netgear,srs60)
+ caldata_extract_mmc "0:ART" 0x1000 0x2f20
+ ath10k_patch_mac $(mmc_get_mac_binary ARTMTD 0x0)
+ ;;
netgear,wac510)
caldata_extract "0:ART" 0x1000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary "0:MANUDATA" 0x6)
@@ -264,6 +278,13 @@ case "$FIRMWARE" in
caldata_extract "ART" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary dnidata 0xc)
;;
+ netgear,rbr50|\
+ netgear,rbs50|\
+ netgear,srr60|\
+ netgear,srs60)
+ caldata_extract_mmc "0:ART" 0x5000 0x2f20
+ ath10k_patch_mac $(mmc_get_mac_binary ARTMTD 0xc)
+ ;;
netgear,wac510)
caldata_extract "0:ART" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary "0:MANUDATA" 0x6) 16)
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/netgear.sh b/target/linux/ipq40xx/base-files/lib/upgrade/netgear.sh
new file mode 100644
index 0000000000..f3fb626d1f
--- /dev/null
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/netgear.sh
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: GPL-2.0-only
+. /lib/functions.sh
+
+platform_do_upgrade_netgear_orbi_upgrade() {
+ command -v losetup >/dev/null || {
+ logger -s "Upgrade failed: 'losetup' not installed."
+ return 1
+ }
+
+ local tar_file=$1
+ local kernel=$2
+ local rootfs=$3
+
+ [ -z "$kernel" ] && kernel=$(find_mmc_part "kernel")
+ [ -z "$rootfs" ] && rootfs=$(find_mmc_part "rootfs")
+
+ [ -z "$kernel" ] && echo "Upgrade failed: kernel partition not found! Rebooting..." && reboot -f
+ [ -z "$rootfs" ] && echo "Upgrade failed: rootfs partition not found! Rebooting..." && reboot -f
+
+ netgear_orbi_do_flash $tar_file $kernel $rootfs
+
+ echo "sysupgrade successful"
+ umount -a
+ reboot -f
+}
+
+netgear_orbi_do_flash() {
+ local tar_file=$1
+ local kernel=$2
+ local rootfs=$3
+
+ # keep sure its unbound
+ losetup --detach-all || {
+ echo "Failed to detach all loop devices. Skip this try."
+ reboot -f
+ }
+
+ # use the first found directory in the tar archive
+ local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
+ board_dir=${board_dir%/}
+
+ echo "flashing kernel to $kernel"
+ tar xf $tar_file ${board_dir}/kernel -O >$kernel
+
+ echo "flashing rootfs to ${rootfs}"
+ tar xf $tar_file ${board_dir}/root -O >"${rootfs}"
+
+ # a padded rootfs is needed for overlay fs creation
+ local offset=$(tar xf $tar_file ${board_dir}/root -O | wc -c)
+ [ $offset -lt 65536 ] && {
+ echo "Wrong size for rootfs: $offset"
+ sleep 10
+ reboot -f
+ }
+
+ # Mount loop for rootfs_data
+ local loopdev="$(losetup -f)"
+ losetup -o $offset $loopdev $rootfs || {
+ echo "Failed to mount looped rootfs_data."
+ sleep 10
+ reboot -f
+ }
+
+ echo "Format new rootfs_data at position ${offset}."
+ mkfs.ext4 -F -L rootfs_data $loopdev
+ mkdir /tmp/new_root
+ mount -t ext4 $loopdev /tmp/new_root && {
+ echo "Saving config to rootfs_data at position ${offset}."
+ cp -v "$UPGRADE_BACKUP" "/tmp/new_root/$BACKUP_FILE"
+ umount /tmp/new_root
+ }
+
+ # Cleanup
+ losetup -d $loopdev >/dev/null 2>&1
+ sync
+}
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index 68027be666..e391976606 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -117,6 +117,12 @@ platform_do_upgrade() {
[ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware
default_do_upgrade "$1"
;;
+ netgear,rbr50 |\
+ netgear,rbs50 |\
+ netgear,srr60 |\
+ netgear,srs60)
+ platform_do_upgrade_netgear_orbi_upgrade "$1"
+ ;;
openmesh,a42 |\
openmesh,a62 |\
plasmacloud,pa1200 |\