mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-18 14:12:44 +02:00
vendor.sh: use pad/unpad functions
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+5
-14
@@ -292,25 +292,16 @@ prep()
|
|||||||
[ -z "${_xromname#"$vfix"}" ] && err "$_xromname / $vfix: name match"
|
[ -z "${_xromname#"$vfix"}" ] && err "$_xromname / $vfix: name match"
|
||||||
|
|
||||||
# Remove the prefix and 1-byte pad
|
# Remove the prefix and 1-byte pad
|
||||||
if [ "$nuke" != "nuke" ] && \
|
[ "$nuke" != "nuke" ] && [ "${_xromname#"$vfix"}" != "$_xromname" ] \
|
||||||
[ "${_xromname#"$vfix"}" != "$_xromname" ]; then
|
&& unpad_one_byte "$_xrom" && x_ mv "$_xrom" "$_xromnew" \
|
||||||
xromsize="$(expr $(stat -c '%s' "$_xrom") - 1)" || err "!int"
|
&& _xrom="$_xromnew"
|
||||||
[ $xromsize -lt 524288 ] && err "too small, $xromsize: $_xrom"
|
|
||||||
|
|
||||||
x_ dd if="$_xrom" of="$_xromnew" bs=$xromsize count=1
|
|
||||||
x_ rm -f "$_xrom"
|
|
||||||
|
|
||||||
_xrom="$_xromnew"
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ "$nuke" != "nuke" ] || ( mksha512 "$_xrom" "vendorhashes" ) || err
|
[ "$nuke" != "nuke" ] || ( mksha512 "$_xrom" "vendorhashes" ) || err
|
||||||
|
|
||||||
add_vfiles "$_xrom" || return 1 # if break return, can still change MAC
|
add_vfiles "$_xrom" || return 1 # if break return, can still change MAC
|
||||||
[ "$nuke" != "nuke" ] && return 0
|
|
||||||
|
|
||||||
# Rename the file, prefixing a warning saying not to flash
|
[ "$nuke" = "nuke" ] && pad_one_byte "$_xrom" && x_ mv "$_xrom" \
|
||||||
cat "$_xrom" config/data/coreboot/0 > "$_xromnew" || err "!pad $_xrom"
|
"$_xromnew"; :
|
||||||
x_ rm -f "$_xrom"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mksha512()
|
mksha512()
|
||||||
|
|||||||
Reference in New Issue
Block a user