From 7c30df40b316ad24f3d0470979a264d19fe27cce Mon Sep 17 00:00:00 2001 From: leecher1337 Date: Wed, 9 Feb 2022 21:50:42 +0000 Subject: [PATCH] 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 |-