summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-12-18 03:42:45 +0000
committerLeah Rowe <leah@libreboot.org>2024-12-18 03:42:45 +0000
commit02cbf8a729dd08be8a212695a9fcf93f05a8cec9 (patch)
tree867f7b9fd6215e3164174a66a54a7dd967a56637
parent9884e5ed1b0b6e5be00cd5cd7fd52454518e8dad (diff)
vendor.sh: make TBFW pad size configurable
we encountered 1MB flash so far, but we may encounter other sizes on other machines when added to libreboot later on Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--config/vendor/t480/pkg.cfg1
-rw-r--r--config/vendor/t480s/pkg.cfg1
-rw-r--r--include/vendor.sh5
3 files changed, 5 insertions, 2 deletions
diff --git a/config/vendor/t480/pkg.cfg b/config/vendor/t480/pkg.cfg
index 59280a8a..d692821d 100644
--- a/config/vendor/t480/pkg.cfg
+++ b/config/vendor/t480/pkg.cfg
@@ -17,3 +17,4 @@ ME11pch="LP"
TBFW_url="https://download.lenovo.com/pccbbs/mobiles/n24th13w.exe"
TBFW_url_bkup="https://web.archive.org/web/20241004165955/https://download.lenovo.com/pccbbs/mobiles/n24th13w.exe"
TBFW_hash="906d916e8ae77e6d146c67c3113cd904e735a7f28cb2fc37e2284758ead5cda8dd4025c1c741fac9162b1eb01cff08fc39a0d4e79c5cec0515f1d3e6447d1323"
+TBFW_size=1048576 # size in bytes, when padding, matching TBFW's flash IC
diff --git a/config/vendor/t480s/pkg.cfg b/config/vendor/t480s/pkg.cfg
index bbe2c5e9..e88b2f00 100644
--- a/config/vendor/t480s/pkg.cfg
+++ b/config/vendor/t480s/pkg.cfg
@@ -16,3 +16,4 @@ ME11pch="LP"
TBFW_url="https://download.lenovo.com/pccbbs/mobiles/n22th11w.exe"
TBFW_url_bkup="https://web.archive.org/web/20230319003752/https://download.lenovo.com/pccbbs/mobiles/n22th11w.exe"
TBFW_hash="ef8ec0a41d7faaa0ce514cfb6f8e7e10669c878eff69fbe1b821443b6218f5b31e1b910c8abceecf38d4b11a6e552d90f277c96c7a9c512d605c8b8aea9c1c0c"
+TBFW_size=1048576 # size in bytes, when padding, matching TBFW's flash IC
diff --git a/include/vendor.sh b/include/vendor.sh
index b1f47d6d..bd06af25 100644
--- a/include/vendor.sh
+++ b/include/vendor.sh
@@ -26,7 +26,7 @@ eval `setvars "" EC_url_bkup EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \
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 TBFW_url_bkup TBFW_url \
- TBFW_hash $cv`
+ TBFW_hash TBFW_size $cv`
vendor_download()
{
@@ -240,6 +240,7 @@ 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 # size in bytes, matching TBFW's flash IC
x_ mkdir -p tmp
find "$appdir" -type f -name "TBT.bin" > "tmp/tb.txt" || \
$err "extract_tbfw $_dest: Can't extract TBT.bin"
@@ -250,7 +251,7 @@ extract_tbfw()
$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 || \
+ dd if=/dev/null of=tmp/tb.bin bs=1 seek=$TBFW_size || \
$err "extract_tbfw $_dest: Can't pad TBT.bin"
cp "tmp/tb.bin" "$_dest" || $err "extract_tbfw $_dest: copy error"; :
}