Update code and instructions to default to using USB disk image files

pull/4/head
Hamish Coleman 8 years ago
parent 8d1bca8940
commit 35b8918138

@ -12,15 +12,15 @@ all: list_laptops
list_laptops:
$(info )
$(info The following laptop make targets are supported:)
$(info The following make targets are the supported usb images:)
$(info )
$(info patched.t430.iso - for patching Thinkpad T430)
$(info patched.t430s.iso - for patching Thinkpad T430s)
$(info patched.t530.iso - for patching Thinkpad T530)
$(info patched.t530i.iso - for patching Thinkpad T530i)
$(info patched.w530.iso - for patching Thinkpad W430)
$(info patched.x230.iso - for patching Thinkpad X230)
$(info patched.x230t.iso - for patching Thinkpad X230t)
$(info patched.t430.img - for patching Thinkpad T430)
$(info patched.t430s.img - for patching Thinkpad T430s)
$(info patched.t530.img - for patching Thinkpad T530)
$(info patched.t530i.img - for patching Thinkpad T530i)
$(info patched.w530.img - for patching Thinkpad W430)
$(info patched.x230.img - for patching Thinkpad X230)
$(info patched.x230t.img - for patching Thinkpad X230t)
$(info )
.PHONY: list_laptops
@ -165,6 +165,25 @@ $(DEPSDIR)/slice.insert.deps: Makefile
%.dosflash.exe.orig: %.iso.orig
MTOOLS_SKIP_CHECK=1 mcopy -i $^@@$(FAT_OFFSET) ::FLASH/DOSFLASH.EXE $@
## Use the system provided geteltorito script, if there is one
#GETELTORITO := $(shell if type geteltorito >/dev/null; then echo geteltorito; else echo ./geteltorito; fi)
# use the included geteltorito script always, since we know it does not have
# the hdd size bug
GETELTORITO := ./geteltorito
# extract the DOS boot image from an iso (and fix it up so qemu can boot it)
%.img: %.iso
$(GETELTORITO) -o $@ $<
./hexpatch.pl $@ fix-hdd-image.patch
# simple testing of images in an emulator
%.iso.test: %.iso
qemu-system-x86_64 -enable-kvm -cdrom $<
%.img.test: %.img
qemu-system-x86_64 -enable-kvm -hda $<
mec-tools/Makefile:
git submodule update --init --remote

@ -31,35 +31,43 @@ This software expects to be run under Linux.
cd thinkpad-ec
5. Show the list of laptops and ISO image names:
5. Show the list of laptops and USB image file names:
make list_laptops
(note that this list might change from time to time if there are new
BIOS versions released)
6. Select the correct ISO name for your laptop. E.G. "patched.x230.iso" for
6. Select the correct IMG name for your laptop. E.G. "patched.x230.img" for
the x230 laptop.
7. Create the patched ISO for this laptop (this will download the original
file from Lenovo and patch it):
7. Make the fully patched iimage for this laptop (this will download
the original file from Lenovo and patch it):
make patched.x230.iso
make patched.x230.img
8. Use your normal CDROM burning tools to put this image on a blank cd and
boot it up. You will be prompted with information about the patch and
asked to confirm your laptop type. Then it will automatically flash
the patched firmware.
8. Insert your USB stick and determine what device name it has.
This command should help you find the right device:
lsblk -d -p -o NAME,SIZE,LABEL
Notes:
9. Write the bootable patched image onto the USB stick device
WARNING: if you do not have the right device name, you might overwrite
your hard drive!
sudo dd if=patched.x230.img of=/dev/sdb
* These thinkpads will boot from a USB cdrom drive, so you do not need one
internal to your laptop for this to work.
Your USB stick is now ready to boot and install the patched firmware.
When you boot this, you will be prompted with information about the patch
and asked to confirm your laptop type. It will then automatically flash
the patched firmware.
Notes:
* If you do not have a cdrom, or do not want to use it, it is possible to
extract an image from the ISO that is suitable for placing on a bootable
USB stick (I hope to add this as an automated feature shortly)
* You can also create a bootable CDROM image for burning to a disk
by asking for a ".iso" file in step 7 above. Then you can use your
normal CDROM burning tools to put this image on a blank cd and boot
it up, skipping steps 8 and 9.
* More information for hacking on this can be found in the docs/HACKING.txt
file.

@ -0,0 +1,16 @@
Qemu does not support disk images with more than 16 heads, but the lenovo
disk image is created with 64 heads. Since the MBR they used does not use
LBA to access the disk, this confuses it and causes it to fail.
This patch changes the partition end head/cylinder, which is all that is
needed to make the MBR happy
@@ fix partition table @@
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 01 |................|
-000001c0 01 00 04 3f 20 1f 20 00 00 00 e0 ff 00 00 00 00 |...? . .........|
+000001c0 01 00 04 0f 20 7f 20 00 00 00 e0 ff 00 00 00 00 |.... . .........|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
Loading…
Cancel
Save