Added support for Thinkpad B590

This commit is contained in:
leecher1337 2022-02-13 00:57:05 +00:00
parent 0d7767854f
commit 919a445a7b
8 changed files with 108 additions and 2 deletions

View File

@ -215,6 +215,8 @@ r0iuj17wd.iso sha1:FIXME x270 BIOS 1.24 (R0IE
r0iuj19wd.iso sha1:FIXME x270 BIOS 1.26 (R0IET48W) EC 1.15 (R0IHT35W)
# 20? sha1:FIXME x270 BIOS 1.27 (R0IET49W) EC 1.17 (R0IHT35W) "Dropped"
r0iuj21wd.iso sha1:3765d1715f001ddae982682f0189b49c2b04bf3a x270 BIOS 1.28 (R0IET50W) EC 1.15 (R0IHT35W)
h9et75ww.zip sha1:d81c145b371cf77abe6ae00d35d37491715feecd b590 BIOS ?.? (H9ET75WW) EC 1.01 (H9EC08WW)
h9et92ww.exe sha1:c1a3ba9282fe48a9e6f69e4dd32537c10a710e78 b590 BIOS ?.? (H9ET92WW) EC 1.02 (H9EC09WW)
# Next, sections for ISO images that do not follow a usable pattern
# (and cannot be currently automatically extracted / examined)
@ -230,6 +232,7 @@ j4uj75wd.iso sha1:3ff5025a4a5f62f461467f7726e5b2c1fa119b5b L440, L540 BIOS 1.93
# - update the tools to automatically determine the FAT_OFFSET
# The firmware files from inside the ISO images
H9ET92WW.CAP rule:CAP,dep:h9et92ww.exe,depi:h9et92ww.exe.bat;g3uj13us.iso.orig;h9et75ww.zip.orig,param:H9ET92WW.CAP;g3uj13us.iso;h9et75ww.zip b590 BIOS H9ET75WW Flash File
e330.H3EC35WW.s01H3000.FL1 rule:FL2,dep:h3uj76wd.iso,depi:h3uj76wd.iso.bat1;h3uj52wd.iso.orig,param:01H3000.FL1;h3uj52wd.iso e330 BIOS 1.16 Flash File
l430.G3HT40WW.s01D4000.FL1 rule:FL2,dep:g3uj13us.iso,depi:g3uj13us.iso.bat1,param:01D4000.FL1 l430 BIOS 2.54 Flash File
l440.J4HT27WW.s0AJ4000.FL1 rule:FL2,dep:j4uj62wd.iso,param:0AJ4000.FL1 l440 BIOS 1.73 Flash File
@ -286,6 +289,7 @@ x61.7MHT25WW.s01B2000.FL2 rule:oldISO,dep:7nuj22uc.iso,param:01B2000.FL2
# The actual EC firmware extracted from the BIOS firmware file
b590.H9ET92WW.img rule:IMGnuvoton,dep:H9ET92WW.CAP b590 EC 1.02 (not encrypted) (CR16CPlus cpu)
e330.H3EC35WW.img rule:IMGnuvoton,dep:e330.H3EC35WW.s01H3000.FL1 e330 EC 1.18 (not encrypted) (CR16CPlus cpu)
l430.G3HT40WW.img rule:IMGnuvoton,dep:l430.G3HT40WW.s01D4000.FL1 l430 EC 1.14 (not encrypted) (CR16CPlus cpu)
l440.J4HT29WW.img rule:IMGnoenc,dep:l440.J4HT29WW.s0AJ4000.FL1 l440 EC 1.10
@ -340,3 +344,4 @@ patched.x230.iso rule:niceISO,dep:g2uj31us.iso,suffix:0,insert:0 for patching
patched.x230t.iso rule:niceISO,dep:gcuj32us.iso,suffix:0,insert:0 for patching Thinkpad X230t
patched.l430.iso rule:niceISO,dep:g3uj13us.iso,suffix:0,insert:0 for patching Thinkpad L430, L530
patched.e330.iso rule:niceISO,dep:h3uj76wd.iso,suffix:0,insert:0 for patching Thinkpad E330
patched.b590.iso rule:niceISO,dep:h9et92ww.exe,suffix:0,insert:0 for patching Thinkpad B590

View File

@ -110,7 +110,7 @@ export MTOOLS_SKIP_CHECK=1
export MTOOLS_LOWER_CASE=0
build-deps:
apt -y install git mtools libssl-dev build-essential xorriso
apt -y install git mtools libssl-dev build-essential xorriso unzip innoextract
#
# Radare didnt seem to let me specify the directory to store the project file,
@ -166,7 +166,9 @@ patch_disable_keyboard:
# Download any ISO image that we have a checksum for
# NOTE: makes an assumption about the Lenovo URL not changing
.PRECIOUS: %.iso.orig
%.iso.orig:
.PRECIOUS: %.exe.orig
.PRECIOUS: %.zip.orig
%.iso.orig %.exe.orig %.zip.orig:
@echo -n "Downloading "
@scripts/describe $(basename $@)
@wget -nv -O $@ https://download.lenovo.com/pccbbs/mobiles/$(basename $@)
@ -210,6 +212,10 @@ patch_disable_keyboard:
@sed -e "s%__DIR%`mdir -/ -b -i $<@@$(FAT_OFFSET) |grep FL1 |head -1|cut -d/ -f3`%; s%__FL2%`mdir -/ -b -i $<@@$(FAT_OFFSET) |grep FL1 |head -1|cut -d/ -f4`%" autoexec.bat.template >$@.tmp
@mv $@.tmp $(subst .bat1,.bat,$@)
%.exe.bat: %.exe.orig autoexec.bat.template
@sed -e "s%__DIR%.%; s%__FL2%`basename \`innoextract -l $< | grep -i .CAP | cut -d'"' -f2\``%" autoexec.bat.template >$@.tmp
@mv $@.tmp $@
# helper to write the ISO onto a cdrw
%.iso.blank_burn: %.iso
wodim -eject -v speed=40 -tao gracetime=0 blank=fast $<
@ -241,6 +247,15 @@ patch_disable_keyboard:
$(eval FAT_OFFSET := $(shell scripts/geteltorito -c $^ 2>/dev/null))
mcopy -n -s -i $^@@$(FAT_OFFSET) :: $@
%.zip.extract: %.zip
unzip $^ -d $@
%.zip.orig.extract: %.zip
unzip $^ -d $@
%.exe.extract: %.exe
innoextract $^ -d $@
%.exe.orig.extract: %.exe.orig
innoextract $^ -d $@
## Use the system provided geteltorito script, if there is one
#GETELTORITO := $(shell if type geteltorito >/dev/null; then echo geteltorito; else echo ./geteltorito; fi)
@ -392,6 +407,55 @@ rule_FL2_insert_DEPS = scripts/ISO_copyFL2 # TODO - bat file
# - provide a simple mechanism for selecting the flash command to run, to
# allow for autoexec bat files that do not use dosflash
# Extract the CAP file from an EXE image
#
# $@ is the CAP file to create
# $< is the EXE file
# $1 is the pattern to match CAP file in EXE file
define rule_CAP_extract
mv `innoextract $< -I $(1) | grep -i $(1) | cut -d'"' -f2` $@
endef
rule_EXE_extract_DEPS = # add innoextract as dependency here?
# Create a new ISO image with patches applied
# This is specifically for B590 firmware where we have to combine a bootable DOS
# ISO with the Flash-updater tool from an older .ZIP archive and a new capsule
# from an Innosetup .EXE and combine it together into an ISO image
#
# $@ is the ISO to create
# $< is the CAP
# $1 is the pattern to match CAP file in EXE file
# $2 Name of other ISO that should be taken as a template with a working DOS on it
# $3 ZIP file where to take the DOS flash updater program from
define rule_CAP_insert
$(call buildinfo_ISO)
@cp --reflink=auto $(2).orig $@.tmp
$(eval FAT_OFFSET := $(shell scripts/geteltorito -c $(2).orig 2>/dev/null))
-mkdir -p $@.orig.extract.tmp
unzip -o $(3) DOS/\* -x \*.cap \*.IMC \*.BAT -d $@.orig.extract.tmp/
-mattrib -i $@.tmp@@$(FAT_OFFSET) -r -/ ::FLASH/
mdeltree -i $@.tmp@@$(FAT_OFFSET) FLASH/
mmd -i $@.tmp@@$(FAT_OFFSET) FLASH
mcopy -o -s -m -i $@.tmp@@$(FAT_OFFSET) $@.orig.extract.tmp/DOS/* ::/FLASH/
@rm -r $@.orig.extract.tmp
@cp --reflink=auto $< $<.tmp
@cp --reflink=auto $@.report $@.report.tmp
@cp --reflink=auto $@.bat $@.bat.tmp
@touch --date="1980-01-01 00:00:01Z" $<.tmp $@.report.tmp $@.bat.tmp
@# TODO - datestamp here could be the lastcommitdatestamp
mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $<.tmp ::/FLASH/$<
mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.report.tmp ::report.txt
mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.bat.tmp ::AUTOEXEC.BAT
@rm $<.tmp $@.report.tmp $@.bat.tmp
@mv $@.tmp $@
endef
rule_EXE_insert_DEPS =
# Insert the new firmware into the FL2 file
#
# $@ is the FL2 to create

View File

View File

View File

View File

@ -0,0 +1,37 @@
--- /tmp/H9ET92WW.cap.hex 2022-02-13 00:08:42.554196371 +0000
+++ /tmp/H9ET92WW.cap.bat.hex 2022-02-13 00:08:42.642198385 +0000
@@ -4178,14 +4178,14 @@
00010850 c9 a1 00 50 00 18 6a 05 70 5d 00 5f 04 55 24 4c |...P..j.p]._.U$L|
00010860 04 61 34 4c 24 00 01 00 82 00 14 90 81 49 b1 22 |.a4L$........I."|
00010870 1f 00 04 90 b0 22 e0 ff 10 27 04 d0 e0 18 42 05 |....."...'....B.|
-00010880 00 c0 cc 8d 00 50 00 18 38 05 70 5d 00 5f 02 55 |.....P..8.p]._.U|
+00010880 00 c0 cc 8d 00 50 e0 18 54 00 70 5d 00 5f 02 55 |.....P..T.p]._.U|
00010890 22 4c 02 61 32 4c 22 00 01 00 86 00 00 c0 ae 90 |"L.a2L".........|
000108a0 72 59 ff c0 2b fe 00 01 10 58 00 01 72 5d 22 5f |rY..+....X..r]"_|
000108b0 20 55 20 4c 20 61 30 4c 20 00 01 00 86 00 10 01 | U L a0L .......|
000108c0 b5 58 11 00 b4 58 27 00 b3 58 16 00 72 59 ff c0 |.X...X'..X..rY..|
000108d0 7b 99 8f 60 00 50 00 18 e8 04 70 5d 00 5f 02 55 |{..`.P....p]._.U|
000108e0 22 4c 02 61 32 4c 22 00 01 00 82 00 02 90 b0 22 |"L.a2L"........"|
-000108f0 e0 ff 30 26 e0 18 c8 04 70 5d 00 5f 02 55 22 4c |..0&....p]._.U"L|
+000108f0 e0 ff c0 26 e0 18 c8 04 70 5d 00 5f 02 55 22 4c |...&....p]._.U"L|
00010900 02 61 32 4c 22 00 01 00 82 00 b0 58 20 00 02 f3 |.a2L"......X ...|
00010910 14 01 72 59 ff c0 b9 fd 0f f0 72 5d 22 5f 20 55 |..rY......r]"_ U|
00010920 20 4c 20 61 30 4c 20 00 01 00 86 00 10 01 72 5d | L a0L .......r]|
@@ -4209,7 +4209,7 @@
00010a40 00 50 00 18 7c 03 70 5d 00 5f 02 55 22 4c 02 61 |.P..|.p]._.U"L.a|
00010a50 32 4c 22 00 01 00 82 00 02 90 b0 22 e0 ff b0 26 |2L"........"...&|
00010a60 09 00 e0 18 5a 03 72 5d 22 5f 20 55 20 4c 20 61 |....Z.r]"_ U L a|
-00010a70 30 4c 20 00 01 00 82 00 30 7b 02 00 80 18 42 03 |0L .....0{....B.|
+00010a70 30 4c 20 00 01 00 82 00 30 7b 02 00 e0 18 7e 00 |0L .....0{....~.|
00010a80 72 5d 22 5f 20 55 20 4c 20 61 30 4c 20 00 01 00 |r]"_ U L a0L ...|
00010a90 82 00 60 7b 01 00 82 13 20 55 22 4c 02 61 32 4c |..`{.... U"L.a2L|
00010aa0 22 00 01 00 a6 00 02 b1 20 50 a8 12 72 5d 22 5f |"....... P..r]"_|
@@ -4219,7 +4219,7 @@
00010ae0 02 55 22 4c 02 61 32 4c 22 00 01 00 82 00 02 90 |.U"L.a2L".......|
00010af0 b0 22 e0 ff 20 26 e0 18 c6 02 70 5d 00 5f 02 55 |.".. &....p]._.U|
00010b00 22 4c 02 61 32 4c 22 00 01 00 82 00 12 00 00 71 |"L.a2L"........q|
-00010b10 96 04 62 7b 01 00 94 10 b0 20 fe ff e2 10 10 24 |..b{..... .....$|
+00010b10 96 04 62 73 01 00 52 73 01 00 00 2c 00 2c 10 24 |..bs..Rs...,.,.$|
00010b20 13 00 00 71 96 04 72 5d 22 5f 20 55 20 4c 20 61 |...q..r]"_ U L a|
00010b30 30 4c 20 00 01 00 82 00 00 71 02 00 20 55 24 55 |0L ......q.. U$U|
00010b40 44 61 24 61 64 4c 24 00 01 00 76 05 20 4c 20 61 |Da$adL$...v. L a|