gluon-core: primary-mac: load board.json only once
This commit is contained in:
parent
c90b400ce5
commit
0c5b5373bb
@ -12,6 +12,8 @@ local json = require 'jsonc'
|
|||||||
local platform = require 'gluon.platform'
|
local platform = require 'gluon.platform'
|
||||||
local util = require 'gluon.util'
|
local util = require 'gluon.util'
|
||||||
|
|
||||||
|
local board_data = json.load('/etc/board.json')
|
||||||
|
local network_data = (board_data or {}).network
|
||||||
|
|
||||||
local function sysfs(...)
|
local function sysfs(...)
|
||||||
local path = string.format(...)
|
local path = string.format(...)
|
||||||
@ -33,9 +35,9 @@ end
|
|||||||
|
|
||||||
local function board(iface)
|
local function board(iface)
|
||||||
return function()
|
return function()
|
||||||
local data = json.load('/etc/board.json')
|
local ifdata = network_data[iface] or {}
|
||||||
if data and data.network and data.network[iface] then
|
if ifdata.macaddr then
|
||||||
return data.network[iface].macaddr
|
return ifdata.macaddr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user