Skip to content
Snippets Groups Projects
Commit 469e347f authored by Adrian Schmutzler's avatar Adrian Schmutzler Committed by Petr Štetiar
Browse files

base-files: provide option to specify label MAC address in board.d


For many devices, MAC addresses cannot be retrieved via the
device tree alias.

To still provide the label MAC address for those, this implements
a second mechanism that will put the address into uci config.
Note that this stores the actual MAC address, whereas in DTS
we reference the bearing device.

This is based on the work of Rosy Song <rosysong@rosinson.com>

Signed-off-by: default avatarAdrian Schmutzler <freifunk@adrianschmutzler.de>
parent 03407188
No related branches found
No related tags found
No related merge requests found
...@@ -260,6 +260,11 @@ generate_static_system() { ...@@ -260,6 +260,11 @@ generate_static_system() {
uci -q set "system.@system[-1].hostname=$hostname" uci -q set "system.@system[-1].hostname=$hostname"
fi fi
local label_macaddr
if json_get_var label_macaddr label_macaddr; then
uci -q set "system.@system[-1].label_macaddr=$label_macaddr"
fi
if json_is_a ntpserver array; then if json_is_a ntpserver array; then
local keys key local keys key
json_get_keys keys ntpserver json_get_keys keys ntpserver
......
...@@ -19,6 +19,7 @@ get_mac_label() { ...@@ -19,6 +19,7 @@ get_mac_label() {
[ -n "$macdevice" ] && macaddr=$(get_mac_binary "$basepath/$macdevice/mac-address" 0 2>/dev/null) [ -n "$macdevice" ] && macaddr=$(get_mac_binary "$basepath/$macdevice/mac-address" 0 2>/dev/null)
[ -n "$macaddr" ] || macaddr=$(get_mac_binary "$basepath/$macdevice/local-mac-address" 0 2>/dev/null) [ -n "$macaddr" ] || macaddr=$(get_mac_binary "$basepath/$macdevice/local-mac-address" 0 2>/dev/null)
[ -n "$macaddr" ] || macaddr=$(uci -q get system.@system[0].label_macaddr)
echo $macaddr echo $macaddr
} }
......
...@@ -307,6 +307,14 @@ ucidef_set_interface_macaddr() { ...@@ -307,6 +307,14 @@ ucidef_set_interface_macaddr() {
ucidef_set_interface "$network" macaddr "$macaddr" ucidef_set_interface "$network" macaddr "$macaddr"
} }
ucidef_set_label_macaddr() {
local macaddr="$1"
json_select_object system
json_add_string label_macaddr "$macaddr"
json_select ..
}
ucidef_add_atm_bridge() { ucidef_add_atm_bridge() {
local vpi="$1" local vpi="$1"
local vci="$2" local vci="$2"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment