summaryrefslogtreecommitdiff
path: root/script/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'script/vendor')
-rwxr-xr-xscript/vendor/download32
-rwxr-xr-xscript/vendor/inject30
2 files changed, 48 insertions, 14 deletions
diff --git a/script/vendor/download b/script/vendor/download
index 1f96c665..592c14bc 100755
--- a/script/vendor/download
+++ b/script/vendor/download
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# SPDX-FileCopyrightText: 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
-# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
+# SPDX-FileCopyrightText: 2023-2024 Leah Rowe <leah@libreboot.org>
. "include/err.sh"
. "include/option.sh"
@@ -14,16 +14,15 @@ _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
_7ztest="a"
e6400_unpack="${PWD}/src/bios_extract/dell_inspiron_1100_unpacker.py"
-kbc1126_ec_dump="${PWD}/${cbdir}/util/kbc1126/kbc1126_ec_dump"
me7updateparser="${PWD}/util/me7_update_parser/me7_update_parser.py"
-mecleaner="${PWD}/${cbdir}/util/me_cleaner/me_cleaner.py"
pfs_extract="${PWD}/src/biosutilities/Dell_PFS_Extract.py"
uefiextract="${PWD}/src/uefitool/uefiextract"
eval "$(setvars "" _b _dl EC_url EC_url_bkup EC_hash DL_hash DL_url DL_url_bkup \
E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \
E6400_VGA_romname SCH5545EC_DL_url SCH5545EC_DL_url_bkup SCH5545EC_DL_hash \
- is_rom)"
+ is_rom tree mecleaner kbc1126_ec_dump MRC_refcode_cbtree cbfstoolref \
+ MRC_refcode_gbe)"
main()
{
@@ -50,6 +49,13 @@ detect_firmware()
set -- "${boarddir}/config/"*
. "${1}" 2>/dev/null
+ . "${boarddir}/target.cfg" 2>/dev/null
+ [ -z "$tree" ] && err "detect_firmware $boarddir: tree undefined"
+ cbdir="src/coreboot/$tree"
+ cbfstool="cbutils/$tree/cbfstool"
+
+ mecleaner="${PWD}/${cbdir}/util/me_cleaner/me_cleaner.py"
+ kbc1126_ec_dump="${PWD}/${cbdir}/util/kbc1126/kbc1126_ec_dump"
for c in CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN CONFIG_KBC1126_FIRMWARE \
CONFIG_VGA_BIOS_FILE CONFIG_INCLUDE_SMSC_SCH5545_EC_FW; do
@@ -66,9 +72,14 @@ build_dependencies()
x_ ./update trees -f "${d}"
done
[ -f "${uefiextract}" ] || x_ ./update trees -b uefitool
- [ -f "${kbc1126_ec_dump}" ] || x_ make -C "${cbdir}/util/kbc1126"
+ [ ! -d "${kbc1126_ec_dump%/*}" ] || [ -f "${kbc1126_ec_dump}" ] || x_ \
+ make -C "${cbdir}/util/kbc1126"
+ [ -n "$MRC_refcode_cbtree" ] && \
+ cbfstoolref="cbutils/$MRC_refcode_cbtree/cbfstool"
+ [ -z "$cbfstoolref" ] || [ -f "$cbfstoolref" ] || \
+ x_ ./update trees -b coreboot utils $MRC_refcode_cbtree
[ -f "${cbfstool}" ] && [ -f "${ifdtool}" ] && return 0
- x_ ./update trees -b coreboot utils default
+ x_ ./update trees -b coreboot utils $tree
}
download_vendorfiles()
@@ -87,6 +98,10 @@ download_vendorfiles()
"$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE"
[ -z "${CONFIG_HAVE_MRC}" ] && return 0
fetch "mrc" "$MRC_url" "$MRC_url_bkup" "$MRC_hash" "$CONFIG_MRC_FILE"
+
+ # in case only mrc downloaded before, in a pair of mrc/refcode:
+ [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && fetch "ref" "$MRC_url" \
+ "$MRC_url_bkup" "$MRC_hash" "$CONFIG_REFCODE_BLOB_FILE"; return 0
}
fetch()
@@ -156,6 +171,9 @@ mkdirs()
extract_intel_me()
{
+ [ ! -f "$mecleaner" ] && \
+ 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
[ $# -gt 0 ] && _me="${1}" && cdir="${2}"
@@ -198,6 +216,8 @@ extract_archive()
extract_kbc1126ec()
{
+ [ ! -f "$kbc1126_ec_dump" ] && \
+ err "extract_kbc1126ec $cbdir: kbc1126_ec_dump missing"
(
x_ cd "${appdir}/"
mv Rompaq/68*.BIN ec.bin || :
diff --git a/script/vendor/inject b/script/vendor/inject
index 5734b599..2f55e166 100755
--- a/script/vendor/inject
+++ b/script/vendor/inject
@@ -2,14 +2,14 @@
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: 2022 Caleb La Grange <thonkpeasant@protonmail.com>
# SPDX-FileCopyrightText: 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
-# SPDX-FileCopyrightText: 2023 Leah Rowe <leah@libreboot.org>
+# SPDX-FileCopyrightText: 2023-2024 Leah Rowe <leah@libreboot.org>
. "include/err.sh"
. "include/option.sh"
nvmutil="util/nvmutil/nvm"
-eval "$(setvars "" archive rom modifygbe nukemode release new_mac)"
+eval "$(setvars "" archive rom modifygbe nukemode release new_mac tree)"
main()
{
@@ -51,7 +51,11 @@ check_board()
fi
boarddir="${cbcfgsdir}/${board}"
- [ -d "$boarddir" ] || err "check_board: board $board missing"; return 0
+ [ -d "$boarddir" ] || err "check_board: board $board missing"
+ [ -f "$boarddir/target.cfg" ] || \
+ err "check_board $board: target.cfg missing"
+ . "$boarddir/target.cfg" 2>/dev/null
+ [ -z "$tree" ] && err "check_board $board: tree undefined"; return 0
}
check_release()
@@ -84,9 +88,12 @@ detect_board()
build_dependencies()
{
- [ -d "${cbdir}" ] || x_ ./update trees -f coreboot default
+ cbdir="src/coreboot/$tree"
+ cbfstool="cbutils/$tree/cbfstool"
+ ifdtool="cbutils/$tree/ifdtool"
+ [ -d "${cbdir}" ] || x_ ./update trees -f coreboot $tree
if [ ! -f "${cbfstool}" ] || [ ! -f "${ifdtool}" ]; then
- x_ ./update trees -b coreboot utils default
+ x_ ./update trees -b coreboot utils $tree
fi
[ -z "$new_mac" ] || [ -f "$nvmutil" ] || x_ make -C util/nvmutil
[ "$nukemode" = "nuke" ] || x_ ./vendor download $board; return 0
@@ -144,6 +151,8 @@ patch_rom()
[ "$CONFIG_HAVE_MRC" = "y" ] && \
inject "mrc.bin" "${CONFIG_MRC_FILE}" "mrc" "0xfffa0000"
+ [ -n "$CONFIG_HAVE_REFCODE_BLOB" ] && \
+ inject "fallback/refcode" "$CONFIG_REFCODE_BLOB_FILE" "stage"
[ "${CONFIG_HAVE_ME_BIN}" = "y" ] && \
inject "IFD" "${CONFIG_ME_BIN_PATH}" "me"
[ "${CONFIG_KBC1126_FIRMWARE}" = "y" ] && \
@@ -200,9 +209,14 @@ inject()
fi
else
if [ "${nukemode}" != "nuke" ]; then
- "$cbfstool" "$rom" add -f "$_dest" \
- -n "$cbfsname" -t $_t $_offset || \
- err "inject $rom: can't insert $_t file $_dest"
+ if [ "$_t" = "stage" ]; then # broadwell refcode
+ "$cbfstool" "$rom" add-stage -f "$_dest" \
+ -n "$cbfsname" -t stage -c lzma
+ else
+ "$cbfstool" "$rom" add -f "$_dest" \
+ -n "$cbfsname" -t $_t $_offset || \
+ err "$rom: can't insert $_t file $_dest"
+ fi
else
"$cbfstool" "$rom" remove -n "$cbfsname" || \
err "inject $rom: can't remove $cbfsname"