diff options
author | Leah Rowe <leah@libreboot.org> | 2025-01-05 08:13:28 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-01-05 08:13:28 +0000 |
commit | 13b06ae130fe7b507849606d1414036d8b33d154 (patch) | |
tree | 9e48cd10460b98a4d7ed6cf3da541c1c6d552075 /include/vendor.sh | |
parent | ab8feff92e06d872259014220bbe0a2a5a12dede (diff) |
vendor.sh: Allow restoring the default GbE file
./mk inject libreboot-YYYYMMDD_board.tar.xz setmac restore
This does the same thing as a normal setmac command, except
that it does not alter the MAC address; it is also not the
same as "keep", which skips *writing* the GbE region in-ROM.
The *restore* argument writes the default, unmodified GbE file
kept by lbmk, unmodified because nvmutil is skipped when the
user specifies this argument.
This option is useful for debugging purposes, because it can
be used to verify whether anything else is being wrongly
modified by the script; the "nuke" command can be executed
afterward, and the hash file inspected versus release.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/vendor.sh')
-rw-r--r-- | include/vendor.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/vendor.sh b/include/vendor.sh index b7a54caf..b5feb8b0 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -380,6 +380,9 @@ vendor_inject() check_release "$archive" || \ $err "You must run this script on a release archive. - $dontflash" + [ "$new_mac" = "restore" ] && \ + printf "Restoring default GbE for '$archive', board '$board'\n" + readcfg && need_files="y" if [ "$need_files" = "y" ] || [ -n "$new_mac" ]; then [ "$nukemode" = "nuke" ] || x_ ./mk download "$board" @@ -714,7 +717,9 @@ modify_mac_addresses() [ -n "$CONFIG_GBE_BIN_PATH" ] || return 1 e "${CONFIG_GBE_BIN_PATH##*../}" f n && $err "missing gbe file" - x_ make -C util/nvmutil + [ "$new_mac" != "restore" ] && \ + x_ make -C util/nvmutil + x_ mkdir -p tmp [ -L "tmp/gbe" ] && $err "tmp/gbe exists but is a symlink" [ -d "tmp/gbe" ] && $err "tmp/gbe exists but is a directory" @@ -723,7 +728,8 @@ modify_mac_addresses() fi x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "tmp/gbe" - x_ "util/nvmutil/nvm" "tmp/gbe" setmac "$new_mac" + [ "$new_mac" != "restore" ] && \ + x_ "util/nvmutil/nvm" "tmp/gbe" setmac "$new_mac" find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" > "tmp/rom.list" \ || $err "'$archive' -> Can't make tmp/rom.list - $dontflash" @@ -738,4 +744,9 @@ modify_mac_addresses() printf "\nThe following GbE NVM words were written in '%s':\n" \ "$archive" x_ util/nvmutil/nvm tmp/gbe dump + + [ "$new_mac" = "restore" ] && \ + printf "\nNOTE: User specified setmac 'restore' argument.\n" && \ + printf "Default GbE file '%s' written without running nvmutil.\n" \ + "${CONFIG_GBE_BIN_PATH##*../}"; : } |