inject.sh: tidy up modify_mac_addresses()
Signed-off-by: Leah Rowe <leah@libreboot.org>25.04_branch
parent
67c8338acf
commit
ff35a6a300
|
@ -8,6 +8,7 @@ hashfiles="vendorhashes blobhashes" # used to detect and error out
|
||||||
# if running on an archive that needs vendor files
|
# if running on an archive that needs vendor files
|
||||||
dontflash="!!! AN ERROR OCCURED! Do NOT flash these images !!!"
|
dontflash="!!! AN ERROR OCCURED! Do NOT flash these images !!!"
|
||||||
tmpromdel="$xbmkpwd/tmp/DO_NOT_FLASH"
|
tmpromdel="$xbmkpwd/tmp/DO_NOT_FLASH"
|
||||||
|
nvm="util/nvmutil/nvm"
|
||||||
|
|
||||||
cv="CONFIG_GBE_BIN_PATH CONFIG_IFD_BIN_PATH"
|
cv="CONFIG_GBE_BIN_PATH CONFIG_IFD_BIN_PATH"
|
||||||
|
|
||||||
|
@ -163,43 +164,29 @@ patch_release_roms()
|
||||||
|
|
||||||
modify_mac_addresses()
|
modify_mac_addresses()
|
||||||
{
|
{
|
||||||
[ "$nukemode" = "nuke" ] && \
|
|
||||||
$err "Cannot modify MAC addresses while nuking vendor files"
|
|
||||||
|
|
||||||
# chkvars CONFIG_GBE_BIN_PATH
|
|
||||||
[ -n "$CONFIG_GBE_BIN_PATH" ] || return 1
|
[ -n "$CONFIG_GBE_BIN_PATH" ] || return 1
|
||||||
e "${CONFIG_GBE_BIN_PATH##*../}" f n && $err "missing gbe file"
|
|
||||||
|
|
||||||
[ "$new_mac" != "restore" ] && \
|
|
||||||
x_ make -C util/nvmutil
|
|
||||||
|
|
||||||
x_ mkdir -p tmp
|
x_ mkdir -p tmp
|
||||||
[ -L "tmp/gbe" ] && $err "tmp/gbe exists but is a symlink"
|
e tmp/gbe && x_ e tmp/gbe f
|
||||||
[ -d "tmp/gbe" ] && $err "tmp/gbe exists but is a directory"
|
x_ cp "${CONFIG_GBE_BIN_PATH##*../}" tmp/gbe
|
||||||
if [ -e "tmp/gbe" ]; then
|
|
||||||
[ -f "tmp/gbe" ] || $err "tmp/gbe exists and is not a file"
|
|
||||||
fi
|
|
||||||
x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "tmp/gbe"
|
|
||||||
|
|
||||||
[ "$new_mac" != "restore" ] && \
|
if [ "$new_mac" != "restore" ]; then
|
||||||
x_ "util/nvmutil/nvm" "tmp/gbe" setmac "$new_mac"
|
x_ make -C util/nvmutil
|
||||||
|
x_ "$nvm" tmp/gbe setmac "$new_mac"
|
||||||
|
fi
|
||||||
|
|
||||||
find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" > "tmp/rom.list" \
|
find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" > "tmp/rom.list" \
|
||||||
|| $err "'$archive' -> Can't make tmp/rom.list - $dontflash"
|
|| $err "'$archive' -> Can't make tmp/rom.list - $dontflash"
|
||||||
|
|
||||||
while read -r _xrom; do
|
while read -r _xrom; do
|
||||||
[ -L "$_xrom" ] && continue
|
e "$_xrom" f && xchanged="y" && x_ \
|
||||||
[ -f "$_xrom" ] || continue
|
"$ifdtool" $ifdprefix -i GbE:tmp/gbe "$_xrom" -O "$_xrom"
|
||||||
"$ifdtool" $ifdprefix -i GbE:"tmp/gbe" "$_xrom" -O \
|
|
||||||
"$_xrom" || $err "'$_xrom': Can't insert new GbE file"
|
|
||||||
xchanged="y"
|
|
||||||
done < "tmp/rom.list"
|
done < "tmp/rom.list"
|
||||||
printf "\nThe following GbE NVM words were written in '%s':\n" \
|
|
||||||
"$archive"
|
printf "\nGbE NVM written to '%s':\n" "$archive"
|
||||||
x_ util/nvmutil/nvm tmp/gbe dump | grep -v "bytes read from file" || :
|
x_ "$nvm" tmp/gbe dump | grep -v "bytes read from file" || :
|
||||||
|
|
||||||
[ "$new_mac" = "restore" ] && \
|
[ "$new_mac" = "restore" ] && \
|
||||||
printf "\nNOTE: User specified setmac 'restore' argument.\n" && \
|
printf "\nDefault GbE file '%s' written, unmodified.\n" \
|
||||||
printf "Default GbE file '%s' written without running nvmutil.\n" \
|
"${CONFIG_GBE_BIN_PATH##*../}"; :
|
||||||
"${CONFIG_GBE_BIN_PATH##*../}"; :
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue