diff options
Diffstat (limited to 'include/inject.sh')
-rw-r--r-- | include/inject.sh | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/include/inject.sh b/include/inject.sh index 74f688a1..09d155fd 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -6,14 +6,14 @@ cbcfgsdir="config/coreboot" tmpromdel="$XBMK_CACHE/DO_NOT_FLASH" nvm="util/nvmutil/nvm" -ifdtool="elf/ifdtool/default/ifdtool" +ifdtool="elf/coreboot/default/ifdtool" cv="CONFIG_GBE_BIN_PATH" [ -n "$cvxbmk" ] && cv="$cv $cvxbmk" [ -n "$cvchk" ] && cv="$cv $cvchk" eval "`setvars "" archive boarddir IFD_platform ifdprefix tree new_mac \ - tmpromdir board xchanged $cv`" + tdir board xchanged $cv`" inject() { @@ -38,10 +38,11 @@ inject() esac [ "$new_mac" = "keep" ] && new_mac="" - check_release + x_ e "$archive" f && check_release check_target && patch_release - [ "$xchanged" = "y" ] && remktar + [ "$xchanged" != "y" ] || ( remktar ) || err + x_ mv "${tdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" "$archive" xnot=" NOT" && [ "$xchanged" = "y" ] && xnot="" printf "\n'%s' was%s modified\n" "$archive" "$xnot" 1>&2 @@ -52,20 +53,14 @@ inject() check_release() { [ -L "$archive" ] && err "'$archive' is a symlink" - e "$archive" f missing && err "'$archive' missing" archivename="`basename "$archive"`" || err "Can't get '$archive' name" - [ -z "$archivename" ] && err "Can't determine archive name" case "$archivename" in - *_src.tar.xz) - err "'$archive' is a src archive, silly!" ;; - grub_*|seagrub_*|custom_*|seauboot_*|seabios_withgrub_*) - err "'$archive' is a ROM image (it must be a tarball)" ;; + *_src.tar.xz) err "'$archive' is a src archive, silly!" ;; *.tar.xz) _stripped_prefix="${archivename#*_}" board="${_stripped_prefix%.tar.xz}" ;; - *) - err "'$archive': could not detect board type" + *) err "'$archive': could not detect board type" ;; esac; : } @@ -77,7 +72,7 @@ check_target() eval "`setcfg "$boarddir/target.cfg"`" chkvars tree && x_ ./mk -d coreboot "$tree" - ifdtool="elf/ifdtool/$tree/ifdtool" + ifdtool="elf/coreboot/$tree/ifdtool" [ -n "$IFD_platform" ] && ifdprefix="-p $IFD_platform"; : } @@ -86,13 +81,13 @@ patch_release() [ "$nuke" = "nuke" ] || x_ ./mk download "$board" has_hashes="n" - tmpromdir="$tmpromdel/bin/$board" + tdir="$tmpromdel/bin/$board" - remkdir "${tmpromdir%"/bin/$board"}" - x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}" + remkdir "${tdir%"/bin/$board"}" + x_ tar -xf "$archive" -C "${tdir%"/bin/$board"}" for _hashes in "vendorhashes" "blobhashes"; do - e "$tmpromdir/$_hashes" f && \ + e "$tdir/$_hashes" f && \ has_hashes="y" && hashfile="$_hashes" && break; : done @@ -103,46 +98,41 @@ patch_release() readkconfig() { - x_ rm -f "$xbmktmp/cbcfg" + x_ rm -f "$xbtmp/cbcfg" fx_ scankconfig x_ find "$boarddir/config" -type f - eval "`setcfg "$xbmktmp/cbcfg" 1`" + eval "`setcfg "$xbtmp/cbcfg" 1`" setvfile "$@" || return 1; : } scankconfig() { for cbc in $cv; do - grep "$cbc" "$1" 1>>"$xbmktmp/cbcfg" 2>/dev/null || : + grep "$cbc" "$1" 1>>"$xbtmp/cbcfg" 2>/dev/null || : done } modify_mac() { - x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbmklocal/gbe" + x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbloc/gbe" [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ x_ make -C util/nvmutil clean && x_ make -C util/nvmutil && \ - x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac" + x_ "$nvm" "$xbloc/gbe" setmac "$new_mac" - fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + fx_ newmac x_ find "$tdir" -maxdepth 1 -type f -name "*.rom" printf "\nThe following GbE NVM data will be written:\n" - x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : + x_ "$nvm" "$xbloc/gbe" dump | grep -v "bytes read from file" || : } newmac() { e "$1" f && xchanged="y" && x_ \ - "$ifdtool" $ifdprefix -i GbE:"$xbmklocal/gbe" "$1" -O "$1"; : + "$ifdtool" $ifdprefix -i GbE:"$xbloc/gbe" "$1" -O "$1"; : } remktar() { - ( - x_ cd "${tmpromdir%"/bin/$board"}" + x_ cd "${tdir%"/bin/$board"}" printf "Re-building tar archive (please wait)\n" mkrom_tarball "bin/$board" 1>/dev/null - ) || err "Cannot re-generate '$archive'" - - mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \ - "$archive" || err "'$archive' -> Can't overwrite"; : } |