Skip to content

Commit e6b0442

Browse files
authored
Merge pull request #1966 from thickfont/poc_t480s
t480s port
2 parents ec2a790 + d60cb9f commit e6b0442

19 files changed

+1380
-23
lines changed

.circleci/config.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ jobs:
102102
- run:
103103
name: Download, neuter and deguard xx80 ME (keep generated GBE and extracted IFD in tree)
104104
command: |
105-
./blobs/xx80/download_clean_deguard_me_pad_tb.sh -m $(readlink -f ./blobs/utils/me_cleaner/me_cleaner.py) ./blobs/xx80/
105+
./blobs/xx80/t480_download_clean_deguard_me_pad_tb.sh -m $(readlink -f ./blobs/utils/me_cleaner/me_cleaner.py) ./blobs/xx80/
106+
./blobs/xx80/t480s_download_clean_deguard_me_pad_tb.sh -m $(readlink -f ./blobs/utils/me_cleaner/me_cleaner.py) ./blobs/xx80/
106107
- run:
107108
name: Download and extract t530 vbios roms for dgpu boards
108109
command: |
@@ -527,14 +528,28 @@ workflows:
527528
requires:
528529
- librem_14
529530

530-
# t480 is based on 25.09 coreboot release, not sharing any buildstack from now, depend on muscl-cross cache
531+
# t480 is based on 25.09 coreboot release
531532
- build:
532533
name: EOL_t480-maximized
533534
target: EOL_t480-maximized
534535
subcommand: ""
535536
requires:
536537
- EOL_t480-hotp-maximized
537538

539+
- build:
540+
name: EOL_t480s-hotp-maximized
541+
target: EOL_t480s-hotp-maximized
542+
subcommand: ""
543+
requires:
544+
- EOL_t480-hotp-maximized
545+
546+
- build:
547+
name: EOL_t480s-maximized
548+
target: EOL_t480s-maximized
549+
subcommand: ""
550+
requires:
551+
- EOL_t480-hotp-maximized
552+
538553
# dasharo release, share 24.02.01 utils/crossgcc
539554
- build:
540555
name: UNTESTED_nitropad-ns50
@@ -543,7 +558,7 @@ workflows:
543558
requires:
544559
- novacustom-nv4x_adl
545560

546-
#NovaCustom v56 boards are based on coreboot 24.02.01 fork, so depend on x230
561+
#NovaCustom v56 boards are based on coreboot 24.02.01 fork, so depend on nv4x_adl
547562
- build:
548563
name: novacustom-v560tu
549564
target: novacustom-v560tu

BOARDS_AND_TESTERS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ xx4x (Haswell: Intel 4th Gen CPU)
5959
xx8x (Kaby Lake Refresh: Intel 8th Gen Mobile : ESU ended 12/31/2024)
6060
===
6161
- [ ] t480: @gaspar-ilom @doritos4mlady @MattClifton76 @notgivenby @akunterkontrolle
62+
- [ ] t480s: @thickfont @kjkent @HarleyGodfrey @nestire
6263

6364
Librem
6465
===

