summaryrefslogtreecommitdiff
path: root/include/inject.sh
diff options
context:
space:
mode:
Diffstat (limited to 'include/inject.sh')
-rw-r--r--include/inject.sh40
1 files changed, 10 insertions, 30 deletions
diff --git a/include/inject.sh b/include/inject.sh
index a200981f..837f34c1 100644
--- a/include/inject.sh
+++ b/include/inject.sh
@@ -90,11 +90,6 @@ getfiles()
"$MRC_url_bkup" "$MRC_hash" "$CONFIG_REFCODE_BLOB_FILE"
[ -z "$CONFIG_LENOVO_TBFW_BIN" ] || fetch "tbfw" "$TBFW_url" \
"$TBFW_url_bkup" "$TBFW_hash" "$CONFIG_LENOVO_TBFW_BIN"
- #
- # in the future, we might have libre fsp-s and then fsp-m.
- # therefore, handle them separately, in case one of them is libre; if
- # one of them was, the path wouldn't be set.
- #
[ -z "$CONFIG_FSP_M_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \
"$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_M_FILE" copy
[ -z "$CONFIG_FSP_S_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \
@@ -228,9 +223,7 @@ extract_kbc1126ec()
) || $err "$board: can't extract kbc1126 ec firmware - $dontflash"
x_ e "$appdir/ec.bin.fw1" f && x_ e "$appdir/ec.bin.fw2" f
-
- cp "$appdir/"ec.bin.fw* "${_dest%/*}/" || \
- $err "!cp 1126ec $_dest - $dontflash"; :
+ x_ cp "$appdir/"ec.bin.fw* "${_dest%/*}/"
}
extract_e6400vga()
@@ -263,20 +256,14 @@ extract_sch5545ec()
# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988
extract_tbfw()
{
- chkvars TBFW_size
- fe_ copy_tbfw "$appdir" -type f -name "TBT.bin"
+ chkvars TBFW_size && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin"
[ -f "$_dest" ] || $err "$board: Could not extract tbfw"; :
}
copy_tbfw()
{
- [ -f "$1" ] || return 0
- [ -L "$1" ] && return 0
-
- x_ dd if=/dev/null of="$1" bs=1 seek=$TBFW_size
- x_ mv "$1" "$_dest"
-
- return 1
+ [ -f "$1" ] && [ ! -L "$1" ] && x_ dd if=/dev/null of="$1" bs=1 \
+ seek=$TBFW_size && x_ mv "$1" "$_dest" && return 1; :
}
extract_fsp()
@@ -318,10 +305,8 @@ inject()
esac
[ "$new_mac" = "keep" ] && new_mac=""
- if [ -n "$new_mac" ] && [ "$new_mac" != "restore" ]; then
- x_ make -C util/nvmutil clean
- x_ make -C util/nvmutil
- fi
+ [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \
+ x_ make -C util/nvmutil clean && x_ make -C util/nvmutil
check_release "$archive" || $err "'$archive' is not a release archive"
@@ -510,11 +495,10 @@ insert()
_offset=""
- if [ "$_t" = "fsp" ]; then
- [ $# -gt 3 ] && _offset="$4"
- else
- [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ] && \
- $err "insert $*, $rom: offset given but empty (undefined)"
+ if [ "$_t" = "fsp" ] && [ $# -gt 3 ]; then
+ _offset="$4"
+ elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then
+ $err "insert $*, $rom: offset given but empty (undefined)"
fi
[ "$nukemode" = "nuke" ] || x_ e "$_dest" f
@@ -551,10 +535,6 @@ modify_mac()
printf "\nGbE NVM written to '%s':\n" "$archive"
x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || :
-
- [ "$new_mac" = "restore" ] && \
- printf "\nDefault GbE file '%s' written, unmodified.\n" \
- "${CONFIG_GBE_BIN_PATH##*../}"; :
}
newmac()