Adding support for B580, V480, V480c, V580, V580c

pull/212/head
leecher1337 2 years ago
parent 919a445a7b
commit 830a1a2037

@ -215,8 +215,9 @@ 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)
h9et75ww.zip sha1:d81c145b371cf77abe6ae00d35d37491715feecd b590,b490 BIOS ?.? (H9ET75WW) EC 1.01 (H9EC08WW)
h9et92ww.exe sha1:c1a3ba9282fe48a9e6f69e4dd32537c10a710e78 b590,b490 BIOS ?.? (H9ET92WW) EC 1.02 (H9EC09WW)
h1uj53us.exe sha1:8056b5c5867a16797ae9e62e7cd968d09284ff42 b480,b580 BIOS 1.16 (H1ET73WW,H5ET73WW) EC 1.13 (H1EC33WW,H5EC33WW)
# Next, sections for ISO images that do not follow a usable pattern
# (and cannot be currently automatically extracted / examined)
@ -233,6 +234,7 @@ j4uj75wd.iso sha1:3ff5025a4a5f62f461467f7726e5b2c1fa119b5b L440, L540 BIOS 1.93
# 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
b580.h1et73ww.s0AH1000.EXE rule:EXE,dep:h1uj53us.exe,depi:h1uj53us.exe.bat1;g3uj13us.iso.orig,param:\\$$0AH1000.FL1;g3uj13us.iso b580 BIOS H1ET73WW 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
@ -290,6 +292,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)
b580.H1ET73WW.img rule:IMGnuvoton,dep:b580.h1et73ww.s0AH1000.EXE b580 EC 1.13 (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
@ -343,5 +346,6 @@ patched.w530.iso rule:niceISO,dep:g5uj37us.iso,suffix:0,insert:0 for patching
patched.x230.iso rule:niceISO,dep:g2uj31us.iso,suffix:0,insert:0 for patching Thinkpad X230
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
patched.e330.iso rule:niceISO,dep:h3uj76wd.iso,suffix:0,insert:0 for patching Thinkpad E330, V480s
patched.b590.iso rule:niceISO,dep:h9et92ww.exe,suffix:0,insert:0 for patching Thinkpad B490, B590
patched.b580.iso rule:niceISO,dep:h1uj53us.exe,suffix:0,insert:0 for patching Thinkpad B480, B580, V480, V480c, V580, V580c

@ -216,6 +216,10 @@ patch_disable_keyboard:
@sed -e "s%__DIR%.%; s%__FL2%`basename \`innoextract -l $< | grep -i .CAP | cut -d'"' -f2\``%" autoexec.bat.template >$@.tmp
@mv $@.tmp $@
%.exe.bat1: %.exe.orig autoexec.bat.template
@sed -e "s%__DIR%.%; s%__FL2%`basename \`innoextract -l $< | grep -i .FL1 | 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 $<
@ -315,6 +319,7 @@ mec-tools/mec_encrypt: mec-tools/Makefile
make -C mec-tools
nuvoton-tools/npce885crc:
-mkdir nuvoton-tools
wget -O nuvoton-tools/npce885crc.c https://raw.githubusercontent.com/leecher1337/thinkpad-Lx30-ec/main/fwpat/util/npce885crc.c
gcc -o nuvoton-tools/npce885crc nuvoton-tools/npce885crc.c
@ -352,6 +357,10 @@ define rule_IMG_extract
endef
rule_IMG_extract_DEPS = scripts/FL2_copyIMG mec-tools/mec_encrypt mec-tools/mec_csum_flasher mec-tools/mec_csum_boot
# $@ is the ISO to create
# $< is the FL2
# $1 is the pattern to match FL2 file in ISO image
# $2 FAT offset in ISO image
define prepare_iso_from_tpl
$(eval FAT_OFFSET_FL1SRC := $(shell scripts/geteltorito -c $@.orig 2>/dev/null))
$(eval FLASH_FILE := $(subst $$,\$$$$,$(shell mdir -/ -b -i $@.orig@@$(FAT_OFFSET_FL1SRC) | grep -i $(1) | head -1)))
@ -415,6 +424,11 @@ rule_FL2_insert_DEPS = scripts/ISO_copyFL2 # TODO - bat file
define rule_CAP_extract
mv `innoextract $< -I $(1) | grep -i $(1) | cut -d'"' -f2` $@
endef
rule_CAP_extract_DEPS = # add innoextract as dependency here?
define rule_EXE_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
@ -433,7 +447,7 @@ define rule_CAP_insert
@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/
unzip -o $(3).orig 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
@ -453,6 +467,48 @@ define rule_CAP_insert
@rm $<.tmp $@.report.tmp $@.bat.tmp
@mv $@.tmp $@
endef
rule_CAP_insert_DEPS =
# Create a new ISO image with patches applied
# This is specifically for B580 firmware where we have to combine a bootable DOS
# ISO with a patched FL2 together into an ISO image
#
# $@ is the ISO to create
# $< is the CAP
# $1 is the pattern to match FL1 file in EXE file
# $2 Name of other ISO that should be taken as a template with DOS and DOSFLASH
define rule_EXE_insert
$(call buildinfo_ISO)
@cp -f --reflink=auto $(2).orig $@.tmp
$(eval FAT_OFFSET := $(shell scripts/geteltorito -c $(2).orig 2>/dev/null))
$(eval DOSFLASH := $(shell mdir -/ -b -i $(2).orig@@$(FAT_OFFSET) | grep -i DOSFLASH | head -1))
$(eval FILE_DIR := $(shell dirname `innoextract -l $@.orig | grep -i $(1:::%=%) | cut -d'"' -f2 | cut -b5-`))
-rm -rf $@.orig.extract.tmp
mkdir $@.orig.extract.tmp
mcopy -n -s -m -i $@.tmp@@$(FAT_OFFSET) $(DOSFLASH) $@.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/DOSFLASH.EXE ::/FLASH/
mcopy -o -s -m -i $@.tmp@@$(FAT_OFFSET) $< ::/FLASH/$(subst $$,\$$,$(subst \\,,$(1:::%=%)))
rm -r $@.orig.extract.tmp
cp --reflink=auto $< $<.tmp
cp --reflink=auto $@.report $@.report.tmp
cp --reflink=auto $@.bat1 $@.bat.tmp
touch --date="1980-01-01 00:00:01Z" $<.tmp $@.report.tmp $@.bat.tmp
@# TODO - datestamp here could be the lastcommitdatestamp
./scripts/ISO_copyFL2 to_iso $@.tmp $<.tmp $(subst $$,\$$,$(subst \\,,$(1:::%=%)))
-mdel -i $@.tmp@@$(FAT_OFFSET) ::EFI/Boot/BootX64.efi
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 =

@ -40,7 +40,8 @@ There are a small number of thinkpads with a model number
from the "xx30" series that are using a completely different EC CPU and
a different BIOS update strategy.
The Nuvotron EC has been analyzed by the [thinkpad-Lx30-ec project](https://github.com/leecher1337/thinkpad-Lx30-ec).
This is known to be the case for at least the L430, L530 and E330.
This is known to be the case for at least the
L430, L530, B580, V480, V480c, V580, V580c and E330.
Patches are included now, for documentation, please check the mentioned
repository.

@ -0,0 +1,39 @@
--- /tmp/$0AH1000.FL1.hex 2022-05-14 18:56:43.880739098 +0200
+++ /tmp/$0AH1000.FL1.bat.hex 2022-05-14 18:56:44.124742666 +0200
@@ -4197,14 +4197,14 @@
00010980 ff c0 97 a0 00 50 00 18 6a 05 70 5d 00 5f 04 55 |.....P..j.p]._.U|
00010990 24 4c 04 61 34 4c 24 00 01 00 82 00 14 90 81 49 |$L.a4L$........I|
000109a0 b1 22 1f 00 04 90 b0 22 e0 ff 10 27 04 d0 e0 18 |."....."...'....|
-000109b0 42 05 00 c0 72 8e 00 50 00 18 38 05 70 5d 00 5f |B...r..P..8.p]._|
+000109b0 42 05 00 c0 72 8e 00 50 e0 18 54 00 70 5d 00 5f |B...r..P..T.p]._|
000109c0 02 55 22 4c 02 61 32 4c 22 00 01 00 86 00 00 c0 |.U"L.a2L".......|
000109d0 54 91 72 59 ff c0 2b fe 00 01 10 58 00 01 72 5d |T.rY..+....X..r]|
000109e0 22 5f 20 55 20 4c 20 61 30 4c 20 00 01 00 86 00 |"_ U L a0L .....|
000109f0 10 01 b5 58 11 00 b4 58 27 00 b3 58 16 00 72 59 |...X...X'..X..rY|
00010a00 ff c0 49 98 8f 60 00 50 00 18 e8 04 70 5d 00 5f |..I..`.P....p]._|
00010a10 02 55 22 4c 02 61 32 4c 22 00 01 00 82 00 02 90 |.U"L.a2L".......|
-00010a20 b0 22 e0 ff 30 26 e0 18 c8 04 70 5d 00 5f 02 55 |."..0&....p]._.U|
+00010a20 b0 22 e0 ff c0 26 e0 18 c8 04 70 5d 00 5f 02 55 |."...&....p]._.U|
00010a30 22 4c 02 61 32 4c 22 00 01 00 82 00 b0 58 20 00 |"L.a2L"......X .|
00010a40 02 f3 14 01 72 59 ff c0 b9 fd 0f f0 72 5d 22 5f |....rY......r]"_|
00010a50 20 55 20 4c 20 61 30 4c 20 00 01 00 86 00 10 01 | U L a0L .......|
@@ -4228,8 +4228,8 @@
00010b70 cf 60 00 50 00 18 7c 03 70 5d 00 5f 02 55 22 4c |.`.P..|.p]._.U"L|
00010b80 02 61 32 4c 22 00 01 00 82 00 02 90 b0 22 e0 ff |.a2L"........"..|
00010b90 b0 26 09 00 e0 18 5a 03 72 5d 22 5f 20 55 20 4c |.&....Z.r]"_ U L|
-00010ba0 20 61 30 4c 20 00 01 00 82 00 30 7b 02 00 80 18 | a0L .....0{....|
-00010bb0 42 03 72 5d 22 5f 20 55 20 4c 20 61 30 4c 20 00 |B.r]"_ U L a0L .|
+00010ba0 20 61 30 4c 20 00 01 00 82 00 30 7b 02 00 e0 18 | a0L .....0{....|
+00010bb0 7e 00 72 5d 22 5f 20 55 20 4c 20 61 30 4c 20 00 |~.r]"_ U L a0L .|
00010bc0 01 00 82 00 60 7b 01 00 82 13 20 55 22 4c 02 61 |....`{.... U"L.a|
00010bd0 32 4c 22 00 01 00 a6 00 02 b1 20 50 a8 12 72 5d |2L"....... P..r]|
00010be0 22 5f 20 55 20 4c 20 61 30 4c 20 00 01 00 82 00 |"_ U L a0L .....|
@@ -4238,7 +4238,7 @@
00010c10 00 5f 02 55 22 4c 02 61 32 4c 22 00 01 00 82 00 |._.U"L.a2L".....|
00010c20 02 90 b0 22 e0 ff 20 26 e0 18 c6 02 70 5d 00 5f |...".. &....p]._|
00010c30 02 55 22 4c 02 61 32 4c 22 00 01 00 82 00 12 00 |.U"L.a2L".......|
-00010c40 00 71 96 04 62 7b 01 00 94 10 b0 20 fe ff e2 10 |.q..b{..... ....|
+00010c40 00 71 96 04 62 73 01 00 52 73 01 00 00 2c 00 2c |.q..bs..Rs...,.,|
00010c50 10 24 13 00 00 71 96 04 72 5d 22 5f 20 55 20 4c |.$...q..r]"_ U L|
00010c60 20 61 30 4c 20 00 01 00 82 00 00 71 02 00 20 55 | a0L ......q.. U|
00010c70 24 55 44 61 24 61 64 4c 24 00 01 00 76 05 20 4c |$UDa$adL$...v. L|
Loading…
Cancel
Save