From 13b06ae130fe7b507849606d1414036d8b33d154 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 5 Jan 2025 08:13:28 +0000 Subject: 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 --- include/vendor.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'include/vendor.sh') 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##*../}"; : } -- cgit v1.2.1