2016-04-19 08:54:06 +00:00
|
|
|
|
|
|
|
all:
|
|
|
|
false
|
|
|
|
|
|
|
|
#
|
|
|
|
# Radare didnt seem to let me specify the direcrory to store the project file,
|
|
|
|
# so this target hacks around that
|
|
|
|
#
|
|
|
|
install.radare.projects:
|
|
|
|
mkdir -p ~/.config/radare2/projects/x220.8DHT34WW.d
|
2016-04-21 02:15:37 +00:00
|
|
|
cp -fs $(PWD)/radare/x220.8DHT34WW ~/.config/radare2/projects
|
|
|
|
mkdir -p ~/.config/radare2/projects/x230.G2HT35WW.d
|
|
|
|
cp -fs $(PWD)/radare/x230.G2HT35WW ~/.config/radare2/projects
|
2016-04-19 08:54:06 +00:00
|
|
|
|
2016-04-19 09:02:49 +00:00
|
|
|
#
|
|
|
|
# Download any ISO image that we have a checksum for
|
|
|
|
# NOTE: makes an assumption about the Lenovo URL not changing
|
2016-04-19 10:52:09 +00:00
|
|
|
%.iso.orig: %.iso.orig.sha1
|
|
|
|
wget -O $@ https://download.lenovo.com/pccbbs/mobiles/$(basename $@)
|
2016-04-19 09:02:49 +00:00
|
|
|
sha1sum -c $<
|
|
|
|
touch $@
|
|
|
|
|
2016-04-19 09:54:56 +00:00
|
|
|
# Generate orig images so that we can diff against them later
|
2016-04-19 09:20:27 +00:00
|
|
|
# If we have an extractor for this image, use it
|
2016-04-19 09:54:56 +00:00
|
|
|
%.img.orig: %.extract %.img.orig.sha1
|
2016-04-19 09:39:23 +00:00
|
|
|
./$< $@
|
2016-04-19 09:25:18 +00:00
|
|
|
sha1sum -c $@.sha1
|
2016-04-19 09:20:27 +00:00
|
|
|
|
2016-04-20 00:53:07 +00:00
|
|
|
%.img.enc: %.encrypt %.img
|
|
|
|
./$< $(basename $<).img $@
|
|
|
|
|
2016-04-19 10:07:09 +00:00
|
|
|
# keep intermediate files
|
|
|
|
.PRECIOUS: %.img.orig
|
|
|
|
|
2016-04-22 06:50:48 +00:00
|
|
|
# Generate a working file with any known patches applied
|
2016-04-19 09:54:56 +00:00
|
|
|
%.img: %.img.orig
|
2016-04-22 06:50:48 +00:00
|
|
|
cp --reflink=auto $< $@
|
2016-04-22 07:23:34 +00:00
|
|
|
[ -d $@.d ] && ./hexpatch.pl $@ $@.d/*.patch
|
2016-04-22 06:50:48 +00:00
|
|
|
|
2016-04-22 07:13:50 +00:00
|
|
|
# if you want to work on more patches, you probably want the pre-patched ver
|
|
|
|
%.img.prepatch: %.img.orig
|
|
|
|
cp --reflink=auto $< $(basename $<)
|
|
|
|
|
2016-04-22 06:50:48 +00:00
|
|
|
%.hex: %
|
|
|
|
hd -v $< >$@
|
|
|
|
|
|
|
|
# Generate a patch report
|
|
|
|
%.diff: %.hex %.orig.hex
|
|
|
|
-diff -u $(basename $@).orig.hex $(basename $@).hex >$@
|
2016-04-19 09:54:56 +00:00
|
|
|
|
2016-04-19 09:39:23 +00:00
|
|
|
mec-tools/Makefile:
|
|
|
|
git submodule update --init --remote
|
|
|
|
|
|
|
|
mec-tools/mec_encrypt: mec-tools/Makefile
|
|
|
|
make -C mec-tools
|
|
|
|
|
|
|
|
#
|
|
|
|
# TODO:
|
|
|
|
# - most of these dependancies could be automatically calculated
|
2016-04-19 10:52:09 +00:00
|
|
|
x220.8DHT34WW.extract: 8duj27us.iso.orig
|
|
|
|
x230.G2HT35WW.extract: g2uj23us.iso.orig mec-tools/mec_encrypt
|
2016-04-20 00:53:07 +00:00
|
|
|
x230.G2HT35WW.encrypt: mec-tools/mec_encrypt
|
|
|
|
|