Skip to content

Commit

Permalink
Ensure the outer EC fw checksum is always fixed after patching
Browse files Browse the repository at this point in the history
The outer checksum has been observed on all Lenovo EC firmware files
analyzed so far. This avoids the special case for the x200 which only
has the outer checksum.
  • Loading branch information
ypid committed Jun 26, 2017
1 parent f59dbe7 commit 0e9a317
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
18 changes: 7 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ $(shell mkdir -p $(DEPSDIR))
# images) and any small downloads
clean:
rm -f $(CLEAN_FILES) \
patched.*.iso patched.*.img *.FL2 *.FL2.orig *.img.enc *.img.csum_ok \
*.img.enc.orig *.img.csum_ok.orig *.img.orig *.bat \
patched.*.iso patched.*.img *.FL2 *.FL2.orig *.img.enc \
*.img.enc.orig *.img.orig *.bat \
*.img \
*.txt.orig

Expand Down Expand Up @@ -254,12 +254,6 @@ $(DEPSDIR)/slice.insert.deps: Makefile
%.img.enc: %.img scripts/xx30.encrypt
./scripts/xx30.encrypt $< $@

# A generic outer checksum fixer
%.img.csum_ok: %.img mec-tools/mec_csum_outer
cp --reflink=auto $< $@
./mec-tools/mec_csum_outer -f $@
./mec-tools/mec_csum_outer -c $@

# TODO
# - if we ever get generic extraction or encryption for more than
# just the Xx30 series, these generic rules will need to be reworked
Expand All @@ -273,6 +267,8 @@ $(DEPSDIR)/slice.insert.deps: Makefile
%.img: %.img.orig
cp --reflink=auto $< $@
./scripts/hexpatch.pl --rm_on_fail $@ $@.d/*.patch
./mec-tools/mec_csum_outer -f $@
./mec-tools/mec_csum_outer -c $@

# using both __DIR and __FL2 is a hack to get around needing to quote the
# DOS path separator. It feels like there should be a better way if I put
Expand Down Expand Up @@ -404,9 +400,9 @@ $(call rule_fl2_patch,t430.G1HT35WW.img.enc,t430.G1HT35WW.s01D2000.FL2)
$(call rule_fl2_patch,t430s.G7HT39WW.img.enc,t430s.G7HT39WW.s01D8000.FL2)
$(call rule_fl2_patch,t530.G4HT39WW.img.enc,t530.G4HT39WW.s01D5100.FL2)
$(call rule_fl2_patch,w530.G4HT39WW.img.enc,w530.G4HT39WW.s01D5200.FL2)
$(call rule_fl2_patch,x200.7XHT22WW.img.csum_ok,x200.7XHT22WW.s01B9x00.FL2)
$(call rule_fl2_patch,x200.7XHT24WW.img.csum_ok,x200.7XHT24WW.s01B9x00.FL2)
$(call rule_fl2_patch,x200.7XHT25WW.img.csum_ok,x200.7XHT25WW.s01B9x00.FL2)
$(call rule_fl2_patch,x200.7XHT22WW.img,x200.7XHT22WW.s01B9x00.FL2)
$(call rule_fl2_patch,x200.7XHT24WW.img,x200.7XHT24WW.s01B9x00.FL2)
$(call rule_fl2_patch,x200.7XHT25WW.img,x200.7XHT25WW.s01B9x00.FL2)
$(call rule_fl2_patch,x230.G2HT35WW.img.enc,x230.G2HT35WW.s01D3000.FL2)
$(call rule_fl2_patch,x230t.GCHT25WW.img.enc,x230t.GCHT25WW.s01DA000.FL2)

Expand Down
1 change: 0 additions & 1 deletion x200.7XHT22WW.img.csum_ok.slice

This file was deleted.

1 change: 0 additions & 1 deletion x200.7XHT24WW.img.csum_ok.slice

This file was deleted.

1 change: 0 additions & 1 deletion x200.7XHT25WW.img.csum_ok.slice

This file was deleted.

0 comments on commit 0e9a317

Please sign in to comment.