blobs/xx30/optiplex_7010_9010.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ if [[ ! -f "${output_dir}/IVB_BIOSAC_PRODUCTION.bin" ]] || [[ ! -f "${output_dir
3232
mv IVB_BIOSAC_PRODUCTION.bin "${output_dir}/"
3333

3434
#Download sinit
35+
if wget https://dl.3mdeb.com/mirror/intel/acm/SNB_IVB_SINIT_20190708_PW.bin -O "${output_dir}/SNB_IVB_SINIT_20190708_PW.bin"; then
36+
# As per https://github.com/Dasharo/dasharo-issues/issues/1283#issuecomment-3178940096 : use 3mdeb's intel mirror for sinit blob
37+
popd || exit
3538
# Original URL got rid of needed file, keeping original URL. Let's use archive.org
3639
#wget https://cdrdv2.intel.com/v1/dl/getContent/630744 -O sinit.zip
37-
if wget http://web.archive.org/web/20230712081031/https://cdrdv2.intel.com/v1/dl/getContent/630744 -O sinit.zip; then
40+
elif wget http://web.archive.org/web/20230712081031/https://cdrdv2.intel.com/v1/dl/getContent/630744 -O sinit.zip; then
3841
unzip sinit.zip
3942
mv 630744_002/SNB_IVB_SINIT_20190708_PW.bin "${output_dir}/"
4043
popd || exit
41-
elif wget https://dl.3mdeb.com/mirror/intel/acm/SNB_IVB_SINIT_20190708_PW.bin -O "${output_dir}/SNB_IVB_SINIT_20190708_PW.bin"; then
42-
# As per https://github.com/Dasharo/dasharo-issues/issues/1283#issuecomment-3178940096 : use 3mdeb's intel mirror for sinit blob
43-
popd || exit
4444
else
4545
echo "Can't download sinit blob, failing"
4646
exit 1

blobs/xx80/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
me.bin
22
tb.bin
3+
t480_tb.bin
4+
t480s_tb.bin
5+
t480_me.bin
6+
t480s_me.bin

blobs/xx80/hashes.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
d3af2dfbf128bcddfc8c5810a11478697312e5701668f719f80f3f6322db5642 gbe.bin
2-
f2f6d5fb0a5e02964b494862032fd93f1f88e2febd9904b936083600645c7fdf ifd.bin
3-
1990b42df67ba70292f4f6e2660efb909917452dcb9bd4b65ea2f86402cfa16b me.bin
4-
fc9c47ff4b16f036a7f49900f9da1983a5db44ca46156238b7b42e636d317388 tb.bin
1+
#T480:
2+
1990b42df67ba70292f4f6e2660efb909917452dcb9bd4b65ea2f86402cfa16b t480_me.bin
3+
fc9c47ff4b16f036a7f49900f9da1983a5db44ca46156238b7b42e636d317388 t480_tb.bin
4+
d3af2dfbf128bcddfc8c5810a11478697312e5701668f719f80f3f6322db5642 t480_gbe.bin
5+
f2f6d5fb0a5e02964b494862032fd93f1f88e2febd9904b936083600645c7fdf t480_ifd.bin
6+
#T480s:
7+
7bc47ed1ead1d72a135e7adff207ae8ddddc56d81128d9d6a8061ad04685c73b t480s_me.bin
8+
b53e4670327e076ef879b2abef0efd9aade20da88d0c0976921b9f32378c0119 t480s_tb.bin
9+
caf6393cd5c4ff305b677f50c258658710c42439080868c1fb8ea7584cffb204 t480s_ifd.bin
10+
36be39ecd0d06fa3f7893ca2746f702271c46b75de52bc599467a058bab8e271 t480s_gbe.bin

blobs/xx80/download_clean_deguard_me_pad_tb.sh renamed to blobs/xx80/t480_download_clean_deguard_me_pad_tb.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function download_and_clean() {
8282
# Some more general info on shrinking:
8383
# https://github.com/corna/me_cleaner/wiki/External-flashing#neutralize-and-shrink-intel-me-useful-only-for-coreboot
8484

85+
# MFS is needed for deguard so we whitelist it here and also do not relocate the FTPR partition
8586
python "$me_cleaner" --whitelist MFS -t -O "$me_output" "${me_installer_filename}_extracted/Firmware/${extracted_me_filename}"
8687
rm -rf ./*
8788
popd || exit
@@ -171,8 +172,8 @@ function parse_params() {
171172
usage_err "No valid output dir found"
172173
fi
173174
me_cleaned="${output_dir}/me_cleaned.bin"
174-
me_deguarded="${output_dir}/me.bin"
175-
tb_flashable="${output_dir}/tb.bin"
175+
me_deguarded="${output_dir}/t480_me.bin"
176+
tb_flashable="${output_dir}/t480_tb.bin"
176177
echo "Writing cleaned and deguarded ME to ${me_deguarded}"
177178
echo "Writing flashable TB to ${tb_flashable}"
178179
}
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
#!/usr/bin/env bash
2+
3+
# These variables are all for the deguard tool.
4+
# They would need to be changed if using the tool for other devices like the T480s or with a different ME version...
5+
ME_delta="thinkpad_t480s"
6+
ME_version="11.6.0.1126"
7+
ME_sku="2M"
8+
ME_pch="LP"
9+
10+
# Thunderbolt firmware offset in bytes to pad to 1M
11+
TBFW_SIZE=1048575
12+
13+
# Integrity checks for the vendor provided ME blob...
14+
ME_DOWNLOAD_HASH="ddfbc51430699e0dfcb24a60bcb5b6e5481b325ebecf1ac177e069013189e4b0"
15+
# ...and the cleaned and deguarded version from that blob.
16+
DEGUARDED_ME_BIN_HASH="7bc47ed1ead1d72a135e7adff207ae8ddddc56d81128d9d6a8061ad04685c73b"
17+
# Integrity checks for the vendor provided Thunderbolt blob...
18+
TB_DOWNLOAD_HASH="090d0085af4a20bcdfba8a75f1bce735ff80afbfea968bbe276a80a0c4c18706"
19+
# ...and the padded and flashable version from that blob.
20+
TB_BIN_HASH="b53e4670327e076ef879b2abef0efd9aade20da88d0c0976921b9f32378c0119"
21+
22+
23+
function usage() {
24+
echo -n \
25+
"Usage: $(basename "$0") -m <me_cleaner>(optional) path_to_output_directory
26+
Download Intel ME firmware from Dell, neutralize and shrink keeping the MFS.
27+
Download Thunderbolt firmware from Lenovo and pad it for flashing externally.
28+
"
29+
}
30+
31+
function chk_sha256sum() {
32+
sha256_hash="$1"
33+
filename="$2"
34+
echo "$sha256_hash" "$filename" "$(pwd)"
35+
sha256sum "$filename"
36+
if ! echo "${sha256_hash} ${filename}" | sha256sum --check; then
37+
echo "ERROR: SHA256 checksum for ${filename} doesn't match."
38+
exit 1
39+
fi
40+
}
41+
42+
function chk_exists_and_matches() {
43+
if [[ -f "$1" ]]; then
44+
if echo "${2} ${1}" | sha256sum --check; then
45+
echo "SKIPPING: SHA256 checksum for $1 matches."
46+
[[ "$3" = ME ]] && me_exists="y"
47+
[[ "$3" = TB ]] && tb_exists="y"
48+
fi
49+
echo "$1 exists but checksum doesn't match. Continuing..."
50+
fi
51+
}
52+
53+
function download_and_clean() {
54+
me_cleaner="$(realpath "${1}")"
55+
me_output="$(realpath "${2}")"
56+
57+
# Download and unpack the Dell installer into a temporary directory and
58+
# extract the deguardable Intel ME blob.
59+
pushd "$(mktemp -d)" || exit
60+
61+
# Download the installer that contains the ME blob
62+
me_installer_filename="Inspiron_5468_1.3.0.exe"
63+
user_agent="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
64+
curl -A "$user_agent" -s -O "https://dl.dell.com/FOLDER04573471M/1/${me_installer_filename}"
65+
chk_sha256sum "$ME_DOWNLOAD_HASH" "$me_installer_filename"
66+
67+
# Download the tool to unpack Dell's installer and unpack the ME blob.
68+
git clone https://github.com/platomav/BIOSUtilities
69+
git -C BIOSUtilities checkout ef50b75ae115ae8162fa8b0a7b8c42b1d2db894b
70+
71+
python "BIOSUtilities/Dell_PFS_Extract.py" "${me_installer_filename}" -e || exit
72+
73+
extracted_me_filename="1 Inspiron_5468_1.3.0 -- 3 Intel Management Engine (Non-VPro) Update v${ME_version}.bin"
74+
75+
# Deactivate, partially neuter and shrink Intel ME. Note that this doesn't include
76+
# --soft-disable to set the "ME Disable" or "ME Disable B" (e.g.,
77+
# High Assurance Program) bits, as they are defined within the Flash
78+
# Descriptor.
79+
# However, the HAP bit must be enabled to make the deguarded ME work. We only clean the ME in this function.
80+
# For ME 11.x this means we must keep the rbe, bup, kernel and syslib modules.
81+
# https://github.com/corna/me_cleaner/wiki/How-does-it-work%3F#me-versions-from-11x-skylake-1
82+
# Furthermore, deguard requires keeping the MFS, the HAP bit set, and we cannot relocate the FTPR partition.
83+
# Some more general info on shrinking:
84+
# https://github.com/corna/me_cleaner/wiki/External-flashing#neutralize-and-shrink-intel-me-useful-only-for-coreboot
85+
86+
# MFS is needed for deguard so we whitelist it here and also do not relocate the FTPR partition
87+
python "$me_cleaner" --whitelist MFS -t -O "$me_output" "${me_installer_filename}_extracted/Firmware/${extracted_me_filename}"
88+
rm -rf ./*
89+
popd || exit
90+
}
91+
92+
function deguard() {
93+
me_input="$(realpath "${1}")"
94+
me_output="$(realpath "${2}")"
95+
96+
# Download the deguard tool into a temporary directory and apply the patch to the cleaned ME blob.
97+
pushd "$(mktemp -d)" || exit
98+
git clone https://github.com/coreboot/deguard
99+
pushd deguard || exit
100+
git checkout 0ed3e4ff824fc42f71ee22907d0594ded38ba7b2
101+
102+
python ./finalimage.py \
103+
--delta "data/delta/$ME_delta" \
104+
--version "$ME_version" \
105+
--pch "$ME_pch" \
106+
--sku "$ME_sku" \
107+
--fake-fpfs data/fpfs/zero \
108+
--input "$me_input" \
109+
--output "$me_output"
110+
111+
popd || exit
112+
#Cleanup
113+
rm -rf ./*
114+
popd || exit
115+
}
116+
117+
function download_and_pad_tb() {
118+
tb_output="$(realpath "${1}")"
119+
120+
# Download and unpack the Lenovo installer into a temporary directory and
121+
# extract the TB blob.
122+
pushd "$(mktemp -d)" || exit
123+
124+
# Download the installer that contains the T480s TB blob
125+
tb_installer_filename=""n22th11w.exe""
126+
user_agent="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
127+
curl -A "$user_agent" -s -O "https://download.lenovo.com/pccbbs/mobiles/${tb_installer_filename}"
128+
chk_sha256sum "$TB_DOWNLOAD_HASH" "$tb_installer_filename"
129+
130+
# https://www.reddit.com/r/thinkpad/comments/9rnimi/ladies_and_gentlemen_i_present_to_you_the/
131+
innoextract n22th11w.exe -d .
132+
mv ./code\$GetExtractPath\$/TBT.bin tb.bin
133+
# pad with zeros
134+
dd if=/dev/zero of=tb.bin bs=1 seek="$TBFW_SIZE" count=1
135+
mv "tb.bin" "$tb_output"
136+
137+
rm -rf ./*
138+
popd || exit
139+
}
140+
141+
function usage_err() {
142+
echo "$1"
143+
usage
144+
exit 1
145+
}
146+
147+
function parse_params() {
148+
while getopts ":m:" opt; do
149+
case $opt in
150+
m)
151+
if [[ -x "$OPTARG" ]]; then
152+
me_cleaner="$OPTARG"
153+
fi
154+
;;
155+
?)
156+
usage_err "Invalid Option: -$OPTARG"
157+
;;
158+
esac
159+
done
160+
161+
if [[ -z "${me_cleaner}" ]]; then
162+
if [[ -z "${COREBOOT_DIR}" ]]; then
163+
usage_err "ERROR: me_cleaner.py not found. Set path with -m parameter or define the COREBOOT_DIR variable."
164+
else
165+
me_cleaner="${COREBOOT_DIR}/util/me_cleaner/me_cleaner.py"
166+
fi
167+
fi
168+
echo "Using me_cleaner from ${me_cleaner}"
169+
170+
shift $(($OPTIND - 1))
171+
output_dir="$(realpath "${1:-./}")"
172+
if [[ ! -d "${output_dir}" ]]; then
173+
usage_err "No valid output dir found"
174+
fi
175+
me_cleaned="${output_dir}/me_cleaned.bin"
176+
me_deguarded="${output_dir}/t480s_me.bin"
177+
tb_flashable="${output_dir}/t480s_tb.bin"
178+
echo "Writing cleaned and deguarded ME to ${me_deguarded}"
179+
echo "Writing flashable TB to ${tb_flashable}"
180+
}
181+
182+
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
183+
if [[ "${1:-}" == "--help" ]]; then
184+
usage
185+
exit 0
186+
fi
187+
188+
parse_params "$@"
189+
chk_exists_and_matches "$me_deguarded" "$DEGUARDED_ME_BIN_HASH" ME
190+
chk_exists_and_matches "$tb_flashable" "$TB_BIN_HASH" TB
191+
192+
if [[ -z "$me_exists" ]]; then
193+
download_and_clean "$me_cleaner" "$me_cleaned"
194+
deguard "$me_cleaned" "$me_deguarded"
195+
rm -f "$me_cleaned"
196+
fi
197+
198+
if [[ -z "$tb_exists" ]]; then
199+
download_and_pad_tb "$tb_flashable"
200+
fi
201+
202+
chk_sha256sum "$DEGUARDED_ME_BIN_HASH" "$me_deguarded"
203+
chk_sha256sum "$TB_BIN_HASH" "$tb_flashable"
204+
fi

blobs/xx80/t480s_gbe.bin

8 KB
Binary file not shown.

0 commit comments

Comments
 (0)