mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-03-14 23:09:45 +01:00
airoha: support openwrt,netdev-name for renaming interfaces
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Add support to the airoha target for the OpenWrt-specific DT property
`openwrt,netdev-name`. In particular, this is for interfaces under
non-DSA `airoha_eth` interfaces.
This will avoid conflicts with upstream code[1]; and maintain forward
compatibility with OpenWrt configurations if/when `airoha_eth` becomes
a full DSA driver.
[1] https://lore.kernel.org/netdev/20240709124503.pubki5nwjfbedhhy@skbuf/
Borrowed from d4d6c48 (mediatek: filogic: support openwrt,netdev-name for renaming interfaces)
Signed-off-by: Kenneth Kasilag <kenneth@kasilag.me>
Link: https://github.com/openwrt/openwrt/pull/20475
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
120b70a6e2
commit
130306fab9
1 changed files with 15 additions and 0 deletions
15
target/linux/airoha/base-files/lib/preinit/04_set_netdev_label
Executable file
15
target/linux/airoha/base-files/lib/preinit/04_set_netdev_label
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
set_netdev_labels() {
|
||||
local dir
|
||||
local label
|
||||
local netdev
|
||||
|
||||
for dir in /sys/class/net/*; do
|
||||
[ -r "$dir/of_node/openwrt,netdev-name" ] || continue
|
||||
read -r label < "$dir/of_node/openwrt,netdev-name"
|
||||
netdev="${dir##*/}"
|
||||
[ "$netdev" = "$label" ] && continue
|
||||
ip link set "$netdev" name "$label"
|
||||
done
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main set_netdev_labels
|
||||
Loading…
Add table
Reference in a new issue