T60p Extract VGABIOS From Backup - bibanon/Coreboot-ThinkPads GitHub Wiki
This method extracts the VGABIOS blob from a backup of the Lenovo BIOS
This is the most reliable method, since:
- You are guaranteed to get an image that fits to your onboard VGA.
- Even if your VGA BIOS uses self-modifying code you get a correct image.
Back up Official Lenovo BIOS
The Lenovo BIOS must be backed up, to extract the proprietary VGA blobs needed that allow Coreboot to use the ATI GPU.
This BIOS image is unique to every motherboard. It will be impossible to restore the Lenovo BIOS once it is lost. Do not use another laptop's BIOS image.
The factory image also comes in handy just in case the Lenovo BIOS needs to be restored.
-
From the
libreboot_bin/folder, enter theflashrom/folder.cd flashrom -
Run all three of these commands to backup the BIOS to
factory.bin(don't panic, nothing is being installed):sudo ./flashrom -p internal -r factory.bin sudo ./flashrom_lenovobios_sst -p internal -r factory.bin sudo ./flashrom_lenovobios_macronix -p internal -r factory.bin -
If a
factory.binfile was created in theflashrom/folder, the Lenovo BIOS has been backed up successfully. If not, try the commands again. (If you're still having issues, your BIOS flashchip hasn't been detected) -
Return to the
libreboot_bin/folder.cd ..
Extract Proprietary Option ROMs from Lenovo BIOS
-
Install the packages required to build source code,
build-essentialandgit(for Ubuntu/Debian/Trisquel)sudo apt-get install build-essential git -
Download the source code for
bios_extract.git clone https://review.coreboot.org/bios_extract.git -
Enter the
bios_extractfolder.cd bios_extract -
Compile the source code using
make.make -
Create and enter a new folder where the extracted rom files will go.
mkdir factory cd factory -
Copy the
factory.romfile to this folder (which is a backup created in the previous section). -
Decompress your rom image.
../bios_extract factory.rom -
You will get an output similar to this:
Using file "factory.rom" (2048kB)
Found Phoenix BIOS "Phoenix FirstBIOS(tm) Notebook Pro Version 2.0 for ThinkPad"
Version "79ETC9WW", created on 12/22/06 at 13:54:43.
0x1E83CA ( 31782 bytes) -> romexec_0.rom
0x1E7724 ( 3215 bytes) -> display_0.rom (4752 bytes)
0x1E72D5 ( 1072 bytes) -> decompcode_0.rom [0x7000:0x0030]
0x1E62B0 ( 4110 bytes) -> 56_0.rom (40800 bytes)
0x1E6213 ( 130 bytes) -> acpi_0.rom (244 bytes)
0x1E61C1 ( 51 bytes) -> acpi_1.rom
0x1E5FFC ( 426 bytes) -> acpi_2.rom
0x1E5F9E ( 71 bytes) -> acpi_4.rom (82 bytes)
0x1E5F58 ( 43 bytes) -> acpi_5.rom (50 bytes)
0x1E5EED ( 80 bytes) -> acpi_6.rom (104 bytes)
0x1E5EA0 ( 50 bytes) -> acpi_7.rom (60 bytes)
0x1E5E4A ( 59 bytes) -> acpi_8.rom (56 bytes)
0x1E5DD1 ( 94 bytes) -> logo_1.rom (530 bytes)
0x1E5D24 ( 146 bytes) -> logo_2.rom (722 bytes)
0x1E5C95 ( 116 bytes) -> logo_3.rom (306 bytes)
0x1E5C52 ( 40 bytes) -> logo_4.rom (54 bytes)
0x1E5C12 ( 37 bytes) -> logo_5.rom (42 bytes)
0x1E5B8F ( 104 bytes) -> logo_6.rom (530 bytes)
0x1E5B03 ( 113 bytes) -> logo_7.rom (530 bytes)
0x1E5A77 ( 113 bytes) -> logo_8.rom (530 bytes)
0x1E59EC ( 112 bytes) -> logo_9.rom (530 bytes)
0x1E5962 ( 111 bytes) -> logo_10.rom (530 bytes)
0x1E5929 ( 26 bytes) -> logo_11.rom
0x1E58D0 ( 66 bytes) -> logo_12.rom (178 bytes)
0x1E51BA ( 1787 bytes) -> logo_13.rom (30278 bytes)
0x1E50D5 ( 202 bytes) -> SmartCardPAS_0.rom (156 bytes)
0x1E508E ( 40 bytes) -> tcpa_*_0.rom
0x1E0020 ( 20544 bytes) -> romexec_1.rom
0x1DBF79 ( 16528 bytes) -> strings_0.rom (42552 bytes)
0x1CC750 ( 63488 bytes) -> update_0.rom
0x1C2C24 ( 39701 bytes) -> oprom_0.rom (65024 bytes)
0x1B8F11 ( 40184 bytes) -> oprom_1.rom (65536 bytes)
0x1B473F ( 18359 bytes) -> oprom_5.rom (30208 bytes)
0x1B0928 ( 15868 bytes) -> oprom_6.rom (26112 bytes)
0x1B056E ( 927 bytes) -> logo_14.rom (4998 bytes)
0x1B0371 ( 482 bytes) -> tcpa_<_0.rom (677 bytes)
0x1B00DF ( 631 bytes) -> font_0.rom (1024 bytes)
0x1A6438 ( 39884 bytes) -> oprom_2.rom (65536 bytes)
0x19C808 ( 39957 bytes) -> oprom_3.rom (65024 bytes)
0x193151 ( 38556 bytes) -> oprom_4.rom (65536 bytes)
0x18E6EE ( 19016 bytes) -> setup_0.rom (46156 bytes)
0x18A9DA ( 15609 bytes) -> template_0.rom (33664 bytes)
0x182125 ( 34970 bytes) -> miser_0.rom (51520 bytes)
0x1723B2 ( 64856 bytes) -> tcpa_Q_0.rom (129104 bytes)
0x16D6A6 ( 19697 bytes) -> acpi_3.rom (54401 bytes)
0x16AE8B ( 67 bytes) -> logo_0.rom (122 bytes)
0x16A4F6 ( 2426 bytes) -> logo_15.rom (26870 bytes)
0x169FF1 ( 1258 bytes) -> logo_16.rom (14014 bytes)
0x1698B6 ( 1824 bytes) -> logo_17.rom (13578 bytes)
0x1691EC ( 1711 bytes) -> logo_18.rom (13578 bytes)
0x168BBF ( 1554 bytes) -> logo_19.rom (13578 bytes)
0x1649C6 ( 16862 bytes) -> tcpa_H_0.rom (23728 bytes)
0x1549A7 ( 65536 bytes) -> 2F_0.rom
0x14E98C ( 21504 bytes) -> 2E_0.rom
0x14C971 ( 7026 bytes) -> 2D_0.rom
0x14BE64 ( 2806 bytes) -> 2C_0.rom (24727 bytes)
0x14772B ( 18206 bytes) -> tcpa_K_0.rom (36682 bytes)
0x147502 ( 526 bytes) -> tcpa_K_1.rom (596 bytes)
0x141D82 ( 22373 bytes) -> bioscode_0.rom (33792 bytes) [0xF000:0x7C00]
0x13745F ( 43272 bytes) -> bioscode_1.rom (61184 bytes) [0x4000:0x1940]
0x12D59E ( 40614 bytes) -> bioscode_2.rom (58560 bytes) [0xE000:0x1C00]
0x1257C6 ( 32189 bytes) -> bioscode_3.rom (46864 bytes) [0x7000:0x08F0]
0x12391F ( 7820 bytes) -> bioscode_4.rom (12736 bytes) [0x3000:0xB350]
extra fragments: (109401, 27638 bytes)
0x12203A ( 33984 bytes) -> bioscode_5.rom (63424 bytes) [0x5000:0x0840]
0x12001B ( 7621 bytes) -> tcpa_?_0.rom
0x107653 ( 7602 bytes) -> bioscode_6.rom (13360 bytes) [0x3000:0xE510]
Finding the VGABIOS with romheaders
Now that the option roms oprom_?.rom have been extracted, we must search for the video BIOS ROM. We will use the romheaders tool from the FCode Suite.
-
Install the FCode Suite.
sudo apt-get install fcode-utils -
Use the
romheaderstool to check the properties ofoprom_0.rom.romheaders oprom_0.rom -
The
romheaderstool should output something similar to the below.
Image 1:
PCI Expansion ROM Header:
Signature: 0x55aa (Ok)
CPU unique data: 0x7f 0xe9 0x77 0x02 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Pointer to PCI Data Structure: 0x0238
PCI Data Structure:
Signature: 0x50434952 'PCIR' (Ok)
Vendor ID: 0x1002
Device ID: 0x7145
Vital Product Data: 0x0000
PCI Data Structure Length: 0x0018 (24 bytes)
PCI Data Structure Revision: 0x00
Class Code: 0x030000 (VGA Display controller)
Image Length: 0x007f blocks (65024 bytes)
Revision Level of Code/Data: 0x090c
Code Type: 0x00 (Intel x86)
Last-Image Flag: 0x80 (last image in rom)
Reserved: 0x0000
Platform specific data for x86 compliant option rom:
Initialization Size: 0x7f (65024 bytes)
Entry point for INIT function: 0x27d