summaryrefslogtreecommitdiffstats
path: root/src/board
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-10-29 22:22:12 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-10-29 22:34:10 (EDT)
commit3ff66e2b64e3013897276e4e1e492e306d697507 (patch)
tree6b27f32da91b9dafc47f373f1e42b9ca4e32b0d3 /src/board
parentffc1bdaf355d6e7c7496ac79149575291e66377d (diff)
downloadfirman.sh-3ff66e2b64e3013897276e4e1e492e306d697507.zip
firman.sh-3ff66e2b64e3013897276e4e1e492e306d697507.tar.gz
firman.sh-3ff66e2b64e3013897276e4e1e492e306d697507.tar.bz2
ich9_prepare_rom(): Get current MAC address
Diffstat (limited to 'src/board')
-rw-r--r--src/board/ich9.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/board/ich9.sh b/src/board/ich9.sh
index 35d7e0d..187aafd 100644
--- a/src/board/ich9.sh
+++ b/src/board/ich9.sh
@@ -22,9 +22,17 @@ ich9_prepare_rom()
info 'Generating FD and GbE flash regions for Intel ICH9'
- # Get MAC address.
+ # Get current MAC address.
+ for iface in /sys/class/net/*; do
+ [ "x$(cat "${iface}/device/vendor")" = 'x0x8086' ] || continue
+ [ "x$(cat "${iface}/device/device")" = 'x0x10f5' ] || continue
+ mac="$(cat "${iface}/address")"
+ break
+ done
+
+ # Ask for MAC address.
while :; do
- mac="$(show_prompt 'Enter MAC address' '' 17)"
+ mac="$(show_prompt 'Enter MAC address' "${mac}" 17)"
case "${mac}" in
*[!0-9a-zA-Z:]*)
continue