From 7c30df40b316ad24f3d0470979a264d19fe27cce Mon Sep 17 00:00:00 2001 From: leecher1337 Date: Wed, 9 Feb 2022 21:50:42 +0000 Subject: [PATCH 01/16] Added support for Thinkpad L430/L530. Satisfies request in #203 Fixes documentation error. --- Descriptions.txt | 24 ++++++++- Makefile | 33 +++++++++++- README.md | 11 ++-- docs/chips.txt | 10 +++- l430.G3HT40WW.img.d/001_keysym.patch | 51 +++++++++++++++++++ l430.G3HT40WW.img.d/002_dead_keys.patch | 0 .../003_keysym_replacements.patch | 0 l430.G3HT40WW.img.d/004_fn_keys.patch | 0 l430.G3HT40WW.img.d/005_fn_key_swap.patch | 0 .../006_battery_validate.patch | 38 ++++++++++++++ 10 files changed, 158 insertions(+), 9 deletions(-) create mode 100644 l430.G3HT40WW.img.d/001_keysym.patch create mode 100644 l430.G3HT40WW.img.d/002_dead_keys.patch create mode 100644 l430.G3HT40WW.img.d/003_keysym_replacements.patch create mode 100644 l430.G3HT40WW.img.d/004_fn_keys.patch create mode 100644 l430.G3HT40WW.img.d/005_fn_key_swap.patch create mode 100644 l430.G3HT40WW.img.d/006_battery_validate.patch diff --git a/Descriptions.txt b/Descriptions.txt index cccf58a..16a9a95 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -106,8 +106,27 @@ g2uj30us.iso sha1:b2ce7c604850d263ead783550ab15c517e18bc58 x230 BIOS 2.74 (G2ET g2uj31us.iso sha1:971a9d57a179f4c368c827fd23c6fd5c86a52df7 x230 BIOS 2.75 (G2ETB5WW) EC 1.14 (G2HT35WW) g2uj32us.iso sha1:ee434746cabdb7d8bb8077f79be1429d6dec5696 x230 BIOS 2.76 (G2ETB6WW) EC 1.14 (G2HT35WW) g2uj33us.iso sha1:2a5ba87f9a0128ae4ae1a7f006b5a4ec515d870f x230 BIOS 2.77 (G2ETB7WW) EC 1.15 (G2HT36WW) +g3uj13us.iso sha1:433c7e88a6fd690b4aac57b473bb7baf51475d34 l430,l530 BIOS 2.54 (G3ET94WW) EC 1.14 (G3HT40WW) +g3uj14us.iso sha1:72d5b5a63354124c02f2c0a22ce35aac0dfc0012 l430,l530 BIOS 2.56 (G3ET96WW) EC 1.14 (G3HT40WW) +g3uj15us.iso sha1:c1a7f055fd2765af82b4698b388e56c2f77699b1 l430,l530 BIOS 2.57 (G3ET97WW) EC 1.14 (G3HT40WW) +g3uj16us.iso sha1:bf94a1e8e0caa99983c801d747bd4517f905b889 l430,l530 BIOS 2.58 (G3ET98WW) EC 1.14 (G3HT40WW) +g3uj17us.iso sha1:68a11ff3f3a2c04fded329312087104eda4af101 l430,l530 BIOS 2.60 (G3ETA0WW) EC 1.14 (G3HT40WW) +g3uj18us.iso sha1:8c420932ea9b4c3ced6a3b11e8022e3e165b0e9a l430,l530 BIOS 2.61 (G3ETA1WW) EC 1.14 (G3HT40WW) +g3uj19us.iso sha1:d1c39a51253a025383173669dc898ed9b3f4f389 l430,l530 BIOS 2.62 (G3ETA2WW) EC 1.14 (G3HT40WW) +g3uj20us.iso sha1:dd01d80656826779c5aba8af8c7ab07cf36753b0 l430,l530 BIOS 2.63 (G3ETA3WW) EC 1.14 (G3HT40WW) +g3uj21us.iso sha1:20a619b6aa0d22e9d7883c805e9423712ba2ed12 l430,l530 BIOS 2.64 (G3ETA4WW) EC 1.14 (G3HT40WW) +g3uj22us.iso sha1:883ef99c1c934a563a3e119449b108cd0ad35180 l430,l530 BIOS 2.65 (G3ETA5WW) EC 1.14 (G3HT40WW) +g3uj23us.iso sha1:656c8bdfb8a185b5757c15ab3a1179d323cf366f l430,l530 BIOS 2.66 (G3ETA6WW) EC 1.14 (G3HT40WW) g3uj24us.iso sha1:f88f7b6b530ad6747405ab8a998055ff978ac9ed l430,l530 BIOS 2.67 (G3ETA7WW) EC 1.14 (G3HT40WW) g3uj25us.iso sha256:caa5494ea71206f253027bea3ae9336c942c4d6f7f041c58f6972a54227cea6d l430,l530 BIOS 2.68 (G3ETA8WW) EC 1.14 (G3HT40WW) +g3uj26us.iso sha1:96e14347b7587f42951e49eb2f5fea3123ab56d3 l430,l530 BIOS 2.69 (G3ETA9WW) EC 1.14 (G3HT40WW) +g3uj27us.iso sha1:150d158dc6f34dc9b0a7d43faf2ee0d0fab8342e l430,l530 BIOS 2.70 (G3ETB0WW) EC 1.14 (G3HT40WW) +g3uj28us.iso sha1:529ba7a4b3d9aa1b0507c6d5dcc5a047ed82c4aa l430,l530 BIOS 2.71 (G3ETB1WW) EC 1.14 (G3HT40WW) +g3uj29us.iso sha1:34c6d9ad0f6eb394d3351495398363b907320444 l430,l530 BIOS 2.72 (G3ETB2WW) EC 1.14 (G3HT40WW) +g3uj30us.iso sha1:c51b1966ecc302b1a20a08f7f6b98064659abb2f l430,l530 BIOS 2.73 (G3ETB3WW) EC 1.14 (G3HT40WW) +g3uj31us.iso sha1:76ff99d2a5bbffa228bba98b2fc13acd4d183e48 l430,l530 BIOS 2.74 (G3ETB4WW) EC 1.14 (G3HT40WW) +g3uj32us.iso sha1:ae4bf2fc7441bfaa041ae3f1dff01a7d0d5142e6 l430,l530 BIOS 2.75 (G3ETB5WW) EC 1.14 (G3HT40WW) +g3uj33us.iso sha1:cd712f3ff97169f904ed298c1cc770f5064005a1 l430,l530 BIOS 2.76 (G3ETB6WW) EC 1.14 (G3HT40WW) g4uj30us.iso sha1:8673a448abd5cba1a8d7d1cb2eeb7935c7a252cd t530 and t530i BIOS 2.66 (G4ETA6WW) EC 1.13 (G4HT39WW) g4uj32us.iso sha1:f86c7402fb57038143c81aa90ced615e95369844 t530 and t530i BIOS 2.68 (G4ETA8WW) EC 1.13 (G4HT39WW) g4uj34us.iso sha1:TODO @@ -204,7 +223,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 -l430.G3HT40WW.s01D4000.FL1 rule:FL2,dep:g3uj25us.iso,param:01D4000.FL1 l430 BIOS 2.68 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 l440.J4HT28WW.s0AJ4000.FL1 rule:FL2,dep:j4uj64wd.iso,param:0AJ4000.FL1 l440 BIOS 1.78 Flash File l440.J4HT29WW.s0AJ4000.FL1 rule:FL2,dep:j4uj65wd.iso,param:0AJ4000.FL1 l440 BIOS 1.81 Flash File @@ -259,7 +278,7 @@ x61.7MHT25WW.s01B2000.FL2 rule:oldISO,dep:7nuj22uc.iso,param:01B2000.FL2 # The actual EC firmware extracted from the BIOS firmware file -l430.G3HT40WW.img rule:IMGnoenc,dep:l430.G3HT40WW.s01D4000.FL1 l430 EC 1.14 (may be wrong) +l430.G3HT40WW.img rule:IMGnuvoton,dep:l430.G3HT40WW.s01D4000.FL1 l430 EC 1.14 (may be wrong) l440.J4HT29WW.img rule:IMGnoenc,dep:l440.J4HT29WW.s0AJ4000.FL1 l440 EC 1.10 l440.J4HT30WW.img rule:IMGnoenc,dep:l440.J4HT30WW.s0AJ4000.FL1 l440 EC 1.11 p51.N1UHT24W.img rule:IMGnoenc,dep:p51.N1UHT24W.s0AN1U00.FL2 p51 EC 1.07 @@ -310,3 +329,4 @@ patched.t530i.iso rule:niceISO,dep:g4uj38us.iso,suffix:0,insert:0 for patching patched.w530.iso rule:niceISO,dep:g5uj37us.iso,suffix:0,insert:0 for patching Thinkpad W530 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 diff --git a/Makefile b/Makefile index 9529727..a2a8df5 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ test.report: # images) and any small downloads clean: rm -f $(CLEAN_FILES) \ - patched.*.iso patched.*.img *.FL2 *.FL2.orig *.img.enc \ + patched.*.iso patched.*.img *.FL? *.FL?.orig *.img.enc \ *.img.enc.orig *.img.orig *.bat *.report \ *.img \ *.txt.orig @@ -213,6 +213,10 @@ patch_disable_keyboard: @sed -e "s%__DIR%`mdir -/ -b -i $<@@$(FAT_OFFSET) |grep FL2 |head -1|cut -d/ -f3`%; s%__FL2%`mdir -/ -b -i $<@@$(FAT_OFFSET) |grep FL2 |head -1|cut -d/ -f4`%" autoexec.bat.template >$@.tmp @mv $@.tmp $@ +%.iso.bat1: %.iso.orig autoexec.bat.template + @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,$@) + # helper to write the ISO onto a cdrw %.iso.blank_burn: %.iso wodim -eject -v speed=40 -tao gracetime=0 blank=fast $< @@ -299,6 +303,10 @@ mec-tools/mec_encrypt: mec-tools/Makefile git submodule update make -C mec-tools +nuvoton-tools/npce885crc: + 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 + # Simple Visualisation %.pgm: % (echo "P5 256 $$(($(shell stat -c %s $<)/265)) 255" ; cat $< ) > $@ @@ -418,6 +426,29 @@ define rule_IMGnoenc_insert endef rule_IMGnoenc_insert_DEPS = scripts/FL2_copyIMG +# Extract the IMG file from an FL1 file - special case, for NUVOTON controllers +# +# $@ is the IMG to create +# $< is the FL2 +define rule_IMGnuvoton_extract + ./scripts/FL2_copyIMG from_fl2 $< $@ +endef +rule_IMGnuvoton_extract_DEPS = scripts/FL2_copyIMG + +# Insert the new firmware into the FL2 file - special case, for NUVOTON controllers +# +# $@ is the FL1 to create +# $< is the IMG +define rule_IMGnuvoton_insert + + ./nuvoton-tools/npce885crc -o 0x8000 -u $< + cp --reflink=auto $@.orig $@.tmp + ./scripts/FL2_copyIMG to_fl2 $@.tmp $< + mv $@.tmp $@ + $(call buildinfo_FL2) +endef +rule_IMGnuvoton_insert_DEPS = scripts/FL2_copyIMG nuvoton-tools/npce885crc + # Extract the FL2 file from an ISO image with two FL2 files # diff --git a/README.md b/README.md index 4d66a2e..0b2808b 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,14 @@ With the patches included here, you can install the classic keyboard hardware on many xx30 series laptops and make almost every key work properly. The only keys that are not working are Fn+F3 (Battery) and Fn+F12 (Hibernate) -Unfortunately, there are a small number of thinkpads with a model number +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. Thus they are not currently able to -be patched. This is known to be the case for at least the L430, L530 -and E330. +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. +Patches are included now, for documentation, please check the mentioned +repository. + * A full writeup of the hardware modifications needed can be found at: http://www.thinkwiki.org/wiki/Install_Classic_Keyboard_on_xx30_Series_ThinkPads diff --git a/docs/chips.txt b/docs/chips.txt index 6f9264b..474c5c2 100644 --- a/docs/chips.txt +++ b/docs/chips.txt @@ -42,7 +42,7 @@ ThinkPad xx30 series: (see discussion: http://notebook1.ru/forma1/viewtopic.php?f=70&t=109179) The procedure for doing this is documented here: https://github.com/taglour/x230-ec-jtag -ThinkPad l430: +ThinkPad l420: -------------- IT8511TE @@ -50,9 +50,15 @@ ThinkPad l430: (source: schematics - http://www.informaticanapoli.it/download/SCHEMIELETTRICI/IBM-LENOVO/Lenovo%20laptop%20motherboard%20schematic%20diagram.pdf) +Thinkpad l430/l530: +------------------- + Nuvoton NPCE885G + + This is a CR16C core CPU. + ThinkPad e330: -------------- - This is a 8051 core CPU, so probably a IT8511TE or similar + Nuvoton NPCE885G (source: EC firmware similarity to the l430) diff --git a/l430.G3HT40WW.img.d/001_keysym.patch b/l430.G3HT40WW.img.d/001_keysym.patch new file mode 100644 index 0000000..e17f43e --- /dev/null +++ b/l430.G3HT40WW.img.d/001_keysym.patch @@ -0,0 +1,51 @@ +--- /tmp/$01D4000.FL1.hex 2021-12-23 23:34:53.026586003 +0000 ++++ /tmp/$01D4000.FL1.kb.hex 2021-12-23 23:34:53.114588324 +0000 +@@ -7541,8 +7541,8 @@ + 0001de60 4a 9f 4c 79 45 7c 4d 7b 5a 81 4e 7b 54 81 4a 79 |J.LyE|M{Z.N{T.Jy| + 0001de70 4c 7b 45 9f 4d 7c 00 00 00 00 00 00 83 00 5a 01 |L{E.M|........Z.| + 0001de80 1f 01 27 01 2f 01 37 01 3f 01 5e 01 02 05 04 05 |..'./.7.?.^.....| +-0001de90 08 05 08 06 10 05 10 06 40 05 20 05 00 00 00 04 |........@. .....| +-0001dea0 01 04 84 00 7c 01 7c 03 4a 01 4a 02 70 01 70 02 |....|.|.J.J.p.p.| ++0001de90 08 05 08 06 10 05 10 06 40 05 20 05 00 00 38 01 |........@. ...8.| ++0001dea0 30 01 84 00 7c 01 7c 03 4a 01 4a 02 70 01 70 02 |0...|.|.J.J.p.p.| + 0001deb0 70 03 71 01 71 02 71 03 6c 01 6c 02 6c 03 69 01 |p.q.q.q.l.l.l.i.| + 0001dec0 69 02 69 03 7d 01 7d 02 7d 03 7a 01 7a 02 7a 03 |i.i.}.}.}.z.z.z.| + 0001ded0 6b 01 6b 02 6b 03 75 01 75 02 75 03 72 01 72 02 |k.k.k.u.u.u.r.r.| +@@ -7651,22 +7651,22 @@ + 0001e590 2d 36 36 36 36 36 36 36 2a 36 36 36 36 36 36 36 |-6666666*6666666| + 0001e5a0 36 36 36 36 36 36 36 36 36 00 00 00 00 00 00 00 |666666666.......| + 0001e5b0 00 00 00 00 00 00 00 00 00 00 00 00 54 0e 05 0a |............T...| +-0001e5c0 2e 36 55 16 4e 18 00 a2 a1 00 00 00 8c 16 1e 26 |.6U.N..........&| +-0001e5d0 25 3d 3e 46 45 1a 1e 1c a0 a3 00 00 00 15 1d 24 |%=>FE..........$| +-0001e5e0 2d 3c 43 44 28 6a 00 04 00 00 00 00 00 0d 58 0c |- Date: Thu, 10 Feb 2022 19:19:47 +0000 Subject: [PATCH 02/16] Adding support for Thinkpad E330 --- Descriptions.txt | 12 ++++++- Makefile | 15 ++++----- e330.H3EC35WW.img.d/001_keysym.patch | 0 e330.H3EC35WW.img.d/002_dead_keys.patch | 0 .../003_keysym_replacements.patch | 0 e330.H3EC35WW.img.d/004_fn_keys.patch | 0 e330.H3EC35WW.img.d/005_fn_key_swap.patch | 0 .../006_battery_validate.patch | 32 +++++++++++++++++++ scripts/FL2_copyIMG | 7 ++-- scripts/ISO_copyFL2 | 16 +++++----- scripts/geteltorito | 8 ++++- 11 files changed, 68 insertions(+), 22 deletions(-) create mode 100644 e330.H3EC35WW.img.d/001_keysym.patch create mode 100644 e330.H3EC35WW.img.d/002_dead_keys.patch create mode 100644 e330.H3EC35WW.img.d/003_keysym_replacements.patch create mode 100644 e330.H3EC35WW.img.d/004_fn_keys.patch create mode 100644 e330.H3EC35WW.img.d/005_fn_key_swap.patch create mode 100644 e330.H3EC35WW.img.d/006_battery_validate.patch diff --git a/Descriptions.txt b/Descriptions.txt index 16a9a95..e64773e 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -127,6 +127,13 @@ g3uj30us.iso sha1:c51b1966ecc302b1a20a08f7f6b98064659abb2f l430,l530 BIOS 2.73 g3uj31us.iso sha1:76ff99d2a5bbffa228bba98b2fc13acd4d183e48 l430,l530 BIOS 2.74 (G3ETB4WW) EC 1.14 (G3HT40WW) g3uj32us.iso sha1:ae4bf2fc7441bfaa041ae3f1dff01a7d0d5142e6 l430,l530 BIOS 2.75 (G3ETB5WW) EC 1.14 (G3HT40WW) g3uj33us.iso sha1:cd712f3ff97169f904ed298c1cc770f5064005a1 l430,l530 BIOS 2.76 (G3ETB6WW) EC 1.14 (G3HT40WW) +h3uj52wd.iso sha1:d5812f96df663ae2d5e86df50fdfe8b02145970a e330 BIOS 1.06 (H3ET69WW) EC 1.17 (H3EC34WW) +h3uj54wd.iso sha1:854e4bcd7d51036296b0182be39265269ff24816 e330 BIOS 1.09 (H3ET72WW) EC 1.17 (H3EC34WW) +h3uj75wd.iso sha1:7073a59aa52d8d2adc8da1f7097bdfc5c6b6a676 e330 BIOS 1.12 (H3ET75WW) EC 1.18 (H3EC34WW) +h3uj76wd.iso sha1:8c8f46e117ee5423b62e421423531e3c11d9a40c e330 BIOS 1.14 (H3ET76WW) EC 1.18 (H3EC34WW) +h3uj77wd.iso sha1:079a1a3c77fd5ac6a59e68235d5e5e9b326deae2 e330 BIOS 1.14 (H3ET77WW) EC 1.18 (H3EC35WW) +h3uj78wd.iso sha1:d96a7c3c740eab23f7f1287b28c95df1d60467f2 e330 BIOS 1.15 (H3ET78WW) EC 1.18 (H3EC35WW) +h3uj79wd.iso sha1:f1404fd6724c0faa5b57aee0d81c60908b9917c6 e330 BIOS 1.16 (H3ET79WW) EC 1.18 (H3EC35WW) g4uj30us.iso sha1:8673a448abd5cba1a8d7d1cb2eeb7935c7a252cd t530 and t530i BIOS 2.66 (G4ETA6WW) EC 1.13 (G4HT39WW) g4uj32us.iso sha1:f86c7402fb57038143c81aa90ced615e95369844 t530 and t530i BIOS 2.68 (G4ETA8WW) EC 1.13 (G4HT39WW) g4uj34us.iso sha1:TODO @@ -223,6 +230,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 +e330.H3EC35WW.s01H3000.FL1 rule:FL2,dep:h3uj79wd.iso,depi:h3uj79wd.iso.bat1,param:01H3000.FL1 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 l440.J4HT28WW.s0AJ4000.FL1 rule:FL2,dep:j4uj64wd.iso,param:0AJ4000.FL1 l440 BIOS 1.78 Flash File @@ -278,7 +286,8 @@ x61.7MHT25WW.s01B2000.FL2 rule:oldISO,dep:7nuj22uc.iso,param:01B2000.FL2 # The actual EC firmware extracted from the BIOS firmware file -l430.G3HT40WW.img rule:IMGnuvoton,dep:l430.G3HT40WW.s01D4000.FL1 l430 EC 1.14 (may be wrong) +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 l440.J4HT30WW.img rule:IMGnoenc,dep:l440.J4HT30WW.s0AJ4000.FL1 l440 EC 1.11 p51.N1UHT24W.img rule:IMGnoenc,dep:p51.N1UHT24W.s0AN1U00.FL2 p51 EC 1.07 @@ -330,3 +339,4 @@ 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:h3uj79wd.iso,suffix:0,insert:0 for patching Thinkpad E330 diff --git a/Makefile b/Makefile index a2a8df5..1ae57a8 100644 --- a/Makefile +++ b/Makefile @@ -100,15 +100,6 @@ list_images: .PHONY: list_images -# All the bios update iso images I have checked have had a fat16 filesystem -# embedded in a dos mbr image as the el-torito ISO payload. Most of them -# had the same offset to this fat filesystem, so hardcode that offset here. -# FIXME: -# - checking the E330 image showed a different FAT_OFFSET, need to handle that - -# The offset value is bytes in decimal. -FAT_OFFSET := 71680 - # Some versions of mtools need this flag set to allow them to work with the # dosfs images used by Lenovo - from my tests, it may be that Debian has # applied some patch @@ -210,10 +201,12 @@ patch_disable_keyboard: # my mind to it.. # %.iso.bat: %.iso.orig autoexec.bat.template + $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $< 2>/dev/null)) @sed -e "s%__DIR%`mdir -/ -b -i $<@@$(FAT_OFFSET) |grep FL2 |head -1|cut -d/ -f3`%; s%__FL2%`mdir -/ -b -i $<@@$(FAT_OFFSET) |grep FL2 |head -1|cut -d/ -f4`%" autoexec.bat.template >$@.tmp @mv $@.tmp $@ %.iso.bat1: %.iso.orig autoexec.bat.template + $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $< 2>/dev/null)) @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,$@) @@ -237,12 +230,15 @@ patch_disable_keyboard: # If we ever want a copy of the dosflash.exe, just get it from the iso image %.dosflash.exe.orig: %.iso.orig + $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $^ 2>/dev/null)) mcopy -m -i $^@@$(FAT_OFFSET) ::FLASH/DOSFLASH.EXE $@ # Extract the "embedded" fat file system from a given iso. %.iso.extract: %.iso + $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $^ 2>/dev/null)) mcopy -n -s -i $^@@$(FAT_OFFSET) :: $@ %.iso.orig.extract: %.iso.orig + $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $^ 2>/dev/null)) mcopy -n -s -i $^@@$(FAT_OFFSET) :: $@ ## Use the system provided geteltorito script, if there is one @@ -358,6 +354,7 @@ define rule_FL2_insert @# TODO - datestamp here could be the lastcommitdatestamp ./scripts/ISO_copyFL2 to_iso $@.tmp $<.tmp $(1) + $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $@.orig 2>/dev/null)) mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.report.tmp ::report.txt mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.bat.tmp ::AUTOEXEC.BAT -mdel -i $@.tmp@@$(FAT_OFFSET) ::EFI/Boot/BootX64.efi diff --git a/e330.H3EC35WW.img.d/001_keysym.patch b/e330.H3EC35WW.img.d/001_keysym.patch new file mode 100644 index 0000000..e69de29 diff --git a/e330.H3EC35WW.img.d/002_dead_keys.patch b/e330.H3EC35WW.img.d/002_dead_keys.patch new file mode 100644 index 0000000..e69de29 diff --git a/e330.H3EC35WW.img.d/003_keysym_replacements.patch b/e330.H3EC35WW.img.d/003_keysym_replacements.patch new file mode 100644 index 0000000..e69de29 diff --git a/e330.H3EC35WW.img.d/004_fn_keys.patch b/e330.H3EC35WW.img.d/004_fn_keys.patch new file mode 100644 index 0000000..e69de29 diff --git a/e330.H3EC35WW.img.d/005_fn_key_swap.patch b/e330.H3EC35WW.img.d/005_fn_key_swap.patch new file mode 100644 index 0000000..e69de29 diff --git a/e330.H3EC35WW.img.d/006_battery_validate.patch b/e330.H3EC35WW.img.d/006_battery_validate.patch new file mode 100644 index 0000000..c2b5654 --- /dev/null +++ b/e330.H3EC35WW.img.d/006_battery_validate.patch @@ -0,0 +1,32 @@ +--- /tmp/$01H3000.FL1.hex 2022-02-10 16:47:23.957715840 +0000 ++++ /tmp/$01H3000.FL1.bat.hex 2022-02-10 16:47:24.053718365 +0000 +@@ -4150,14 +4150,14 @@ + 00010730 20 f1 3a 02 ff c0 63 a1 00 50 00 18 ec 04 70 5d | .:...c..P....p]| + 00010740 00 5f 04 55 24 4c 04 61 34 4c 24 00 01 00 82 00 |._.U$L.a4L$.....| + 00010750 14 90 81 49 b1 22 1f 00 04 90 b0 22 e0 ff 10 27 |...I."....."...'| +-00010760 04 d0 e0 18 c4 04 00 c0 5a 97 00 50 00 18 ba 04 |........Z..P....| ++00010760 04 d0 e0 18 c4 04 00 c0 5a 97 00 50 e0 18 54 00 |........Z..P..T.| + 00010770 70 5d 00 5f 02 55 22 4c 02 61 32 4c 22 00 01 00 |p]._.U"L.a2L"...| + 00010780 86 00 00 c0 3c 9a 72 59 ff c0 2b fe 00 01 10 58 |....<.rY..+....X| + 00010790 00 01 72 5d 22 5f 20 55 20 4c 20 61 30 4c 20 00 |..r]"_ U L a0L .| + 000107a0 01 00 86 00 10 01 b5 58 11 00 b4 58 27 00 b3 58 |.......X...X'..X| + 000107b0 16 00 72 59 ff c0 15 99 8f 60 00 50 00 18 6a 04 |..rY.....`.P..j.| + 000107c0 70 5d 00 5f 02 55 22 4c 02 61 32 4c 22 00 01 00 |p]._.U"L.a2L"...| +-000107d0 82 00 02 90 b0 22 e0 ff 30 26 e0 18 4a 04 70 5d |....."..0&..J.p]| ++000107d0 82 00 02 90 b0 22 e0 ff c0 26 e0 18 4a 04 70 5d |....."...&..J.p]| + 000107e0 00 5f 02 55 22 4c 02 61 32 4c 22 00 01 00 82 00 |._.U"L.a2L".....| + 000107f0 b0 58 20 00 02 f3 14 01 72 59 ff c0 b9 fd 0f f0 |.X .....rY......| + 00010800 72 5d 22 5f 20 55 20 4c 20 61 30 4c 20 00 01 00 |r]"_ U L a0L ...| +@@ -4182,9 +4182,9 @@ + 00010930 02 55 22 4c 02 61 32 4c 22 00 01 00 82 00 02 90 |.U"L.a2L".......| + 00010940 b0 22 e0 ff b0 26 09 00 e0 18 dc 02 72 5d 22 5f |."...&......r]"_| + 00010950 20 55 20 4c 20 61 30 4c 20 00 01 00 82 00 30 7b | U L a0L .....0{| +-00010960 02 00 80 18 c4 02 20 55 22 4c 02 61 32 4c 22 00 |...... U"L.a2L".| +-00010970 01 00 82 00 12 00 00 71 a6 04 62 7b 01 00 94 10 |.......q..b{....| +-00010980 b0 20 fe ff e2 10 10 24 13 00 00 71 a6 04 72 5d |. .....$...q..r]| ++00010960 02 00 00 2c 00 2c 20 55 22 4c 02 61 32 4c 22 00 |...,., U"L.a2L".| ++00010970 01 00 82 00 12 00 00 71 a6 04 62 73 01 00 52 73 |.......q..bs..Rs| ++00010980 01 00 00 2c 00 2c 10 24 13 00 00 71 a6 04 72 5d |...,.,.$...q..r]| + 00010990 22 5f 20 55 20 4c 20 61 30 4c 20 00 01 00 82 00 |"_ U L a0L .....| + 000109a0 00 71 02 00 20 55 24 55 44 61 24 61 64 4c 24 00 |.q.. U$UDa$adL$.| + 000109b0 01 00 86 05 20 4c 20 61 30 4c 20 00 01 00 82 00 |.... L a0L .....| diff --git a/scripts/FL2_copyIMG b/scripts/FL2_copyIMG index 7025d2b..95804b7 100755 --- a/scripts/FL2_copyIMG +++ b/scripts/FL2_copyIMG @@ -587,9 +587,9 @@ use base qw(FL2::base); sub _find_pfh { my $self = shift; - my $offset = 0; + my $offset = $self->{filesize}-4; - while ($offset < $self->{filesize}) { + while ($offset > 0) { my $buf = $self->get_block($offset, 4); return undef if (!defined($buf)); $buf = $$buf; @@ -599,7 +599,7 @@ sub _find_pfh { return $offset; } - $offset+=0x08; + $offset-=0x04; } log::add("no PFH found"); @@ -613,6 +613,7 @@ sub _check { my $known = { 4681808 => 1, # l440 9437264 => 1, # l430 + 13631568 => 1, # e330 12587008 => 1, }; diff --git a/scripts/ISO_copyFL2 b/scripts/ISO_copyFL2 index 231b4f2..bc14004 100755 --- a/scripts/ISO_copyFL2 +++ b/scripts/ISO_copyFL2 @@ -5,14 +5,6 @@ # Deal with copying the FL2 file from and to the ISO image # -# All the bios update iso images I have checked have had a fat16 filesystem -# embedded in a dos mbr image as the el-torito ISO payload. They also all -# had the same offset to this fat filesystem, so hardcode that offset here. -# The offset value is bytes in decimal. -# TODO - one day, this offset will be wrong. (geteltorito could be taught -# to output the starting sector it found as a starting point) -FAT_OFFSET=71680 - DIR="$1" case "$DIR" in from_iso) ;; @@ -37,6 +29,14 @@ if ! which mdir >/dev/null; then exit 1 fi +# All the bios update iso images I have checked have had a fat16 filesystem +# embedded in a dos mbr image as the el-torito ISO payload. +# The offset value is bytes in decimal. +FAT_OFFSET=$(scripts/geteltorito -c $ISO 2>/dev/null) +if [ -z $FAT_OFFSET ]; then + FAT_OFFSET=71680 +fi + # If we just want to look at the contents, do that if [ "$DIR" = "ls" ]; then mdir -i "$ISO"@@"$FAT_OFFSET" -/ -b diff --git a/scripts/geteltorito b/scripts/geteltorito index c64525f..6e59c77 100755 --- a/scripts/geteltorito +++ b/scripts/geteltorito @@ -94,6 +94,7 @@ sub usage{ "the data extracted to STDOUT or to a file.\n", " -h: This help. \n", " -v: Print version of script and exit.\n", + " -c: Calculate start of FAT in HDD image\n", " -o : Write extracted data to file instead of STDOUT.\n", "\n\n"; exit 0; @@ -101,7 +102,7 @@ sub usage{ # --------------------------------------------------------------------- -$ret=getopts('hvo:'); +$ret=getopts('hvco:'); if( defined($opt_v) ){ warn "Version: $utilVersion \n"; @@ -215,6 +216,11 @@ $cnt=$count==0?$sCount:$count; print STDERR "El Torito image starts at sector $imgStart and has $cnt sector(s) of $vSecSize Bytes\n"; +if( defined($opt_c) and $media == 4 ) { + print STDOUT ($imgStart * $secSize) + ($firstSector * $vSecSize); + exit +} + # We are there: # Now read the bootimage to stdout $image=getSector($imgStart, $cnt, $imageFile); From 7f9effa51959e9ccc954ba54e326d2604693f615 Mon Sep 17 00:00:00 2001 From: leecher1337 Date: Sat, 12 Feb 2022 18:59:59 +0000 Subject: [PATCH 03/16] The newer Thinkpad E330 BIOS Flash ISOs have a damaged bootsector (contains BOOTLDR instead of DOS Bootloader) and also have either no IBM DOS fiels at all or have them in the wrong place (need to be File 1 and 2 in the FAT so that the bootloader finds them). So as IBM messed up badly here, added a function that takes a sane older BIOS ISO and then incorporates the new patched BIOS into it in order to get a bootable ISO for E330 flashing. --- Descriptions.txt | 8 ++++---- Makefile | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Descriptions.txt b/Descriptions.txt index e64773e..3f4e772 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -129,8 +129,8 @@ g3uj32us.iso sha1:ae4bf2fc7441bfaa041ae3f1dff01a7d0d5142e6 l430,l530 BIOS 2.75 g3uj33us.iso sha1:cd712f3ff97169f904ed298c1cc770f5064005a1 l430,l530 BIOS 2.76 (G3ETB6WW) EC 1.14 (G3HT40WW) h3uj52wd.iso sha1:d5812f96df663ae2d5e86df50fdfe8b02145970a e330 BIOS 1.06 (H3ET69WW) EC 1.17 (H3EC34WW) h3uj54wd.iso sha1:854e4bcd7d51036296b0182be39265269ff24816 e330 BIOS 1.09 (H3ET72WW) EC 1.17 (H3EC34WW) -h3uj75wd.iso sha1:7073a59aa52d8d2adc8da1f7097bdfc5c6b6a676 e330 BIOS 1.12 (H3ET75WW) EC 1.18 (H3EC34WW) -h3uj76wd.iso sha1:8c8f46e117ee5423b62e421423531e3c11d9a40c e330 BIOS 1.14 (H3ET76WW) EC 1.18 (H3EC34WW) +h3uj75wd.iso sha1:7073a59aa52d8d2adc8da1f7097bdfc5c6b6a676 e330 BIOS 1.12 (H3ET75WW) EC 1.18 (H3EC35WW) +h3uj76wd.iso sha1:8c8f46e117ee5423b62e421423531e3c11d9a40c e330 BIOS 1.14 (H3ET76WW) EC 1.18 (H3EC35WW) h3uj77wd.iso sha1:079a1a3c77fd5ac6a59e68235d5e5e9b326deae2 e330 BIOS 1.14 (H3ET77WW) EC 1.18 (H3EC35WW) h3uj78wd.iso sha1:d96a7c3c740eab23f7f1287b28c95df1d60467f2 e330 BIOS 1.15 (H3ET78WW) EC 1.18 (H3EC35WW) h3uj79wd.iso sha1:f1404fd6724c0faa5b57aee0d81c60908b9917c6 e330 BIOS 1.16 (H3ET79WW) EC 1.18 (H3EC35WW) @@ -230,7 +230,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 -e330.H3EC35WW.s01H3000.FL1 rule:FL2,dep:h3uj79wd.iso,depi:h3uj79wd.iso.bat1,param:01H3000.FL1 e330 BIOS 1.16 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 l440.J4HT28WW.s0AJ4000.FL1 rule:FL2,dep:j4uj64wd.iso,param:0AJ4000.FL1 l440 BIOS 1.78 Flash File @@ -339,4 +339,4 @@ 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:h3uj79wd.iso,suffix:0,insert:0 for patching Thinkpad E330 +patched.e330.iso rule:niceISO,dep:h3uj76wd.iso,suffix:0,insert:0 for patching Thinkpad E330 diff --git a/Makefile b/Makefile index 1ae57a8..eb90303 100644 --- a/Makefile +++ b/Makefile @@ -337,15 +337,35 @@ 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 +define prepare_iso_from_tpl + $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $(SRC).orig 2>/dev/null)) + $(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))) + $(eval DOSFLASH := $(shell mdir -/ -b -i $@.orig@@$(FAT_OFFSET_FL1SRC) | grep DOSFLASH | head -1)) + $(eval FILE_DIR := $(shell basename $(dir $(FLASH_FILE:::%=%)))) + mdeltree -i $@.tmp@@$(2) FLASH/ + mmd -i $@.tmp@@$(2) FLASH FLASH/$(FILE_DIR) + -mkdir -p $@.orig.extract.tmp + mcopy -n -s -m -i $@.orig@@$(FAT_OFFSET_FL1SRC) $(FLASH_FILE) $(DOSFLASH) $@.orig.extract.tmp + mcopy -o -s -m -i $@.tmp@@$(2) $@.orig.extract.tmp/DOSFLASH.EXE ::/FLASH/ + mcopy -o -s -m -i $@.tmp@@$(2) $@.orig.extract.tmp/$(subst $$,\$$,$(shell basename $(FLASH_FILE:::%=%))) ::/FLASH/$(FILE_DIR)/ + rm -r $@.orig.extract.tmp +endef + # Create a new ISO image with patches applied # # $@ is the ISO to create # $< is the FL2 # $1 is the pattern to match FL2 file in ISO image +# $2 optional: Name of other ISO that should be taken as a template with a working DOS on it define rule_FL2_insert $(call buildinfo_ISO) - @cp --reflink=auto $@.orig $@.tmp + $(eval SRC := $(or $(2),$@)) + @cp --reflink=auto $(SRC).orig $@.tmp + $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $(SRC).orig 2>/dev/null)) + + $(if $(2),$(call prepare_iso_from_tpl,$(1),$(FAT_OFFSET))) @cp --reflink=auto $< $<.tmp @cp --reflink=auto $@.report $@.report.tmp @@ -354,7 +374,6 @@ define rule_FL2_insert @# TODO - datestamp here could be the lastcommitdatestamp ./scripts/ISO_copyFL2 to_iso $@.tmp $<.tmp $(1) - $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $@.orig 2>/dev/null)) mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.report.tmp ::report.txt mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.bat.tmp ::AUTOEXEC.BAT -mdel -i $@.tmp@@$(FAT_OFFSET) ::EFI/Boot/BootX64.efi From 0d7767854f3213ff02da43c9dbad9cbd3943f6c6 Mon Sep 17 00:00:00 2001 From: leecher1337 Date: Sat, 12 Feb 2022 19:40:06 +0000 Subject: [PATCH 04/16] Removed unnecessary line that slipped in while testing --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index eb90303..bc8f13a 100644 --- a/Makefile +++ b/Makefile @@ -338,7 +338,6 @@ endef rule_IMG_extract_DEPS = scripts/FL2_copyIMG mec-tools/mec_encrypt mec-tools/mec_csum_flasher mec-tools/mec_csum_boot define prepare_iso_from_tpl - $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $(SRC).orig 2>/dev/null)) $(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))) $(eval DOSFLASH := $(shell mdir -/ -b -i $@.orig@@$(FAT_OFFSET_FL1SRC) | grep DOSFLASH | head -1)) From 919a445a7be4faaa6b369e26858406525b5028cd Mon Sep 17 00:00:00 2001 From: leecher1337 Date: Sun, 13 Feb 2022 00:57:05 +0000 Subject: [PATCH 05/16] Added support for Thinkpad B590 --- Descriptions.txt | 5 ++ Makefile | 68 ++++++++++++++++++- b590.H9ET92WW.img.d/001_keysym.patch | 0 b590.H9ET92WW.img.d/002_dead_keys.patch | 0 .../003_keysym_replacements.patch | 0 b590.H9ET92WW.img.d/004_fn_keys.patch | 0 b590.H9ET92WW.img.d/005_fn_key_swap.patch | 0 .../006_battery_validate.patch | 37 ++++++++++ 8 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 b590.H9ET92WW.img.d/001_keysym.patch create mode 100644 b590.H9ET92WW.img.d/002_dead_keys.patch create mode 100644 b590.H9ET92WW.img.d/003_keysym_replacements.patch create mode 100644 b590.H9ET92WW.img.d/004_fn_keys.patch create mode 100644 b590.H9ET92WW.img.d/005_fn_key_swap.patch create mode 100644 b590.H9ET92WW.img.d/006_battery_validate.patch diff --git a/Descriptions.txt b/Descriptions.txt index 3f4e772..526da4b 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -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 diff --git a/Makefile b/Makefile index bc8f13a..f2e243b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/b590.H9ET92WW.img.d/001_keysym.patch b/b590.H9ET92WW.img.d/001_keysym.patch new file mode 100644 index 0000000..e69de29 diff --git a/b590.H9ET92WW.img.d/002_dead_keys.patch b/b590.H9ET92WW.img.d/002_dead_keys.patch new file mode 100644 index 0000000..e69de29 diff --git a/b590.H9ET92WW.img.d/003_keysym_replacements.patch b/b590.H9ET92WW.img.d/003_keysym_replacements.patch new file mode 100644 index 0000000..e69de29 diff --git a/b590.H9ET92WW.img.d/004_fn_keys.patch b/b590.H9ET92WW.img.d/004_fn_keys.patch new file mode 100644 index 0000000..e69de29 diff --git a/b590.H9ET92WW.img.d/005_fn_key_swap.patch b/b590.H9ET92WW.img.d/005_fn_key_swap.patch new file mode 100644 index 0000000..e69de29 diff --git a/b590.H9ET92WW.img.d/006_battery_validate.patch b/b590.H9ET92WW.img.d/006_battery_validate.patch new file mode 100644 index 0000000..743391e --- /dev/null +++ b/b590.H9ET92WW.img.d/006_battery_validate.patch @@ -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| From 830a1a20373694059b41fc172990db74b1d66b97 Mon Sep 17 00:00:00 2001 From: leecher1337 Date: Sun, 15 May 2022 22:18:53 +0200 Subject: [PATCH 06/16] Adding support for B580, V480, V480c, V580, V580c --- Descriptions.txt | 12 ++-- Makefile | 58 ++++++++++++++++++- README.md | 3 +- b580.H1ET73WW.img.d/001_keysym.patch | 0 b580.H1ET73WW.img.d/002_dead_keys.patch | 0 .../003_keysym_replacements.patch | 0 b580.H1ET73WW.img.d/004_fn_keys.patch | 0 b580.H1ET73WW.img.d/005_fn_key_swap.patch | 0 .../006_battery_validate.patch | 39 +++++++++++++ 9 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 b580.H1ET73WW.img.d/001_keysym.patch create mode 100644 b580.H1ET73WW.img.d/002_dead_keys.patch create mode 100644 b580.H1ET73WW.img.d/003_keysym_replacements.patch create mode 100644 b580.H1ET73WW.img.d/004_fn_keys.patch create mode 100644 b580.H1ET73WW.img.d/005_fn_key_swap.patch create mode 100644 b580.H1ET73WW.img.d/006_battery_validate.patch diff --git a/Descriptions.txt b/Descriptions.txt index 526da4b..1691d25 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -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 diff --git a/Makefile b/Makefile index f2e243b..43f246e 100644 --- a/Makefile +++ b/Makefile @@ -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 = diff --git a/README.md b/README.md index 0b2808b..07bdceb 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/b580.H1ET73WW.img.d/001_keysym.patch b/b580.H1ET73WW.img.d/001_keysym.patch new file mode 100644 index 0000000..e69de29 diff --git a/b580.H1ET73WW.img.d/002_dead_keys.patch b/b580.H1ET73WW.img.d/002_dead_keys.patch new file mode 100644 index 0000000..e69de29 diff --git a/b580.H1ET73WW.img.d/003_keysym_replacements.patch b/b580.H1ET73WW.img.d/003_keysym_replacements.patch new file mode 100644 index 0000000..e69de29 diff --git a/b580.H1ET73WW.img.d/004_fn_keys.patch b/b580.H1ET73WW.img.d/004_fn_keys.patch new file mode 100644 index 0000000..e69de29 diff --git a/b580.H1ET73WW.img.d/005_fn_key_swap.patch b/b580.H1ET73WW.img.d/005_fn_key_swap.patch new file mode 100644 index 0000000..e69de29 diff --git a/b580.H1ET73WW.img.d/006_battery_validate.patch b/b580.H1ET73WW.img.d/006_battery_validate.patch new file mode 100644 index 0000000..ad20af6 --- /dev/null +++ b/b580.H1ET73WW.img.d/006_battery_validate.patch @@ -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| From e49a12eafe23deaa015227359ed6f802b4279d2a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 15:54:14 +0200 Subject: [PATCH 07/16] Ensure that mcopy never prompts interactively --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 43f246e..fcbee99 100644 --- a/Makefile +++ b/Makefile @@ -398,6 +398,7 @@ define rule_FL2_insert ./scripts/ISO_copyFL2 to_iso $@.tmp $<.tmp $(1) mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.report.tmp ::report.txt + -mattrib -i $@.tmp@@$(FAT_OFFSET) -r -s -h ::AUTOEXEC.BAT mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.bat.tmp ::AUTOEXEC.BAT -mdel -i $@.tmp@@$(FAT_OFFSET) ::EFI/Boot/BootX64.efi -mattrib -i $@.tmp@@$(FAT_OFFSET) -r ::FLASH/README.TXT @@ -462,6 +463,7 @@ define rule_CAP_insert mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $<.tmp ::/FLASH/$< mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.report.tmp ::report.txt + -mattrib -i $@.tmp@@$(FAT_OFFSET) -r -s -h ::AUTOEXEC.BAT mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.bat.tmp ::AUTOEXEC.BAT @rm $<.tmp $@.report.tmp $@.bat.tmp @@ -504,6 +506,7 @@ define rule_EXE_insert ./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 + -mattrib -i $@.tmp@@$(FAT_OFFSET) -r -s -h ::AUTOEXEC.BAT mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.bat.tmp ::AUTOEXEC.BAT @rm $<.tmp $@.report.tmp $@.bat.tmp From 305e45f7c91c14c1d7389152b9d6834b07d555cd Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 16:15:49 +0200 Subject: [PATCH 08/16] Use same prefixing as other rules for the b590 intermediate image file --- Descriptions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Descriptions.txt b/Descriptions.txt index 1691d25..16a8de9 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -233,7 +233,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 +b590.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 @@ -291,7 +291,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) +b590.H9ET92WW.img rule:IMGnuvoton,dep:b590.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) From ea7298bcbc983ef1807b1c2ecd0de295c08669c6 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 16:24:58 +0200 Subject: [PATCH 09/16] Make the innoextract rule more obvious, robust and less repeated --- Descriptions.txt | 4 ++-- Makefile | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Descriptions.txt b/Descriptions.txt index 16a8de9..549d5ba 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -233,8 +233,8 @@ 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 -b590.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 +b590.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 diff --git a/Makefile b/Makefile index fcbee99..f80c765 100644 --- a/Makefile +++ b/Makefile @@ -423,14 +423,17 @@ rule_FL2_insert_DEPS = scripts/ISO_copyFL2 # TODO - bat file # $< 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` $@ + innoextract $< -I $(1) -d tmp.inno + mv `find tmp.inno -type f` $@ + touch $@ + rm -rf tmp.inno endef -rule_CAP_extract_DEPS = # add innoextract as dependency here? +rule_CAP_extract_DEPS = # no extra local dependancies define rule_EXE_extract - mv `innoextract $< -I $(1) | grep -i $(1) | cut -d'"' -f2` $@ + $(call rule_CAP_extract,$1) endef -rule_EXE_extract_DEPS = # add innoextract as dependency here? +rule_EXE_extract_DEPS = # no extra local dependancies # Create a new ISO image with patches applied # This is specifically for B590 firmware where we have to combine a bootable DOS From 58bd2bb0db0716977e2352a638fa845c28c9b56f Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 16:37:45 +0200 Subject: [PATCH 10/16] Ensure the sections of the Descriptions.txt are sorted --- Descriptions.txt | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/Descriptions.txt b/Descriptions.txt index 549d5ba..4dcaffe 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -127,13 +127,6 @@ g3uj30us.iso sha1:c51b1966ecc302b1a20a08f7f6b98064659abb2f l430,l530 BIOS 2.73 g3uj31us.iso sha1:76ff99d2a5bbffa228bba98b2fc13acd4d183e48 l430,l530 BIOS 2.74 (G3ETB4WW) EC 1.14 (G3HT40WW) g3uj32us.iso sha1:ae4bf2fc7441bfaa041ae3f1dff01a7d0d5142e6 l430,l530 BIOS 2.75 (G3ETB5WW) EC 1.14 (G3HT40WW) g3uj33us.iso sha1:cd712f3ff97169f904ed298c1cc770f5064005a1 l430,l530 BIOS 2.76 (G3ETB6WW) EC 1.14 (G3HT40WW) -h3uj52wd.iso sha1:d5812f96df663ae2d5e86df50fdfe8b02145970a e330 BIOS 1.06 (H3ET69WW) EC 1.17 (H3EC34WW) -h3uj54wd.iso sha1:854e4bcd7d51036296b0182be39265269ff24816 e330 BIOS 1.09 (H3ET72WW) EC 1.17 (H3EC34WW) -h3uj75wd.iso sha1:7073a59aa52d8d2adc8da1f7097bdfc5c6b6a676 e330 BIOS 1.12 (H3ET75WW) EC 1.18 (H3EC35WW) -h3uj76wd.iso sha1:8c8f46e117ee5423b62e421423531e3c11d9a40c e330 BIOS 1.14 (H3ET76WW) EC 1.18 (H3EC35WW) -h3uj77wd.iso sha1:079a1a3c77fd5ac6a59e68235d5e5e9b326deae2 e330 BIOS 1.14 (H3ET77WW) EC 1.18 (H3EC35WW) -h3uj78wd.iso sha1:d96a7c3c740eab23f7f1287b28c95df1d60467f2 e330 BIOS 1.15 (H3ET78WW) EC 1.18 (H3EC35WW) -h3uj79wd.iso sha1:f1404fd6724c0faa5b57aee0d81c60908b9917c6 e330 BIOS 1.16 (H3ET79WW) EC 1.18 (H3EC35WW) g4uj30us.iso sha1:8673a448abd5cba1a8d7d1cb2eeb7935c7a252cd t530 and t530i BIOS 2.66 (G4ETA6WW) EC 1.13 (G4HT39WW) g4uj32us.iso sha1:f86c7402fb57038143c81aa90ced615e95369844 t530 and t530i BIOS 2.68 (G4ETA8WW) EC 1.13 (G4HT39WW) g4uj34us.iso sha1:TODO @@ -182,7 +175,17 @@ giuj29us.iso sha1:6a87e3377140620130e154f488d9116e18f55ec4 x240 BIOS 2.42 (GIET gluj42us.iso sha1:5d56eddac59df8b0fe2dda5f8f8d8ea540b85075 t440p BIOS 2.54 (GLETA0WW) EC 1.13 (GLHT30WW) gluj43us.iso sha1:353f1f993743a1c4a1da96a098b61a77873aa024 t440p BIOS 2.55 (GLETA1WW) EC 1.13 (GLHT30WW) gruj26us.iso sha1:89a3b3e364f37694bf514e01f9c3e2eda33a59e8 x1 Carbon (Type 20A7, 20A8) BIOS 1.29 (GRET52WW) EC 1.19 (GRHT38WW) +h1uj53us.exe sha1:8056b5c5867a16797ae9e62e7cd968d09284ff42 b480,b580 BIOS 1.16 (H1ET73WW,H5ET73WW) EC 1.13 (H1EC33WW,H5EC33WW) +h3uj52wd.iso sha1:d5812f96df663ae2d5e86df50fdfe8b02145970a e330 BIOS 1.06 (H3ET69WW) EC 1.17 (H3EC34WW) +h3uj54wd.iso sha1:854e4bcd7d51036296b0182be39265269ff24816 e330 BIOS 1.09 (H3ET72WW) EC 1.17 (H3EC34WW) +h3uj75wd.iso sha1:7073a59aa52d8d2adc8da1f7097bdfc5c6b6a676 e330 BIOS 1.12 (H3ET75WW) EC 1.18 (H3EC35WW) +h3uj76wd.iso sha1:8c8f46e117ee5423b62e421423531e3c11d9a40c e330 BIOS 1.14 (H3ET76WW) EC 1.18 (H3EC35WW) +h3uj77wd.iso sha1:079a1a3c77fd5ac6a59e68235d5e5e9b326deae2 e330 BIOS 1.14 (H3ET77WW) EC 1.18 (H3EC35WW) +h3uj78wd.iso sha1:d96a7c3c740eab23f7f1287b28c95df1d60467f2 e330 BIOS 1.15 (H3ET78WW) EC 1.18 (H3EC35WW) +h3uj79wd.iso sha1:f1404fd6724c0faa5b57aee0d81c60908b9917c6 e330 BIOS 1.16 (H3ET79WW) EC 1.18 (H3EC35WW) h6uja0wd.iso sha1:19a05355c793b3f776c3130caa5f10e371f530c0 T430u BIOS 2.18 (H6ETA0WW) EC 2.01 (H6HT54WW) +h9et75ww.zip sha1:d81c145b371cf77abe6ae00d35d37491715feecd b590,b490 BIOS ?.? (H9ET75WW) EC 1.01 (H9EC08WW) +h9et92ww.exe sha1:c1a3ba9282fe48a9e6f69e4dd32537c10a710e78 b590,b490 BIOS ?.? (H9ET92WW) EC 1.02 (H9EC09WW) n10ur10w.iso sha1:0e4c4ffb99146e50867dc1345ee2ef88c60ea192 x250 BIOS 1.21 (N10ET42W) EC 1.16 (N10HT17W) n14ur15w.iso sha1:e106b024b1d448234e5ea958b0e8e93bbda1a543 x1 Carbon (Type 20BS, 20BT) BIOS 1.16 (N14ET38W) EC 1.09 (N14HT36W) n1mur06w.iso sha1:e2bed755c065daf83cabc130b8d65c08e6a6a391 x1 Carbon (Type 20HQ, 20HR, 20K3, 20K4) BIOS 1.20 (N1MET35W) EC 1.14 (N1MHT25W) @@ -193,8 +196,6 @@ n1qur12w.iso sha1:FIXME T470, 25 BIOS 1.43 ( n1qur13w.iso sha1:FIXME T470, 25 BIOS 1.44 (N1QET69W) EC 1.30 (N1QHT48W) n1qur14w.iso sha1:fea0d271a23548adb5d11f3c16b4e016be3869a5 T470, 25 BIOS 1.46 (N1QET71W) EC 1.30 (N1QHT48W) n1uur12w.iso sha1:82628c7b7ed2064f4c272440b72cbb38a88b18d8 P51 BIOS 1.20 (N1UET46W) EC 1.07 (N1UHT24W) -n2jur16w.iso sha1:FIXME T490s, X390 BIOS 1.51 (N2JET73W) EC 1.12 (N2JHT28W) -n2jur17w.iso sha1:be7598ac64e9c3f2aab60ca890175d0adac010b9 T490s, X390 BIOS 1.55 (N2JET77W) EC 1.13 (N2JHT29W) n20ur02w.iso sha1:FIXME x280 BIOS 1.08 (N20ET23W) EC 1.03 (N20HT16W) n20ur03w.iso sha1:FIXME x280 BIOS 1.12 (N20ET27W) EC 1.04 (N20HT17W) n20ur04w.iso sha1:8ca1d873aeca5ce87d67f795739f8cc95f0c519f x280 BIOS 1.14 (N20ET29W) EC 1.04 (N20HT17W) @@ -202,6 +203,8 @@ n22ur04w.iso sha1:b557d7bbe881cc682b7504364097b64c0dec1c01 t480s BIOS 1.11 (N22 n24ur01w.iso sha1:FIXME t480 BIOS 1.07 (N24ET32W) EC 1.06 (N24HT21W) n24ur03w.iso sha1:FIXME t480 BIOS 1.11 (N24ET36W) EC 1.08 (N24HT23W) n24ur04w.iso sha1:134b239e4ce4c9c2d1f5f8f645f279c162fc5f3e t480 BIOS 1.12 (N24ET37W) EC 1.08 (N24HT23W) +n2jur16w.iso sha1:FIXME T490s, X390 BIOS 1.51 (N2JET73W) EC 1.12 (N2JHT28W) +n2jur17w.iso sha1:be7598ac64e9c3f2aab60ca890175d0adac010b9 T490s, X390 BIOS 1.55 (N2JET77W) EC 1.13 (N2JHT29W) r02uj46d.iso sha1:876a68add32d9c961cbdf80c74b88f92a66443cf x260 BIOS 1.19 (R02ET46W) EC 1.11 (R02HT29W) r0fuj15wd.iso sha1:bab0722d72375d1c9190b2c47ab7b4eb4c0dfde0 t470p BIOS 1.22 (R0FET42W) EC 1.04 (R0FHT16W) r0iuj09wd.iso sha1:21b3abf69b9ee7ecf12fe0880564312122b1ff75 x270 BIOS 1.16 (R0IET38W) EC 1.12 (R0IHT30W) @@ -215,9 +218,6 @@ 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,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) @@ -229,12 +229,9 @@ j4uj64wd.iso sha1:4b2682bf11d31e0ff9e4cf4ec5e3372b715c7841 L440, L540 BIOS 1.78 j4uj65wd.iso sha1:386353b39ec54f0feb5160cc6edc41b3def14dca L440, L540 BIOS 1.81 (J4ET81WW) EC 1.10 (J4EHT29WW, maybe J4HT29WW) j4uj75wd.iso sha1:3ff5025a4a5f62f461467f7726e5b2c1fa119b5b L440, L540 BIOS 1.93 (J4ET93WW) EC 1.11 (J4EHT30WW, maybe J4HT30WW) -# TODO -# - update the tools to automatically determine the FAT_OFFSET - # The firmware files from inside the ISO images -b590.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 +b590.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 @@ -291,8 +288,8 @@ 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:b590.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) +b590.H9ET92WW.img rule:IMGnuvoton,dep:b590.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 @@ -338,6 +335,10 @@ x61.7MHT25WW.img rule:IMGnoenc,dep:x61.7MHT25WW.s01B2000.FL2 x61 EC 1.03 # The end-user visible, nicely named iso images +patched.b580.iso rule:niceISO,dep:h1uj53us.exe,suffix:0,insert:0 for patching Thinkpad B480, B580, V480, V480c, V580, V580c +patched.b590.iso rule:niceISO,dep:h9et92ww.exe,suffix:0,insert:0 for patching Thinkpad B490, B590 +patched.e330.iso rule:niceISO,dep:h3uj76wd.iso,suffix:0,insert:0 for patching Thinkpad E330, V480s +patched.l430.iso rule:niceISO,dep:g3uj13us.iso,suffix:0,insert:0 for patching Thinkpad L430, L530 patched.t430.iso rule:niceISO,dep:g1uj48us.iso,suffix:0,insert:0 for patching Thinkpad T430 patched.t430s.iso rule:niceISO,dep:g7uj28us.iso,suffix:0,insert:0 for patching Thinkpad T430s patched.t530.iso rule:niceISO,dep:g4uj38us.iso,suffix:0,insert:0 for patching Thinkpad T530 @@ -345,7 +346,3 @@ patched.t530i.iso rule:niceISO,dep:g4uj38us.iso,suffix:0,insert:0 for patching patched.w530.iso rule:niceISO,dep:g5uj37us.iso,suffix:0,insert:0 for patching Thinkpad W530 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, 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 From 6e5924a0a348f1980f7be5e81628e0d24efcb791 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 16:50:02 +0200 Subject: [PATCH 11/16] Add comments to places that could be refactored or improved --- Makefile | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f80c765..7c1647d 100644 --- a/Makefile +++ b/Makefile @@ -207,6 +207,11 @@ patch_disable_keyboard: @sed -e "s%__DIR%`mdir -/ -b -i $<@@$(FAT_OFFSET) |grep FL2 |head -1|cut -d/ -f3`%; s%__FL2%`mdir -/ -b -i $<@@$(FAT_OFFSET) |grep FL2 |head -1|cut -d/ -f4`%" autoexec.bat.template >$@.tmp @mv $@.tmp $@ +# FIXME: +# - the following bat file generators are all basically duplicates of the +# above original one. They should be deduplicated +# - the "bat1" construct is ugly. Find a nicer way to do this. + %.iso.bat1: %.iso.orig autoexec.bat.template $(eval FAT_OFFSET := $(shell scripts/geteltorito -c $< 2>/dev/null)) @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 @@ -318,6 +323,9 @@ mec-tools/mec_encrypt: mec-tools/Makefile git submodule update make -C mec-tools +# FIXME: +# - There is no version tracking in this wget, so it is basically an untrusted +# execution vector. Either import this file to this repo or use a submodule. 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 @@ -357,6 +365,11 @@ 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 +# TODO: +# - the prepare_iso_from_tpl looks like it is entirely needed due to some +# Lenovo images being broken. Look into what is broken and see if it is +# patchable without a template. + # $@ is the ISO to create # $< is the FL2 # $1 is the pattern to match FL2 file in ISO image @@ -375,6 +388,11 @@ define prepare_iso_from_tpl rm -r $@.orig.extract.tmp endef +# FIXME: +# - the logic using the optional $2 below feels really clunky, try and +# improve it. See above for a related TODO for prepare_iso_from_tpl + + # Create a new ISO image with patches applied # # $@ is the ISO to create @@ -435,12 +453,16 @@ define rule_EXE_extract endef rule_EXE_extract_DEPS = # no extra local dependancies -# Create a new ISO image with patches applied +# TODO: +# - the following two rule_CAP_insert and rule_EXE_insert replicate a lot of +# logic included in rule_FL2_insert. See if we can refactor to share logic. + +# Create a new CAP 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 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 @@ -474,11 +496,11 @@ define rule_CAP_insert endef rule_CAP_insert_DEPS = -# Create a new ISO image with patches applied +# Create a new EXE 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 EXE 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 @@ -555,6 +577,10 @@ define rule_IMGnoenc_extract endef rule_IMGnoenc_extract_DEPS = scripts/FL2_copyIMG +# TODO: +# - the rule_IMGnoenc_insert and rule_IMGnuvoton_insert share much of their +# logic. See if we can refactor them to remove duplication. + # Insert the new firmware into the FL2 file - special case, without encryption # # $@ is the FL2 to create From bfcc26f4332facc42ca39e8a66b9086829c4e50c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 17:06:51 +0200 Subject: [PATCH 12/16] Repair the b580 rule_EXE_insert, and note it for future TODO --- Makefile | 12 +++++++++--- README.md | 16 ++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 7c1647d..43d3d1f 100644 --- a/Makefile +++ b/Makefile @@ -496,6 +496,13 @@ define rule_CAP_insert endef rule_CAP_insert_DEPS = +# TODO: +# - it is unclear if the dependancies for the $2 ISO image used below are +# handled +# - Similar to the prepare_iso_from_tpl, this looks like it has a bunch of +# logic due to some Lenovo images being broken. Look into what is broken +# and see if it is patchable without a template. + # Create a new EXE 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 @@ -510,7 +517,6 @@ define rule_EXE_insert @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 @@ -519,7 +525,7 @@ define rule_EXE_insert 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:::%=%))) + mcopy -o -s -m -i $@.tmp@@$(FAT_OFFSET) $< ::/FLASH/$(1) rm -r $@.orig.extract.tmp cp --reflink=auto $< $<.tmp @@ -528,7 +534,7 @@ define rule_EXE_insert 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:::%=%))) + ./scripts/ISO_copyFL2 to_iso $@.tmp $<.tmp $(1) -mdel -i $@.tmp@@$(FAT_OFFSET) ::EFI/Boot/BootX64.efi mcopy -t -m -o -i $@.tmp@@$(FAT_OFFSET) $@.report.tmp ::report.txt -mattrib -i $@.tmp@@$(FAT_OFFSET) -r -s -h ::AUTOEXEC.BAT diff --git a/README.md b/README.md index c4aec05..0a63e16 100644 --- a/README.md +++ b/README.md @@ -36,16 +36,6 @@ With the patches included here, you can install the classic keyboard hardware on many xx30 series laptops and make almost every key work properly. The only keys that are not working are Fn+F3 (Battery) and Fn+F12 (Hibernate) -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, B580, V480, V480c, V580, V580c and E330. -Patches are included now, for documentation, please check the mentioned -repository. - - * A full writeup of the hardware modifications needed can be found at: http://www.thinkwiki.org/wiki/Install_Classic_Keyboard_on_xx30_Series_ThinkPads @@ -54,6 +44,12 @@ repository. * A video presenting how these thinkpad laptops were hacked is online: https://www.youtube.com/watch?v=Fzmm87oVQ6c +* Reverse engineering details for the L430, L530, B580, V480, V480c, V580, + V580c and E330 models can be found in the [thinkpad-Lx30-ec project](https://github.com/leecher1337/thinkpad-Lx30-ec). + Patches for patching the genuine battery check on these have been + contributed from that project. (These all have an Nuvotron EC, with a + different architecture to the original "classic" thinkpad models). + Step-by-step instructions: -------------------------- From 3e25aaf1c6e5224dbc9ce76834884edf24422120 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 17:18:28 +0200 Subject: [PATCH 13/16] Dont try to read zero byte patch files --- scripts/hexpatch.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/hexpatch.pl b/scripts/hexpatch.pl index f82783d..9b27f7c 100755 --- a/scripts/hexpatch.pl +++ b/scripts/hexpatch.pl @@ -258,6 +258,14 @@ sub main() { next; } + if (-z $patchfile) { + warn("Patchfile $patchfile is zero bytes, skipping\n"); + if ($fail_on_missing) { + exit(1); + } + next; + } + my $db = read_patchfile($patchfile); if (!defined($db)) { From 01760fe0d1e7232c663197b6dfb9eeadd89b3d49 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 17:30:59 +0200 Subject: [PATCH 14/16] Update the testing list so that we can avoid testing patches we dont have --- Descriptions.txt | 6 +++--- Makefile | 4 +++- b580.H1ET73WW.img.d/001_keysym.patch | 0 b580.H1ET73WW.img.d/002_dead_keys.patch | 0 b580.H1ET73WW.img.d/003_keysym_replacements.patch | 0 b580.H1ET73WW.img.d/004_fn_keys.patch | 0 b580.H1ET73WW.img.d/005_fn_key_swap.patch | 0 b590.H9ET92WW.img.d/001_keysym.patch | 0 b590.H9ET92WW.img.d/002_dead_keys.patch | 0 b590.H9ET92WW.img.d/003_keysym_replacements.patch | 0 b590.H9ET92WW.img.d/004_fn_keys.patch | 0 b590.H9ET92WW.img.d/005_fn_key_swap.patch | 0 e330.H3EC35WW.img.d/001_keysym.patch | 0 e330.H3EC35WW.img.d/002_dead_keys.patch | 0 e330.H3EC35WW.img.d/003_keysym_replacements.patch | 0 e330.H3EC35WW.img.d/004_fn_keys.patch | 0 e330.H3EC35WW.img.d/005_fn_key_swap.patch | 0 l430.G3HT40WW.img.d/002_dead_keys.patch | 0 l430.G3HT40WW.img.d/003_keysym_replacements.patch | 0 l430.G3HT40WW.img.d/004_fn_keys.patch | 0 l430.G3HT40WW.img.d/005_fn_key_swap.patch | 0 21 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 b580.H1ET73WW.img.d/001_keysym.patch delete mode 100644 b580.H1ET73WW.img.d/002_dead_keys.patch delete mode 100644 b580.H1ET73WW.img.d/003_keysym_replacements.patch delete mode 100644 b580.H1ET73WW.img.d/004_fn_keys.patch delete mode 100644 b580.H1ET73WW.img.d/005_fn_key_swap.patch delete mode 100644 b590.H9ET92WW.img.d/001_keysym.patch delete mode 100644 b590.H9ET92WW.img.d/002_dead_keys.patch delete mode 100644 b590.H9ET92WW.img.d/003_keysym_replacements.patch delete mode 100644 b590.H9ET92WW.img.d/004_fn_keys.patch delete mode 100644 b590.H9ET92WW.img.d/005_fn_key_swap.patch delete mode 100644 e330.H3EC35WW.img.d/001_keysym.patch delete mode 100644 e330.H3EC35WW.img.d/002_dead_keys.patch delete mode 100644 e330.H3EC35WW.img.d/003_keysym_replacements.patch delete mode 100644 e330.H3EC35WW.img.d/004_fn_keys.patch delete mode 100644 e330.H3EC35WW.img.d/005_fn_key_swap.patch delete mode 100644 l430.G3HT40WW.img.d/002_dead_keys.patch delete mode 100644 l430.G3HT40WW.img.d/003_keysym_replacements.patch delete mode 100644 l430.G3HT40WW.img.d/004_fn_keys.patch delete mode 100644 l430.G3HT40WW.img.d/005_fn_key_swap.patch diff --git a/Descriptions.txt b/Descriptions.txt index 4dcaffe..889dcc5 100644 --- a/Descriptions.txt +++ b/Descriptions.txt @@ -335,9 +335,9 @@ x61.7MHT25WW.img rule:IMGnoenc,dep:x61.7MHT25WW.s01B2000.FL2 x61 EC 1.03 # The end-user visible, nicely named iso images -patched.b580.iso rule:niceISO,dep:h1uj53us.exe,suffix:0,insert:0 for patching Thinkpad B480, B580, V480, V480c, V580, V580c -patched.b590.iso rule:niceISO,dep:h9et92ww.exe,suffix:0,insert:0 for patching Thinkpad B490, B590 -patched.e330.iso rule:niceISO,dep:h3uj76wd.iso,suffix:0,insert:0 for patching Thinkpad E330, V480s +patched.b580.iso rule:niceISO,dep:h1uj53us.exe,suffix:0,insert:0 for patching Thinkpad B480, B580, V480, V480c, V580, V580c (Battery only) +patched.b590.iso rule:niceISO,dep:h9et92ww.exe,suffix:0,insert:0 for patching Thinkpad B490, B590 (Battery only) +patched.e330.iso rule:niceISO,dep:h3uj76wd.iso,suffix:0,insert:0 for patching Thinkpad E330, V480s (Battery only) patched.l430.iso rule:niceISO,dep:g3uj13us.iso,suffix:0,insert:0 for patching Thinkpad L430, L530 patched.t430.iso rule:niceISO,dep:g1uj48us.iso,suffix:0,insert:0 for patching Thinkpad T430 patched.t430s.iso rule:niceISO,dep:g7uj28us.iso,suffix:0,insert:0 for patching Thinkpad T430s diff --git a/Makefile b/Makefile index 43d3d1f..4424b58 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,8 @@ QEMU_OPTIONS ?= -enable-kvm GITVERSION = $(shell git describe --dirty --abbrev=6 ) ($(shell date +%Y%m%d)) BUILDINFO = $(GITVERSION) $(MAKECMDGOALS) -LIST_PATCHED = $(basename $(shell grep ^patched Descriptions.txt |cut -d" " -f1)) +LIST_PATCHED = $(basename $(shell grep ^patched Descriptions.txt |grep -v Battery |cut -d" " -f1)) +LIST_PATCHED_BO = $(basename $(shell grep ^patched Descriptions.txt |grep Battery |cut -d" " -f1)) list_laptops: $(info ) @@ -34,6 +35,7 @@ DEPSDIR := .d $(shell mkdir -p $(DEPSDIR)) test: $(addsuffix .iso,$(LIST_PATCHED)) $(addsuffix .img,$(LIST_PATCHED)) +testbo: $(addsuffix .iso,$(LIST_PATCHED_BO)) $(addsuffix .img,$(LIST_PATCHED_BO)) ALL_IMG_ORIG := $(addsuffix .orig,$(shell grep rule:IMG Descriptions.txt |cut -d" " -f1)) test.img.orig: $(ALL_IMG_ORIG) diff --git a/b580.H1ET73WW.img.d/001_keysym.patch b/b580.H1ET73WW.img.d/001_keysym.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b580.H1ET73WW.img.d/002_dead_keys.patch b/b580.H1ET73WW.img.d/002_dead_keys.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b580.H1ET73WW.img.d/003_keysym_replacements.patch b/b580.H1ET73WW.img.d/003_keysym_replacements.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b580.H1ET73WW.img.d/004_fn_keys.patch b/b580.H1ET73WW.img.d/004_fn_keys.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b580.H1ET73WW.img.d/005_fn_key_swap.patch b/b580.H1ET73WW.img.d/005_fn_key_swap.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b590.H9ET92WW.img.d/001_keysym.patch b/b590.H9ET92WW.img.d/001_keysym.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b590.H9ET92WW.img.d/002_dead_keys.patch b/b590.H9ET92WW.img.d/002_dead_keys.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b590.H9ET92WW.img.d/003_keysym_replacements.patch b/b590.H9ET92WW.img.d/003_keysym_replacements.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b590.H9ET92WW.img.d/004_fn_keys.patch b/b590.H9ET92WW.img.d/004_fn_keys.patch deleted file mode 100644 index e69de29..0000000 diff --git a/b590.H9ET92WW.img.d/005_fn_key_swap.patch b/b590.H9ET92WW.img.d/005_fn_key_swap.patch deleted file mode 100644 index e69de29..0000000 diff --git a/e330.H3EC35WW.img.d/001_keysym.patch b/e330.H3EC35WW.img.d/001_keysym.patch deleted file mode 100644 index e69de29..0000000 diff --git a/e330.H3EC35WW.img.d/002_dead_keys.patch b/e330.H3EC35WW.img.d/002_dead_keys.patch deleted file mode 100644 index e69de29..0000000 diff --git a/e330.H3EC35WW.img.d/003_keysym_replacements.patch b/e330.H3EC35WW.img.d/003_keysym_replacements.patch deleted file mode 100644 index e69de29..0000000 diff --git a/e330.H3EC35WW.img.d/004_fn_keys.patch b/e330.H3EC35WW.img.d/004_fn_keys.patch deleted file mode 100644 index e69de29..0000000 diff --git a/e330.H3EC35WW.img.d/005_fn_key_swap.patch b/e330.H3EC35WW.img.d/005_fn_key_swap.patch deleted file mode 100644 index e69de29..0000000 diff --git a/l430.G3HT40WW.img.d/002_dead_keys.patch b/l430.G3HT40WW.img.d/002_dead_keys.patch deleted file mode 100644 index e69de29..0000000 diff --git a/l430.G3HT40WW.img.d/003_keysym_replacements.patch b/l430.G3HT40WW.img.d/003_keysym_replacements.patch deleted file mode 100644 index e69de29..0000000 diff --git a/l430.G3HT40WW.img.d/004_fn_keys.patch b/l430.G3HT40WW.img.d/004_fn_keys.patch deleted file mode 100644 index e69de29..0000000 diff --git a/l430.G3HT40WW.img.d/005_fn_key_swap.patch b/l430.G3HT40WW.img.d/005_fn_key_swap.patch deleted file mode 100644 index e69de29..0000000 From 7feba3cbce7d0dddcede1b1453b13fead1803ba2 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 17:34:57 +0200 Subject: [PATCH 15/16] Integrate the battery-only patches into the test framework --- .github/workflows/main.yml | 2 ++ Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4a86bf4..e00b37a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,6 +20,8 @@ jobs: - run: sudo make build-deps - run: make patch_enable_battery - run: make test + - run: make patch_disable_keyboard + - run: make test.batteryonly - run: rm -f .config - run: make test - run: make test.img.orig diff --git a/Makefile b/Makefile index 4424b58..c80eb69 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ DEPSDIR := .d $(shell mkdir -p $(DEPSDIR)) test: $(addsuffix .iso,$(LIST_PATCHED)) $(addsuffix .img,$(LIST_PATCHED)) -testbo: $(addsuffix .iso,$(LIST_PATCHED_BO)) $(addsuffix .img,$(LIST_PATCHED_BO)) +test.batteryonly: $(addsuffix .iso,$(LIST_PATCHED_BO)) $(addsuffix .img,$(LIST_PATCHED_BO)) ALL_IMG_ORIG := $(addsuffix .orig,$(shell grep rule:IMG Descriptions.txt |cut -d" " -f1)) test.img.orig: $(ALL_IMG_ORIG) From b2f4fc8c731bb6bbde1da13cd57401ec824b30d3 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 28 May 2022 17:39:02 +0200 Subject: [PATCH 16/16] Update ignorables with new types of binaries --- .gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index f28613f..d793af1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,15 +8,25 @@ *.img.orig *.img.enc *.img.enc.orig +*.FL1 *.FL1.orig *.FL2 *.FL2.orig +*.EXE +*.EXE.orig +*.exe.orig +*.CAP +*.CAP.orig # ignore generated files *.bat +*.bat1 *.report .d *.pgm +# The destination of the wget hack +nuvoton-tools/ + # Temp are (should be) just junk *.tmp