[LEDE-DEV] [PATCH v2 5/5] mvebu: migrate uci config to new PCIe path

Hauke Mehrtens hauke at hauke-m.de
Sun Jan 21 09:53:08 PST 2018


The name of the PCIe controller node in device tree changed between
kernel 4.9 and kernel 4.14. Migrate the configuration when an update
from kernel 4.9 to 4.14 is done to the new name to make the existing
wifi configuration compatible with the new names.

This replaces the "pcie-controller" part with "pcie" on all nodes if the
file exists in sys fs.
This will not do anything with on kernel 4.9.

The configuration will not be fixed when migrating back from kernel 4.14
to kernel 4.9.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../base-files/etc/uci-defaults/05-migrate-wifi    | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 target/linux/mvebu/base-files/etc/uci-defaults/05-migrate-wifi

diff --git a/target/linux/mvebu/base-files/etc/uci-defaults/05-migrate-wifi b/target/linux/mvebu/base-files/etc/uci-defaults/05-migrate-wifi
new file mode 100644
index 0000000000..6f7858da3d
--- /dev/null
+++ b/target/linux/mvebu/base-files/etc/uci-defaults/05-migrate-wifi
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+[ ! -e /etc/config/wireless ] && exit 0
+
+. /lib/functions.sh
+
+PATH_CHANGED=0
+
+rename_wifi_path() {
+	local path_old=$(uci get wireless.${1}.path)
+	local path_new=$(echo ${path_old} | sed "s/pcie-controller/pcie/")
+
+	if [ -e "/sys/devices/${path_new}" ] && [ ${path_old} != ${path_new} ]
+	then 
+		uci set wireless.${1}.path=${path_new}
+		PATH_CHANGED=1
+	fi
+}
+
+config_load wireless
+config_foreach rename_wifi_path wifi-device
+
+[ "$PATH_CHANGED" = "1" ] && uci commit wireless
-- 
2.11.0




More information about the Lede-dev mailing list