summaryrefslogtreecommitdiff
path: root/script/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'script/vendor')
-rwxr-xr-xscript/vendor/download54
-rwxr-xr-xscript/vendor/inject44
2 files changed, 49 insertions, 49 deletions
diff --git a/script/vendor/download b/script/vendor/download
index 42cb16ab..b40810cc 100755
--- a/script/vendor/download
+++ b/script/vendor/download
@@ -25,14 +25,14 @@ eval "$(setvars "" _b _dl EC_url EC_url_bkup EC_hash DL_hash DL_url DL_url_bkup
main()
{
- [ $# -gt 0 ] || err "No argument given"
+ [ $# -gt 0 ] || $err "No argument given"
board="${1}"
boarddir="${cbcfgsdir}/${board}"
_b="${board%%_*mb}" # shorthand (no duplication per rom size)
check_defconfig "${boarddir}" && exit 0
detect_firmware && exit 0
- scan_config "${_b}" "config/vendor" "err"
+ scan_config "${_b}" "config/vendor"
build_dependencies
download_vendorfiles
@@ -49,7 +49,7 @@ detect_firmware()
set -- "${boarddir}/config/"*
. "${1}" 2>/dev/null
. "${boarddir}/target.cfg" 2>/dev/null
- [ -z "$tree" ] && err "detect_firmware $boarddir: tree undefined"
+ [ -z "$tree" ] && $err "detect_firmware $boarddir: tree undefined"
cbdir="src/coreboot/$tree"
cbfstool="cbutils/$tree/cbfstool"
@@ -110,8 +110,8 @@ fetch()
dl_bkup="${3}"
dlsum="${4}"
[ "${5}" = "/dev/null" ] && return 0
- [ "${5# }" = "$5" ] || err "fetch: space not allowed in _dest: '$5'"
- [ "${5#/}" = "$5" ] || err "fetch: absolute path not allowed: '$5'"
+ [ "${5# }" = "$5" ] || $err "fetch: space not allowed in _dest: '$5'"
+ [ "${5#/}" = "$5" ] || $err "fetch: absolute path not allowed: '$5'"
_dest="${5##*../}"
_dl="${vendir}/cache/${dlsum}"
dl_fail="n"
@@ -129,14 +129,14 @@ fetch()
vendor_checksum "${dlsum}" "${_dl}" || dl_fail="n"
done
[ "${dl_fail}" = "y" ] && \
- err "fetch ${dlsum}: matched file unavailable"
+ $err "fetch ${dlsum}: matched file unavailable"
x_ rm -Rf "${_dl}_extracted"
mkdirs "${_dest}" "extract_${dl_type}" || return 0
eval "extract_${dl_type}"
[ -f "${_dest}" ] && return 0
- err "extract_${dl_type} (fetch): missing file: '${_dest}'"
+ $err "extract_${dl_type} (fetch): missing file: '${_dest}'"
}
vendor_checksum()
@@ -152,17 +152,17 @@ mkdirs()
printf "mkdirs %s %s: already downloaded\n" "$1" "$2" 1>&2
return 1
fi
- mkdir -p "${1%/*}" || err "mkdirs: !mkdir -p ${1%/*}"
+ mkdir -p "${1%/*}" || $err "mkdirs: !mkdir -p ${1%/*}"
remkdir "${appdir}"
extract_archive "${_dl}" "${appdir}" || \
[ "${2}" = "extract_e6400vga" ] || \
- err "mkdirs ${1} ${2}: !extract"
+ $err "mkdirs ${1} ${2}: !extract"
}
extract_intel_me()
{
[ ! -f "$mecleaner" ] && \
- err "extract_intel_me $cbdir: me_cleaner missing"
+ $err "extract_intel_me $cbdir: me_cleaner missing"
_me="${PWD}/${_dest}" # must always be an absolute path
cdir="${PWD}/${appdir}" # must always be an absolute path
@@ -170,10 +170,10 @@ extract_intel_me()
[ -f "${_me}" ] && return 0
sdir="$(mktemp -d)"
- mkdir -p "$sdir" || err "extract_intel_me: !mkdir -p \"$sdir\""
+ mkdir -p "$sdir" || $err "extract_intel_me: !mkdir -p \"$sdir\""
(
[ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}"
- cd "$cdir" || err "extract_intel_me: !cd \"$cdir\""
+ cd "$cdir" || $err "extract_intel_me: !cd \"$cdir\""
for i in *; do
[ -f "$_me" ] && break
[ -L "$i" ] && continue
@@ -195,7 +195,7 @@ extract_intel_me()
cd "${cdir}" || :
done
)
- rm -Rf "${sdir}" || err "extract_intel_me: !rm -Rf ${sdir}"
+ rm -Rf "${sdir}" || $err "extract_intel_me: !rm -Rf ${sdir}"
}
extract_archive()
@@ -207,44 +207,44 @@ extract_archive()
extract_kbc1126ec()
{
[ ! -f "$kbc1126_ec_dump" ] && \
- err "extract_kbc1126ec $cbdir: kbc1126_ec_dump missing"
+ $err "extract_kbc1126ec $cbdir: kbc1126_ec_dump missing"
(
x_ cd "${appdir}/"
mv Rompaq/68*.BIN ec.bin || :
if [ ! -f ec.bin ]; then
unar -D ROM.CAB Rom.bin || unar -D Rom.CAB Rom.bin || \
- unar -D 68*.CAB Rom.bin || err "can't extract Rom.bin"
+ unar -D 68*.CAB Rom.bin || $err "can't extract Rom.bin"
x_ mv Rom.bin ec.bin
fi
- [ -f ec.bin ] || err "extract_kbc1126_ec ${board}: can't extract"
+ [ -f ec.bin ] || $err "extract_kbc1126_ec ${board}: can't extract"
"${kbc1126_ec_dump}" ec.bin || \
- err "extract_kbc1126_ec ${board}: can't extract ecfw1/2.bin"
- ) || err "can't extract kbc1126 ec firmware"
+ $err "extract_kbc1126_ec ${board}: can't extract ecfw1/2.bin"
+ ) || $err "can't extract kbc1126 ec firmware"
ec_ex="y"
for i in 1 2; do
[ -f "${appdir}/ec.bin.fw${i}" ] || ec_ex="n"
done
[ "${ec_ex}" = "y" ] || \
- err "extract_kbc1126_ec ${board}: didn't extract ecfw1/2.bin"
+ $err "extract_kbc1126_ec ${board}: didn't extract ecfw1/2.bin"
cp "${appdir}/"ec.bin.fw* "${_dest%/*}/" || \
- err "extract_kbc1126_ec ${board}: can't copy ec binaries"
+ $err "extract_kbc1126_ec ${board}: can't copy ec binaries"
}
extract_e6400vga()
{
for v in E6400_VGA_offset E6400_VGA_romname; do
- eval "[ -z \"\$$v\" ] && err \"extract_e6400vga: $v undefined\""
+ eval "[ -z \"\$$v\" ] && $err \"extract_e6400vga: $v undefined\""
done
tail -c +$E6400_VGA_offset "$_dl" | gunzip > "$appdir/bios.bin" || :
(
x_ cd "${appdir}"
- [ -f "bios.bin" ] || err "extract_e6400vga: can't extract bios.bin"
+ [ -f "bios.bin" ] || $err "extract_e6400vga: can't extract bios.bin"
"${e6400_unpack}" bios.bin || printf "TODO: fix dell extract util\n"
[ -f "${E6400_VGA_romname}" ] || \
- err "extract_e6400vga: can't extract vga rom from bios.bin"
- ) || err "can't extract e6400 vga rom"
+ $err "extract_e6400vga: can't extract vga rom from bios.bin"
+ ) || $err "can't extract e6400 vga rom"
cp "${appdir}/${E6400_VGA_romname}" "${_dest}" || \
- err "extract_e6400vga ${board}: can't copy vga rom to ${_dest}"
+ $err "extract_e6400vga ${board}: can't copy vga rom to ${_dest}"
}
extract_sch5545ec()
@@ -258,9 +258,9 @@ extract_sch5545ec()
# this makes the file defined by _sch5545ec_fw available to copy
"${uefiextract}" "${_bios}" || \
- err "extract_sch5545ec: cannot extract from uefi image"
+ $err "extract_sch5545ec: cannot extract from uefi image"
cp "${_sch5545ec_fw}" "${_dest}" || \
- err "extract_sch5545ec: cannot copy sch5545ec firmware file"
+ $err "extract_sch5545ec: cannot copy sch5545ec firmware file"
}
main $@
diff --git a/script/vendor/inject b/script/vendor/inject
index 4ac2753f..dc12d7b5 100755
--- a/script/vendor/inject
+++ b/script/vendor/inject
@@ -13,7 +13,7 @@ eval "$(setvars "" archive rom modifygbe nukemode release new_mac tree)"
main()
{
- [ $# -lt 1 ] && err "No options specified."
+ [ $# -lt 1 ] && $err "No options specified."
[ "${1}" = "listboards" ] && eval "items config/coreboot || :; exit 0"
archive="${1}"
@@ -42,8 +42,8 @@ check_board()
failcheck="n"
check_release "${archive}" || failcheck="y"
if [ "${failcheck}" = "y" ]; then
- [ -f "$rom" ] || err "check_board \"$rom\": invalid path"
- [ -z "${rom+x}" ] && err "check_board: no rom specified"
+ [ -f "$rom" ] || $err "check_board \"$rom\": invalid path"
+ [ -z "${rom+x}" ] && $err "check_board: no rom specified"
[ -n "${board+x}" ] || board=$(detect_board "${rom}")
else
release="y"
@@ -51,11 +51,11 @@ check_board()
fi
boarddir="${cbcfgsdir}/${board}"
- [ -d "$boarddir" ] || err "check_board: board $board missing"
+ [ -d "$boarddir" ] || $err "check_board: board $board missing"
[ -f "$boarddir/target.cfg" ] || \
- err "check_board $board: target.cfg missing"
+ $err "check_board $board: target.cfg missing"
. "$boarddir/target.cfg" 2>/dev/null
- [ -z "$tree" ] && err "check_board $board: tree undefined"; return 0
+ [ -z "$tree" ] && $err "check_board $board: tree undefined"; return 0
}
check_release()
@@ -80,7 +80,7 @@ detect_board()
_stripped_prefix=${filename#*_}
board="${_stripped_prefix%.tar.xz}" ;;
*)
- err "detect_board $filename: could not detect board type"
+ $err "detect_board $filename: could not detect board type"
esac
printf "%s\n" "${board}"
}
@@ -109,7 +109,7 @@ patch_release_roms()
_tmpdir="tmp/romdir"
remkdir "${_tmpdir}"
tar -xf "${archive}" -C "${_tmpdir}" || \
- err "patch_release_roms: !tar -xf \"$archive\" -C \"$_tmpdir\""
+ $err "patch_release_roms: !tar -xf \"$archive\" -C \"$_tmpdir\""
for x in "${_tmpdir}"/bin/*/*.rom ; do
printf "patching rom: %s\n" "$x"
@@ -118,14 +118,14 @@ patch_release_roms()
(
cd "${_tmpdir}/bin/"* || \
- err "patch_release_roms: !cd ${_tmpdir}/bin/*"
+ $err "patch_release_roms: !cd ${_tmpdir}/bin/*"
# NOTE: For compatibility with older rom releases, defer to sha1
[ "${nukemode}" = "nuke" ] || sha512sum --status -c vendorhashes || \
sha1sum --status -c vendorhashes || sha512sum --status -c \
blobhashes || sha1sum --status -c blobhashes || \
- err "patch_release_roms: ROMs did not match expected hashes"
- ) || err "can't verify vendor hashes"
+ $err "patch_release_roms: ROMs did not match expected hashes"
+ ) || $err "can't verify vendor hashes"
[ "${modifygbe}" = "true" ] && \
for x in "${_tmpdir}"/bin/*/*.rom ; do
@@ -143,7 +143,7 @@ patch_rom()
{
rom="${1}"
- check_defconfig "$boarddir" && err "patch_rom $boarddir: no configs"
+ check_defconfig "$boarddir" && $err "patch_rom $boarddir: no configs"
set -- "${boarddir}/config/"*
. "${1}" 2>/dev/null
@@ -174,18 +174,18 @@ patch_rom()
inject()
{
[ $# -lt 3 ] && \
- err "inject $@, $rom: usage: inject name path type (offset)"
+ $err "inject $@, $rom: usage: inject name path type (offset)"
eval "$(setvars "" cbfsname _dest _t _offset)"
cbfsname="${1}"
_dest="${2##*../}"
_t="${3}"
[ $# -gt 3 ] && _offset="-b ${4}" && [ -z "${4}" ] && \
- err "inject $@, $rom: offset passed, but empty (not defined)"
+ $err "inject $@, $rom: offset passed, but empty (not defined)"
- [ -z "${_dest}" ] && err "inject $@, ${rom}: empty destination path"
+ [ -z "${_dest}" ] && $err "inject $@, ${rom}: empty destination path"
[ ! -f "${_dest}" ] && [ "${nukemode}" != "nuke" ] && \
- err "inject_${dl_type}: file missing, ${_dest}"
+ $err "inject_${dl_type}: file missing, ${_dest}"
[ "$nukemode" = "nuke" ] || \
printf "Inserting %s/%s in file: %s\n" "$cbfsname" "$_t" "$rom"
@@ -193,18 +193,18 @@ inject()
if [ "${_t}" = "GbE" ]; then
x_ mkdir -p tmp
cp "${_dest}" "tmp/gbe.bin" || \
- err "inject: !cp \"${_dest}\" \"tmp/gbe.bin\""
+ $err "inject: !cp \"${_dest}\" \"tmp/gbe.bin\""
_dest="tmp/gbe.bin"
"${nvmutil}" "${_dest}" setmac "${new_mac}" || \
- err "inject ${_dest}: can't change mac address"
+ $err "inject ${_dest}: can't change mac address"
fi
if [ "${cbfsname}" = "IFD" ]; then
if [ "${nukemode}" != "nuke" ]; then
"$ifdtool" -i ${_t}:${_dest} "$rom" -O "$rom" || \
- err "inject: can't insert $_t ($dest) into $rom"
+ $err "inject: can't insert $_t ($dest) into $rom"
else
"$ifdtool" --nuke $_t "$rom" -O "$rom" || \
- err "inject $rom: can't nuke $_t in IFD"
+ $err "inject $rom: can't nuke $_t in IFD"
fi
else
if [ "${nukemode}" != "nuke" ]; then
@@ -214,11 +214,11 @@ inject()
else
"$cbfstool" "$rom" add -f "$_dest" \
-n "$cbfsname" -t $_t $_offset || \
- err "$rom: can't insert $_t file $_dest"
+ $err "$rom: can't insert $_t file $_dest"
fi
else
"$cbfstool" "$rom" remove -n "$cbfsname" || \
- err "inject $rom: can't remove $cbfsname"
+ $err "inject $rom: can't remove $cbfsname"
fi
fi
}