summaryrefslogtreecommitdiff
path: root/include/vendor.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-12-18 02:20:08 +0000
committerLeah Rowe <leah@libreboot.org>2024-12-18 02:28:29 +0000
commit9884e5ed1b0b6e5be00cd5cd7fd52454518e8dad (patch)
tree9a6a7ea38d3a51c010792da982f5d28fb8540802 /include/vendor.sh
parent36b42dd1c116a1e28a7b20c740d69aff7f0ce492 (diff)
T480/T480S: Support fetching ThunderBolt firmware
Though not used in coreboot builds, and not injected into the builds in any way, these files are now created seperately when handling T480/T480s vendor files: vendorfiles/t480/tb.bin vendorfiles/t480s/tb.bin These are created by extracting Lenovo's ThunderBolt firmware from update files. The updated firmware fixes a bug; older firmware enabled debug commands that wrote logs to the TB controller's own flash IC, and it'd get full up with logs, bricking the controller. If you've already been screwed by this, you must flash externally, using a padded firmware from Lenovo's updates. Lenovo's own updater requires creating a boot CD or booting Windows. This patch in lbmk auto-downloads just the firmware, and you can flash it externally. You could simply do this as a matter of course, when installing Libreboot. You are recommended to update the Lenovo UEFI/EC firmwares first, before installing Libreboot; please look at the Libreboot documentation to know exactly which versions. Then dump the ThunderBolt firmware first, to be sure, and then you can flash these files. Flashing these updates will prevent the bug described here: https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 You can download Lenovo's installers for various ThinkPad models there, including T480s/T480s. It is these downloads that this lbmk patch uses, to extract those files directly. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/vendor.sh')
-rw-r--r--include/vendor.sh32
1 files changed, 28 insertions, 4 deletions
diff --git a/include/vendor.sh b/include/vendor.sh
index 3f78c368..b1f47d6d 100644
--- a/include/vendor.sh
+++ b/include/vendor.sh
@@ -16,7 +16,8 @@ cv="CONFIG_HAVE_ME_BIN CONFIG_ME_BIN_PATH CONFIG_INCLUDE_SMSC_SCH5545_EC_FW \
CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET \
CONFIG_VGA_BIOS_FILE CONFIG_VGA_BIOS_ID CONFIG_BOARD_DELL_E6400 \
CONFIG_HAVE_MRC CONFIG_MRC_FILE CONFIG_HAVE_REFCODE_BLOB \
- CONFIG_REFCODE_BLOB_FILE CONFIG_GBE_BIN_PATH CONFIG_IFD_BIN_PATH"
+ CONFIG_REFCODE_BLOB_FILE CONFIG_GBE_BIN_PATH CONFIG_IFD_BIN_PATH \
+ CONFIG_LENOVO_TBFW_BIN"
eval `setvars "" EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \
E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \
@@ -24,7 +25,8 @@ eval `setvars "" EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \
mecleaner kbc1126_ec_dump MRC_refcode_cbtree new_mac _dl SCH5545EC_DL_url \
archive EC_url boarddir rom cbdir DL_url nukemode cbfstoolref vrelease \
verify _7ztest ME11bootguard ME11delta ME11version ME11sku ME11pch \
- IFD_platform ifdprefix cdir sdir _me _metmp mfs $cv`
+ IFD_platform ifdprefix cdir sdir _me _metmp mfs TBFW_url_bkup TBFW_url \
+ TBFW_hash $cv`
vendor_download()
{
@@ -52,7 +54,8 @@ readkconfig()
eval `setcfg "$TMPDIR/tmpcbcfg"`
for c in CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN CONFIG_KBC1126_FIRMWARE \
- CONFIG_VGA_BIOS_FILE CONFIG_INCLUDE_SMSC_SCH5545_EC_FW; do
+ CONFIG_VGA_BIOS_FILE CONFIG_INCLUDE_SMSC_SCH5545_EC_FW \
+ CONFIG_LENOVO_TBFW_BIN; do
eval "[ \"\${$c}\" = \"/dev/null\" ] && continue"
eval "[ -z \"\${$c}\" ] && continue"
eval `setcfg "config/vendor/$vcfg/pkg.cfg"`; return 0
@@ -82,7 +85,9 @@ getfiles()
[ -z "$CONFIG_VGA_BIOS_FILE" ] || fetch e6400vga "$E6400_VGA_DL_url" \
"$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE"
[ -z "$CONFIG_HAVE_MRC" ] || fetch "mrc" "$MRC_url" "$MRC_url_bkup" \
- "$MRC_hash" "$CONFIG_MRC_FILE"; return 0
+ "$MRC_hash" "$CONFIG_MRC_FILE"
+ [ -z "$CONFIG_LENOVO_TBFW_BIN" ] || fetch "tbfw" "$TBFW_url" \
+ "$TBFW_url_bkup" "$TBFW_hash" "$CONFIG_LENOVO_TBFW_BIN"; return 0
}
fetch()
@@ -231,6 +236,25 @@ extract_sch5545ec()
cp "$_sch5545ec_fw" "$_dest" || $err "$_dest: !sch5545 copy"
}
+# Lenovo ThunderBolt firmware updates:
+# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988
+extract_tbfw()
+{
+ x_ mkdir -p tmp
+ find "$appdir" -type f -name "TBT.bin" > "tmp/tb.txt" || \
+ $err "extract_tbfw $_dest: Can't extract TBT.bin"
+ while read -r f; do
+ [ -f "$f" ] || continue
+ [ -L "$f" ] && continue
+ cp "$f" "tmp/tb.bin" || \
+ $err "extract_tbfw $_dest: Can't copy TBT.bin"
+ break
+ done < "tmp/tb.txt"
+ dd if=/dev/null of=tmp/tb.bin bs=1 seek=1048576 || \
+ $err "extract_tbfw $_dest: Can't pad TBT.bin"
+ cp "tmp/tb.bin" "$_dest" || $err "extract_tbfw $_dest: copy error"; :
+}
+
vendor_inject()
{
set +u +e; [ $# -lt 1 ] && $err "No options specified."