inject.sh: further cleanup

this is based on lbmk commit e5af201060e

this removes more code that is not needed in cbmk's version
of inject.sh

lbmk and cbmk inject.sh are now much more in sync, in that
they are much more similar to each other than before.

the cbmk version only handles MAC addresses, and does not
do vendor file downloading or patching.

Signed-off-by: Leah Rowe <leah@libreboot.org>
master
Leah Rowe 2025-05-10 19:03:15 +01:00
parent a82ca2da5f
commit cf8ca4cdd6
1 changed files with 9 additions and 15 deletions

View File

@ -5,9 +5,7 @@
cbcfgsdir="config/coreboot" cbcfgsdir="config/coreboot"
hashfiles="vendorhashes blobhashes" # blobhashes for backwards compatibility hashfiles="vendorhashes blobhashes" # blobhashes for backwards compatibility
dontflash="!!! AN ERROR OCCURED! Please DO NOT flash if injection failed. !!!" tmpromdel="$XBMK_CACHE/DO_NOT_FLASH"
vfix="DO_NOT_FLASH_YET._FIRST,_INJECT_FILES_VIA_INSTRUCTIONS_ON_LIBREBOOT.ORG_"
tmpromdel="$xbmklocal/DO_NOT_FLASH"
nvm="util/nvmutil/nvm" nvm="util/nvmutil/nvm"
ifdtool="elf/ifdtool/default/ifdtool" ifdtool="elf/ifdtool/default/ifdtool"
@ -15,15 +13,15 @@ cv="CONFIG_GBE_BIN_PATH"
[ -n "$cvxbmk" ] && cv="$cv $cvxbmk" [ -n "$cvxbmk" ] && cv="$cv $cvxbmk"
[ -n "$cvchk" ] && cv="$cv $cvchk" [ -n "$cvchk" ] && cv="$cv $cvchk"
eval "`setvars "" archive boarddir cbdir IFD_platform ifdprefix tree new_mac \ eval "`setvars "" archive boarddir IFD_platform ifdprefix tree new_mac \
tmpromdir $cv`" tmpromdir board $cv`"
inject() inject()
{ {
remkdir "$tmpromdel" remkdir "$tmpromdel"
set +u +e set +u +e
[ $# -lt 1 ] && err "No options specified. - $dontflash" [ $# -lt 1 ] && err "No options specified"
eval "`setvars "" nukemode new_mac xchanged`" eval "`setvars "" nukemode new_mac xchanged`"
archive="$1"; archive="$1";
@ -57,11 +55,11 @@ inject()
check_release() check_release()
{ {
[ -L "$archive" ] && err "'$archive' is a symlink. $dontflash" [ -L "$archive" ] && err "'$archive' is a symlink"
e "$archive" f missing && err "'$archive' missing" e "$archive" f missing && err "'$archive' missing"
archivename="`basename "$archive"`" || err "Can't get '$archive' name" archivename="`basename "$archive"`" || err "Can't get '$archive' name"
[ -z "$archivename" ] && err "Can't determine archive name. $dontflash" [ -z "$archivename" ] && err "Can't determine archive name"
case "$archivename" in case "$archivename" in
*_src.tar.xz) *_src.tar.xz)
@ -71,7 +69,7 @@ check_release()
*.tar.xz) _stripped_prefix="${archivename#*_}" *.tar.xz) _stripped_prefix="${archivename#*_}"
board="${_stripped_prefix%.tar.xz}" ;; board="${_stripped_prefix%.tar.xz}" ;;
*) *)
err "'$archive': could not detect board type - $dontflash" err "'$archive': could not detect board type"
esac; : esac; :
} }
@ -86,10 +84,6 @@ check_target()
eval "`setcfg "$boarddir/target.cfg"`" eval "`setcfg "$boarddir/target.cfg"`"
chkvars tree && x_ ./mk -d coreboot "$tree" chkvars tree && x_ ./mk -d coreboot "$tree"
cbdir="src/coreboot/$tree"
cbfstool="elf/cbfstool/$tree/cbfstool"
rmodtool="elf/cbfstool/$tree/rmodtool"
cbfstool="elf/cbfstool/$tree/cbfstool"
ifdtool="elf/ifdtool/$tree/ifdtool" ifdtool="elf/ifdtool/$tree/ifdtool"
[ -n "$IFD_platform" ] && ifdprefix="-p $IFD_platform"; : [ -n "$IFD_platform" ] && ifdprefix="-p $IFD_platform"; :
} }
@ -97,7 +91,7 @@ check_target()
patch_release() patch_release()
{ {
has_hashes="n" has_hashes="n"
tmpromdir="$xbmklocal/DO_NOT_FLASH/bin/$board" tmpromdir="$tmpromdel/bin/$board"
remkdir "${tmpromdir%"/bin/$board"}" remkdir "${tmpromdir%"/bin/$board"}"
x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}" x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}"
@ -146,7 +140,7 @@ remktar()
( (
x_ cd "${tmpromdir%"/bin/$board"}" x_ cd "${tmpromdir%"/bin/$board"}"
mkrom_tarball "bin/$board" mkrom_tarball "bin/$board"
) || err "Cannot re-generate '$archive' - $dontflash" ) || err "Cannot re-generate '$archive'"
mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \ mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \
"$archive" || err "'$archive' -> Can't overwrite"; : "$archive" || err "'$archive' -> Can't overwrite"; :