code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>ThinkPad T500: flashing tutorial (BeagleBone Black)</title>

Flashing the T500 with a BeagleBone Black

Initial flashing instructions for T500.

				This guide is for those who want libreboot on their ThinkPad T500
				while they still have the original Lenovo BIOS present. This guide
				can also be followed (adapted) if you brick your T500, to know how
				to recover.

Back to main index

Libreboot T400

				You may also be interested in the smaller, more portable Libreboot T400.

Serial port

				EHCI debug might not be needed. It has been reported that the docking station
				for this laptop has a serial port, so it might be possible to use that instead.

LCD compatibly

				Not all LCD panels are compatible yet. See ../hcl/gm45_lcd.html.

A note about CPUs

				ThinkWiki has a list of CPUs
				for this system. The Core 2 Duo P8400, P8600 and P8700 are believed to work in libreboot.
				The T9600 was also tested on the T400 and confirmed working, so the T9400/T9500/T9550 probably
				also work, but they are untested.

Quad-core CPUs

					Although blocked by lenovobios (as was reported), it is reported that there are quad-core CPUs
					for GM45. This laptop has socketed CPUs, so it might be possible to use them
					(they are untested in coreboot; support may have to be added).
					Core 2 Quad Q9000, Q9100 or QX9300.

					Look at this link:

					https://en.wikipedia.org/wiki/List_of_Intel_Core_2_microprocessors#Quad-Core_Notebook_processors

A note about GPUs

				Some models have an Intel GPU, while others have both an ATI and an Intel GPU; this
				is referred to as "switchable graphics". In the BIOS setup program
				for lenovobios, you can specify that the system will use one or the other (but not both).

				Libreboot is known to work on systems with only the Intel GPU, using native graphics initialization.
				On systems with switchable graphics, the Intel GPU is used and the ATI GPU is disabled, so
				native graphics initialization works all the same.

CPU paste required

				See #paste.

Flash chip size

				Use this to find out:

				# dmidecode | grep ROM\ Size

				Back to top of page.

MAC address

				On the T500, the MAC address for the onboard
				gigabit ethernet chipset is stored inside the flash chip,
				along with other configuration data.

				Keep a note of the MAC address before disassembly; this is
				very important, because you will need to insert this into
				the libreboot ROM image before flashing it.
				It will be written in one of these locations:

Initial BBB configuration

				Refer to bbb_setup.html for how to
				configure the BBB for flashing.

				The following shows how to connect clip to the BBB	(on the P9 header), for SOIC-16 (clip: Pomona 5252):

POMONA 5252 (correlate with the BBB guide)
===  ethernet jack and VGA port ====
 NC              -       - 21
 1               -       - 17
 NC              -       - NC
 NC              -       - NC
 NC              -       - NC
 NC              -       - NC
 18              -       - 3.3V (PSU)
 22              -       - NC - this is pin 1 on the flash chip
===  SATA port ===
This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.

				The following shows how to connect clip to the BBB	(on the P9 header), for SOIC-8 (clip: Pomona 5250):

POMONA 5250 (correlate with the BBB guide)
===  RAM slots ====
 18              -       - 1
 22              -       - NC
 NC              -       - 21
 3.3V (PSU)      -       - 17 - this is pin 1 on the flash chip
===  slot where the AC jack is connected ===

This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.

				The procedure

					Remove all screws:

					It is also advisable to, throughout the disassembly,
					place any screws and/or components that you removed in
					the same layout or arrangement. The follow photos demonstrate
					this:

					Remove the HDD/SSD and optical drive:

					Remove the palm rest:

					Remove the keyboard and rear bezel:

					If you have a WWAN/3G card and/or sim card reader,
					remove them permanently. The WWAN-3G card has proprietary firmware inside; the technology is identical
					to what is used in mobile phones, so it can also track
					your movements:

					Remove this frame, and then remove the wifi chip:

					Remove the speakers:

					Remove the NVRAM battery (already removed in this photo):

					When you re-assemble, you will be replacing the wifi chip
					with another. These two screws don't hold anything together,
					but they are included in your system because the screw
					holes for half-height cards are a different size, so
					use these if you will be installing a half-height card:

					Unroute the antenna wires:

					Disconnect the LCD cable from the motherboard:

					Remove the LCD assembly hinge screws, and then remove the LCD
					assembly:

					Remove the fan and heatsink:

					Remove this screw:

					Remove these cables, keeping note of how and in what
					arrangement they are connected:

					Disconnect the power jack:

					Remove the motherboard and cage from the base
					(the marked hole is where those cables were routed through):

					Remove all screws, arranging them in the same layout
					when placing the screws on a surface and marking each screw
					hole (this is to reduce the possibility of putting them
					back in the wrong holes):

					Also remove this:

					Separate the motherboard from the cage:

					The flash chip is next to the memory slots. On this
					system, it was a SOIC-8 (4MiB or 32Mb) flash chip:

					Connect your programmer, then connect GND and 3.3V

					A dedicated 3.3V PSU was used to create this guide, but
					at ATX PSU is also fine:

					Of course, make sure to turn on your PSU:

					Now, you should be ready to install libreboot.

					Flashrom binaries for ARM (tested on a BBB) are distributed in libreboot_util. Alternatively,
					libreboot also distributes flashrom source code which can be built.

					Log in as root on your BBB, using the instructions in bbb_setup.html#bbb_access.

					Test that flashrom works:

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512

					In this case, the output was:

flashrom v0.9.7-r1854 on Linux 3.8.13-bone47 (armv7l)
flashrom is free software, get the source code at http://www.flashrom.org
Calibrating delay loop... OK.
Found Macronix flash chip "MX25L6405(D)" (8192 kB, SPI) on linux_spi.
Found Macronix flash chip "MX25L6406E/MX25L6436E" (8192 kB, SPI) on linux_spi.
Found Macronix flash chip "MX25L6445E/MX25L6473E" (8192 kB, SPI) on linux_spi.
Multiple flash chip definitions match the detected chip(s): "MX25L6405(D)", "MX25L6406E/MX25L6436E", "MX25L6445E/MX25L6473E"
Please specify which chip definition to use with the -c <chipname> option.

					How to backup factory.rom (change the -c option as neeed, for your flash chip):

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory.rom

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory1.rom

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory2.rom

					Note: the -c option is not required in libreboot's patched flashrom, because
					the redundant flash chip definitions in flashchips.c have been removed.

					Now compare the 3 images:

					# sha512sum factory*.rom

					If the hashes match, then just copy one of them (the factory.rom) to a safe place (on a drive connected to another system, not
					the BBB). This is useful for reverse engineering work, if there is a desirable behaviour in the original firmware
					that could be replicated in coreboot and libreboot.

					Follow the instructions at ../hcl/gm45_remove_me.html#ich9gen
					to change the MAC address inside the libreboot ROM image, before flashing it.
					Although there is a default MAC address inside the ROM image, this is not what you want. Make sure
					to always change the MAC address to one that is correct for your system.

					Now flash it:

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -w path/to/libreboot/rom/image.rom -V

					You might see errors, but if it says Verifying flash... VERIFIED at the end, then it's flashed and should boot.
					If you see errors, try again (and again, and again); the message Chip content is identical to the requested image
					is also an indication of a successful installation.

					Example output from running the command (see above):

flashrom v0.9.7-r1854 on Linux 3.8.13-bone47 (armv7l)
flashrom is free software, get the source code at http://www.flashrom.org
Calibrating delay loop... OK.
Found Macronix flash chip "MX25L6405(D)" (8192 kB, SPI) on linux_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... FAILED at 0x00001000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0000ffff: 0xd716
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase function.
Erase/write done.
Verifying flash... VERIFIED.

				Back to top of page.

Thermal paste (IMPORTANT)

				Because part of this procedure involved removing the heatsink, you will need to apply new paste.
				Arctic MX-4 is ok. You will also need isopropyl alcohol and an anti-static cloth to clean with.

				When re-installing the heatsink, you must first clean off all old paste with the alcohol/cloth.
				Then apply new paste. Arctic MX-4 is also much better than the default paste used on these systems.

				NOTE: the photo above is for illustration purposes only, and does not show how to properly apply the thermal paste.
				Other guides online detail the proper application procedure.

Wifi

				The T500 typically comes with an Intel wifi chipset, which does not
				work without proprietary software. For a list of wifi chipsets that
				work without proprietary software, see
				../hcl/index.html#recommended_wifi.

				Some T500 laptops might come with an Atheros chipset, but this is 802.11g only.

				It is recommended that you install a new wifi chipset. This can only
				be done after installing libreboot, because the original firmware has
				a whitelist of approved chips, and it will refuse to boot if you
				use an 'unauthorized' wifi card.

				The following photos show an Atheros AR5B95 being installed, to
				replace the Intel chip that this T500 came with:

WWAN

				If you have a WWAN/3G card and/or sim card reader, remove them permanently.
				The WWAN-3G card has DMA, and proprietary firmware inside; the technology is
				identical to what is used in mobile phones, so it can also track your movements.

				Not to be confused with wifi (wifi is fine).

Memory

				You need DDR3 SODIMM PC3-8500 RAM installed, in matching pairs
				(speed/size). Non-matching pairs won't work. You can also install a
				single module (meaning, one of the slots will be empty) in slot 0.

				Make sure that the RAM you buy is the 2Rx8 density.

				The following photo shows 8GiB (2x4GiB) of RAM installed:

				Boot it!

				You should see something like this:

				Now install GNU/Linux.

			Copyright ©  2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>ThinkPad T60: Recovery guide</title>

ThinkPad T60: Recovery guide

This section documents how to recover from a bad flash that prevents your ThinkPad T60 from booting.

Back to previous index

Table of Contents

					Types of brick:

Brick type 1: bucts not reset

Brick type 2: bad rom (or user error), system won't boot

Brick type 1: bucts not reset.

				You still have Lenovo BIOS, or you had libreboot running and you flashed another ROM; and you had bucts 1 set and
				the ROM wasn't dd'd.* or if Lenovo BIOS was present and libreboot wasn't flashed.

				In this case, unbricking is easy: reset BUC.TS to 0 by removing that yellow cmos coin (it's a battery) and putting it back after a minute or two:

				*Those dd commands should be applied to all newly compiled T60 ROM images (the ROM images in libreboot binary archives already have this applied!):

				dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k

				dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump

				dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc

				(doing this makes the ROM suitable for use when flashing a system that still has Lenovo BIOS running,
				using those instructions: http://www.coreboot.org/Board:lenovo/x60/Installation.
				(it says x60, but instructions for t60 are identical)

bad rom (or user error), system won't boot

				In this scenario, you compiled a ROM that had an incorrect configuration, or there is an actual bug preventing your system from
				booting. Or, maybe, you set BUC.TS to 0 and shut down after first flash while Lenovo BIOS was running. In any case, your system is bricked and will not boot at all.

				"Unbricking" means flashing a known-good (working) ROM. The problem: you can't boot the system, making this difficult. In this situation, external hardware (see hardware requirements above) is needed which can flash the SPI chip (where libreboot resides).

				Remove those screws and remove the HDD:

				Lift off the palm rest:

				Lift up the keyboard, pull it back a bit, flip it over like that and then disconnect it from the board:

				Gently wedge both sides loose:

				Remove that cable from the position:

				Now remove that bezel. Remove wifi, nvram battery and speaker connector (also remove 56k modem, on the left of wifi):

				Remove those screws:

				Disconnect the power jack:

				Remove nvram battery:

				Disconnect cable (for 56k modem) and disconnect the other cable:

				Disconnect speaker cable:

				Disconnect the other end of the 56k modem cable:

				Make sure you removed it:

				Unscrew those:

				Make sure you removed those:

				Disconnect LCD cable from board:

				Remove those screws then remove the LCD assembly:

				Once again, make sure you removed those:

				Remove the shielding containing the motherboard, then flip it over. Remove these screws, placing them on a steady
				surface in the same layout as they were in before you removed them. Also, you should mark each screw hole after removing the
				screw (a permanent marker pen will do), this is so that you have a point of reference when re-assembling the system:

				Now wire up the BBB and the Pomona with your PSU.

				Refer to bbb_setup.html for how to setup
				the BBB for flashing.

				Note, the guide mentions a 3.3v DC PSU but you don't need this on the T60:
				if you don't have or don't want to use an external PSU, then make
				sure not to connect the 3.3v leads mentioned in the guide;
				instead, connect the AC adapter (the one that normally charges your
				battery) so that the board has power (but don't boot it up)

				Correlate the following with the BBB guide linked above:

POMONA 5250:
===  DVD drive ====
 18              -       - 1
 22              -       - NC				---- RAM is on this end
 NC              -       - 21
 3.3V (PSU)      -       - 17 - this is pin 1 on the flash chip
===  audio jacks ===
This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.

				Connect the pomona from the BBB to the flash chip. No pics unfortunately. (use the text diagram above).

				Flashrom binaries for ARM (tested on a BBB) are distributed in libreboot_util. Alternatively,
				libreboot also distributes flashrom source code which can be built.

				SSH'd into the BBB:

				# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -w yourrom.rom

				It should be Verifying flash... VERIFIED at the end. If flashrom complains about multiple flash chip
				definitions detected, then choose one of them following the instructions in the output.

				Put those screws back:

				Put it back into lower chassis:

				Attach LCD and insert screws (also, attach the lcd cable to the board):

				Insert those screws:

				On the CPU (and there is another chip south-east to it, sorry forgot to take pic)
				clean off the old thermal paste (with the alcohol) and apply new (Artic Silver 5 is good, others are good too)
				you should also clean the heatsink the same way

				Attach the heatsink and install the screws (also, make sure to install the AC jack as highlighted):

				Reinstall that upper bezel:

				Do that:

				Re-attach modem, wifi, (wwan?), and all necessary cables. Sorry, forgot to take pics. Look at previous removal steps to see where they go back to.

				Attach keyboard and install nvram battery:

				Place keyboard and (sorry, forgot to take pics) reinstall the palmrest and insert screws on the underside:

				It lives!

				Always stress test ('stress -c 2' and xsensors. below 90C is ok) when replacing cpu paste/heatsink:

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.

repo_name: Amlouden/libreboot

license: mit


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>ThinkPad X200: flashing tutorial (BeagleBone Black)</title>

Flashing the X200 with a BeagleBone Black

Initial flashing instructions for X200.

				This guide is for those who want libreboot on their ThinkPad X200
				while they still have the original Lenovo BIOS present. This guide
				can also be followed (adapted) if you brick your X200, to know how
				to recover.

X200 laptops with libreboot pre-installed

Flash chips

MAC address

Initial BBB configuration and installation procedure

Boot it!

Wifi

wwan

Memory

X200S and X200 Tablet users: GPIO33 trick will not work.

Back to main index

X200 laptops with libreboot pre-installed

				If you don't want to install libreboot yourself, companies exist that sell these laptops
				with libreboot pre-installed, along with a free GNU/Linux distribution.

				Check the suppliers page for more information.

Flash chip size

				Use this to find out:

				# dmidecode | grep ROM\ Size

				The X200S and X200 Tablet will use a WSON-8 flash chip, on the
				bottom of the motherboard (this requires removal of the
				motherboard). Not all X200S/X200T are supported;
				see ../hcl/x200.html#x200s.

				Back to top of page.

MAC address

				On the X200/X200S/X200T, the MAC address for the onboard
				gigabit ethernet chipset is stored inside the flash chip,
				along with other configuration data.

				Keep a note of the MAC address before disassembly; this is
				very important, because you will need to insert this into
				the libreboot ROM image before flashing it.
				It will be written in one of these locations:

Initial BBB configuration

				Refer to bbb_setup.html for how to
				set up the BBB for flashing.

				The following shows how to connect the clip to the BBB	(on the P9 header), for SOIC-16 (clip: Pomona 5252):

POMONA 5252 (correlate with the BBB guide)
===  front (display) on your X200 ====
 NC              -       - 21
 1               -       - 17
 NC              -       - NC
 NC              -       - NC
 NC              -       - NC
 NC              -       - NC
 18              -       - 3.3V (PSU)
 22              -       - NC - this is pin 1 on the flash chip
===  back (palmrest) on your X200 ===
This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.
Here is a photo of the SOIC-16 flash chip. Pins are labelled:

				The following shows how to connect the clip to the BBB	(on the P9 header), for SOIC-8 (clip: Pomona 5250):

POMONA 5250 (correlate with the BBB guide)
===  left side of the X200 (where the VGA port is) ====
 18              -       - 1
 22              -       - NC
 NC              -       - 21
 3.3V (PSU)      -       - 17 - this is pin 1 on the flash chip. in front of it is the screen.
===  right side of the X200 (where the audio jacks are) ===
This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.
Here is a photo of the SOIC-8 flash chip. The pins are labelled:

Look at the pads in that photo, on the left and right. Those are for SOIC-16. Would it be possible to remove the SOIC-8 and solder a SOIC-16
chip on those pins?

				On the X200S and X200 Tablet the flash chip is underneath the board, in a WSON package.
				The pinout is very much the same as a SOIC-8, except you need to solder (there are no clips available).

				The following image shows how this is done:

				In this image, a pin header was soldered onto the WSON. Another solution might be to de-solder the WSON-8 chip and put a SOIC-8 there instead.
				Check the list of SOIC-8 flash chips at ../hcl/gm45_remove_me.html#flashchips but
				do note that these are only 4MiB (32Mb) chips. The only X200 SPI chips with 8MiB capacity are SOIC-16. For 8MiB capacity in this case,
				the X201 SOIC-8 flash chip (Macronix 25L6445E) might work.

				The procedure

					This section is for the X200. This does not apply to the X200S or X200 Tablet
					(for those systems, you have to remove the motherboard completely, since
					the flash chip is on the other side of the board).

					Remove these screws:

					Push the keyboard forward, gently, then lift it off and
					disconnect it from the board:

					Pull the palm rest off, lifting from the left and right side at the back of the
					palm rest:

					Lift back the tape that covers a part of the flash chip, and
					then connect the clip:

					On pin 2 of the BBB, where you have the ground (GND), connect the
					ground to your PSU:

					Connect the 3.3V supply from your PSU to the flash chip (via
					the clip):

					Of course, make sure that your PSU is also plugged in and
					turn on:

					This tutorial tells you to use an ATX PSU, for the 3.3V DC
					supply. The PSU used when taking these photos is actually
					not an ATX PSU, but a PSU that is designed specifically
					for providing 3.3V DC (an ATX PSU will also work):

					Now, you should be ready to install libreboot.

					Flashrom binaries for ARM (tested on a BBB) are distributed in libreboot_util. Alternatively,
					libreboot also distributes flashrom source code which can be built.

					Log in as root on your BBB, using the instructions in
					bbb_setup.html#bbb_access.

					Test that flashrom works:

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512

					In this case, the output was:

flashrom v0.9.7-r1854 on Linux 3.8.13-bone47 (armv7l)
flashrom is free software, get the source code at http://www.flashrom.org
Calibrating delay loop... OK.
Found Macronix flash chip "MX25L6405(D)" (8192 kB, SPI) on linux_spi.
Found Macronix flash chip "MX25L6406E/MX25L6436E" (8192 kB, SPI) on linux_spi.
Found Macronix flash chip "MX25L6445E/MX25L6473E" (8192 kB, SPI) on linux_spi.
Multiple flash chip definitions match the detected chip(s): "MX25L6405(D)", "MX25L6406E/MX25L6436E", "MX25L6445E/MX25L6473E"
Please specify which chip definition to use with the -c <chipname> option.

					How to backup factory.rom (change the -c option as neeed, for your flash chip):

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory.rom

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory1.rom

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -r factory2.rom

					Note: the -c option is not required in libreboot's patched flashrom, because
					the redundant flash chip definitions in flashchips.c have been removed.

					Now compare the 3 images:

					# sha512sum factory*.rom

					If the hashes match, then just copy one of them (the factory.rom) to a safe place (on a drive connected to another system, not
					the BBB). This is useful for reverse engineering work, if there is a desirable behaviour in the original firmware
					that could be replicated in coreboot and libreboot.

					Follow the instructions at ../hcl/gm45_remove_me.html#ich9gen
					to change the MAC address inside the libreboot ROM image, before flashing it.
					Although there is a default MAC address inside the ROM image, this is not what you want. Make sure
					to always change the MAC address to one that is correct for your system.

					Now flash it:

					# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -w path/to/libreboot/rom/image.rom -V

					You might see errors, but if it says Verifying flash... VERIFIED at the end, then it's flashed and should boot.
					If you see errors, try again (and again, and again); the message Chip content is identical to the requested image
					is also an indication of a successful installation.

					Example output from running the command (see above):

flashrom v0.9.7-r1854 on Linux 3.8.13-bone47 (armv7l)
flashrom is free software, get the source code at http://www.flashrom.org
Calibrating delay loop... OK.
Found Macronix flash chip "MX25L6405(D)" (8192 kB, SPI) on linux_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... FAILED at 0x00001000! Expected=0xff, Found=0x00, failed byte count from 0x00000000-0x0000ffff: 0xd716
ERASE FAILED!
Reading current flash chip contents... done. Looking for another erase function.
Erase/write done.
Verifying flash... VERIFIED.

				Back to top of page.

Wifi

				The X200 typically comes with an Intel wifi chipset, which does not
				work without proprietary software. For a list of wifi chipsets that
				work without proprietary software, see
				../hcl/index.html#recommended_wifi.

				Some X200 laptops come with an Atheros chipset, but this is 802.11g only.

				It is recommended that you install a new wifi chipset. This can only
				be done after installing libreboot, because the original firmware has
				a whitelist of approved chips, and it will refuse to boot if you
				use an 'unauthorized' wifi card.

				The following photos show an Atheros AR5B95 being installed, to
				replace the Intel chip that this X200 came with:

WWAN

				If you have a WWAN/3G card and/or sim card reader, remove them permanently.
				The WWAN-3G card has proprietary firmware inside; the technology is
				identical to what is used in mobile phones, so it can also track your movements.

				Not to be confused with wifi (wifi is fine).

Memory

				You need DDR3 SODIMM PC3-8500 RAM installed, in matching pairs
				(speed/size). Non-matching pairs won't work. You can also install a
				single module (meaning, one of the slots will be empty) in slot 0.

				Make sure that the RAM you buy is the 2Rx8 density.

				In this photo, 8GiB of RAM (2x4GiB) is installed:

				Boot it!

				You should see something like this:

				Now install GNU/Linux.

				X200S and X200 Tablet users: GPIO33 trick will not work.

					sgsit found out about a pin called GPIO33, which can be grounded to disable the flashing protections
					by the descriptor and stop the ME from starting (which itself interferes with flashing attempts).
					The theory was proven correct; however, it is still useless in practise.

					Look just above the 7 in TP37 (that's GPIO33):

					By default we would see this in lenovobios, when trying flashrom -p internal -w rom.rom:

FREG0: Warning: Flash Descriptor region (0x00000000-0x00000fff) is read-only.
FREG2: Warning: Management Engine region (0x00001000-0x005f5fff) is locked.

					With GPIO33 grounded during boot, this disabled the flash protections as set
					by descriptor, and stopped the ME from starting. The output changed to:

The Flash Descriptor Override Strap-Pin is set. Restrictions implied by
the Master Section of the flash descriptor are NOT in effect. Please note
that Protected Range (PR) restrictions still apply.

					The part in bold is what got us. This was still observed:

PR0: Warning: 0x007e0000-0x01ffffff is read-only.
PR4: Warning: 0x005f8000-0x005fffff is locked.

					It is actually possible to disable these protections. Lenovobios does,
					when updating the BIOS (proprietary one). One possible way to go about this
					would be to debug the BIOS update utility from Lenovo, to find out
					how it's disabling these protections. Some more research is available here:
					http://www.coreboot.org/Board:lenovo/x200/internal_flashing_research

					On a related note, libreboot has a utility that could help with investigating this:
					../hcl/gm45_remove_me.html#demefactory

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>ThinkPad X60: Recovery guide</title>

ThinkPad X60: Recovery guide

This section documents how to recover from a bad flash that prevents your ThinkPad X60 from booting.

Back to previous index

Table of Contents

					Types of brick:

Brick type 1: bucts not reset

Brick type 2: bad rom (or user error), system won't boot

Brick type 1: bucts not reset.

				You still have Lenovo BIOS, or you had libreboot running and you flashed another ROM; and you had bucts 1 set and
				the ROM wasn't dd'd.* or if Lenovo BIOS was present and libreboot wasn't flashed.

				In this case, unbricking is easy: reset BUC.TS to 0 by removing that yellow cmos coin (it's a battery) and putting it back after a minute or two:

				*Those dd commands should be applied to all newly compiled X60 ROM images (the ROM images in libreboot binary archives already have this applied!):

				dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k

				dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump

				dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc

				(doing this makes the ROM suitable for use when flashing a system that still has Lenovo BIOS running,
				using those instructions: http://www.coreboot.org/Board:lenovo/x60/Installation.

bad rom (or user error), system won't boot

				In this scenario, you compiled a ROM that had an incorrect configuration, or there is an actual bug preventing your system from
				booting. Or, maybe, you set BUC.TS to 0 and shut down after first flash while Lenovo BIOS was running. In any case, your system is bricked and will not boot at all.

				"Unbricking" means flashing a known-good (working) ROM. The problem: you can't boot the system, making this difficult. In this situation, external hardware (see hardware requirements above) is needed which can flash the SPI chip (where libreboot resides).

				Remove those screws:

				Push the keyboard forward (carefully):

				Lift the keyboard up and disconnect it from the board:

				Grab the right-hand side of the chassis and force it off (gently) and pry up the rest of the chassis:

				You should now have this:

				Disconnect the wifi antenna cables, the modem cable and the speaker:

				Unroute the cables along their path, carefully lifting the tape that holds them in place. Then, disconnect the modem
				cable (other end) and power connection and unroute all the cables so that they dangle by the monitor hinge on the right-hand
				side:

				Disconnect the monitor from the motherboard, and unroute the grey antenna cable, carefully lifting the tape
				that holds it into place:

				Carefully lift the remaining tape and unroute the left antenna cable so that it is loose:

				Remove the screw that is highlighted (do NOT remove the other one; it holds part of the heatsink (other side) into place):

				Remove those screws:

				Carefully remove the plate, like so:

				Remove the SATA connector:

				Now remove the motherboard (gently) and cast the lcd/chassis aside:

				Lift back that tape and hold it with something. Highlighted is the SPI flash chip:

				Now wire up the BBB and the Pomona with your PSU.

				Refer to bbb_setup.html for how to setup
				the BBB for flashing.

				Note, the guide mentions a 3.3v DC PSU but you don't need this on the X60:
				if you don't have or don't want to use an external PSU, then make
				sure not to connect the 3.3v leads mentioned in the guide;
				instead, connect the AC adapter (the one that normally charges your
				battery) so that the board has power (but don't boot it up)

				Correlate the following with the BBB guide linked above:

POMONA 5250:
===  golden finger and wifi switch ====
 18              -       - 1
 22              -       - NC                    ---------- audio jacks are on this end
 NC              -       - 21
 3.3V (PSU)      -       - 17 - this is pin 1 on the flash chip
===  CPU fan ===
This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.

				Connecting the BBB and pomona (in this image, an external 3.3v DC PSU was used):

				Flashrom binaries for ARM (tested on a BBB) are distributed in libreboot_util. Alternatively,
				libreboot also distributes flashrom source code which can be built.

				SSH'd into the BBB:

				# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -w yourrom.rom

				It should be Verifying flash... VERIFIED at the end. If flashrom complains about multiple flash chip
				definitions detected, then choose one of them following the instructions in the output.

				Remove the programmer and put it away somewhere. Put back the tape and press firmly over it:

				Your empty chassis:

				Put the motherboard back in:

				Reconnect SATA:

				Put the plate back and re-insert those screws:

				Re-route that antenna cable around the fan and apply the tape:

				Route the cable here and then (not shown, due to error on my part) reconnect the monitor cable to the motherboard
				and re-insert the screws:

				Re-insert that screw:

				Route the black antenna cable like so:

				Tuck it in neatly like so:

				Route the modem cable like so:

				Connect modem cable to board and tuck it in neatly like so:

				Route the power connection and connect it to the board like so:

				Route the antenna and modem cables neatly like so:

				Connect the wifi antenna cables. At the start of the tutorial, this system had an Intel wifi chip. Here you see I've replaced it with an
				Atheros AR5B95 (supports 802.11n and can be used without blobs):

				Connect the modem cable:

				Connect the speaker:

				You should now have this:

				Re-connect the upper chassis:

				Re-connect the keyboard:

				Re-insert the screws that you removed earlier:

				Power on!

				Trisquel live USB menu (using the GRUB ISOLINUX parser):

				Trisquel live desktop:

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
From 34270811fce1ecf0bcf3b1363b0dc3dbf284ab09 Mon Sep 17 00:00:00 2001
From: Francis Rowe <info@gluglug.org.uk>
Date: Wed, 10 Jun 2015 22:53:28 +0000
Subject: flash script: fix a really really really dumb mistake

---
diff --git a/flash b/flash
index c96b915..04fd274 100755
--- a/flash
+++ b/flash
@@ -95,12 +95,12 @@ if [ "$mode" = "i945lenovo_firstflash" ] || [ "$mode" = "i945lenovo_secondflash"
 		# git or libreboot_src
 		bucts="./bucts/bucts"
 		flashrom_lenovobios_sst="./flashrom/flashrom_lenovobios_sst"
-		flashrom_lenovobios_macronix="./flashrom/flashrom_lenovobios_sst"
+		flashrom_lenovobios_macronix="./flashrom/flashrom_lenovobios_macronix"
 	else
 		# libreboot_util
 		bucts="./bucts/$arch/bucts"
 		flashrom_lenovobios_sst="./flashrom/$arch/flashrom_lenovobios_sst"
-		flashrom_lenovobios_macronix="./flashrom/$arch/flashrom_lenovobios_sst"
+		flashrom_lenovobios_macronix="./flashrom/$arch/flashrom_lenovobios_macronix"
 	fi

 	# anti-bricking precaution
--
cgit v0.9.0.2


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>ThinkPad X60 Tablet: Recovery guide</title>

ThinkPad X60 Tablet: Recovery guide

This section documents how to recover from a bad flash that prevents your ThinkPad X60 Tablet from booting.

Back to previous index

Table of Contents

					Types of brick:

Brick type 1: bucts not reset

Brick type 2: bad rom (or user error), system won't boot

Brick type 1: bucts not reset.

				You still have Lenovo BIOS, or you had libreboot running and you flashed another ROM; and you had bucts 1 set and
				the ROM wasn't dd'd.* or if Lenovo BIOS was present and libreboot wasn't flashed.

				In this case, unbricking is easy: reset BUC.TS to 0 by removing that yellow cmos coin (it's a battery) and putting it back after a minute or two:

				*Those dd commands should be applied to all newly compiled X60 ROM images (the ROM images in libreboot binary archives already have this applied!):

				dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k

				dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump

				dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc

				(doing this makes the ROM suitable for use when flashing a system that still has Lenovo BIOS running,
				using those instructions: http://www.coreboot.org/Board:lenovo/x60/Installation.

bad rom (or user error), system won't boot

				In this scenario, you compiled a ROM that had an incorrect configuration, or there is an actual bug preventing your system from
				booting. Or, maybe, you set BUC.TS to 0 and shut down after first flash while Lenovo BIOS was running. In any case, your system is bricked and will not boot at all.

				"Unbricking" means flashing a known-good (working) ROM. The problem: you can't boot the system, making this difficult. In this situation, external hardware (see hardware requirements above) is needed which can flash the SPI chip (where libreboot resides).

				Remove those screws:

				Remove the HDD:

				Push keyboard forward to loosen it:

				Lift:

				Remove those:

				Also remove that (marked) and unroute the antenna cables:

				For some X60T laptops, you have to unroute those too:

				Remove the LCD extend board screws. Also remove those screws (see blue marks) and remove/unroute the cables and remove the metal plate:

				Remove that screw and then remove the board:

				Now wire up the BBB and the Pomona with your PSU.

				Refer to bbb_setup.html for how to setup
				the BBB for flashing.

				Note, the guide mentions a 3.3v DC PSU but you don't need this on the X60 Tablet:
				if you don't have or don't want to use an external PSU, then make
				sure not to connect the 3.3v leads mentioned in the guide;
				instead, connect the AC adapter (the one that normally charges your
				battery) so that the board has power (but don't boot it up)

				Correlate the following with the BBB guide linked above:

POMONA 5250:
===  golden finger and wifi switch ====
 18              -       - 1
 22              -       - NC                    ---------- audio jacks are on this end
 NC              -       - 21
 3.3V (PSU)      -       - 17 - this is pin 1 on the flash chip
===  CPU fan ===
This is how you will connect. Numbers refer to pin numbers on the BBB, on the plugs near the DC jack.

				Connecting the BBB and pomona (in this image, an external 3.3v DC PSU was used):

				Flashrom binaries for ARM (tested on a BBB) are distributed in libreboot_util. Alternatively,
				libreboot also distributes flashrom source code which can be built.

				SSH'd into the BBB:

				# ./flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=512 -w yourrom.rom

				It should be Verifying flash... VERIFIED at the end. If flashrom complains about multiple flash chip
				definitions detected, then choose one of them following the instructions in the output.

				Reverse the steps to re-assemble your system.

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>Maintaining libreboot</title>

Maintaining libreboot

				This section relates to maintaining libreboot.

				Do not follow anything here to the letter; is it only a rough guide
				representing how libreboot is maintained (for reference).

				This section of the documentation applies mainly to the
				development version of libreboot, which is hosted in a git
				repository. It is not intended for the release versions of
				libreboot.

Overview

					Updating coreboot-libre

Adding a new board to libreboot

Add/remove/modify patches in coreboot-libre

					Updating GRUB

Change how the GRUB payload (grub.elf) is built (utility: grub-assemble)

Modify the configuration used in GRUB

Other maintenance-related tasks in GRUB

					Updating flashrom

					Updating bucts

					Updating MemTest86+

				Or Back to main index.

Overview

				The way the libreboot project is run is very similar to how
				a GNU/Linux distribution project is run (but for the boot
				firmware, not your operating system). Thus, libreboot is
				a coreboot distribution.

				This page demonstrates on a high level how
				libreboot is maintained, how the project is run, how everything
				goes together, etc. For a more detailed guide, refer to each
				subsection for the various components/modules used in libreboot.

				Back to top of page.

Updating coreboot-libre

				NOTE: it helps to own all libreboot-compatible systems here,
				or have reliable (and fast) access to a team of testers.

				Coreboot-libre is the name of the deblobbed coreboot sources
				used in libreboot. It is also the name of the collection
				of scripts used for deblobbing coreboot, on each new update.

				This section shows an example of how to update (re-base) to
				the latest version of coreboot, how to update the deblobbing
				scripts, and so on. This does not teach you how to
				change what custom patches are used, nor does it tell
				you how to add new boards to libreboot. It assumes that you
				simply want to re-base to the latest version (for instance,
				there could be bug fixes that you want). For those things
				not listed in this section, you can refer to other sections
				on this page instead.

				Open these files in your editor (you will most likely be editing them):

resources/scripts/helpers/download/coreboot

resources/scripts/helpers/build/module/coreboot

resources/utilities/coreboot-libre/deblob

resources/utilities/coreboot-libre/nonblobs

resources/utilities/coreboot-libre/nonblobs_notes

resources/scripts/helpers/build/roms/helper

resources/scripts/helpers/build/roms/withgrub

				If you already had a coreboot/ directory in your libreboot
				tree, delete it:

				$ rm -Rf coreboot/

				Firstly, download coreboot. Do not use ./download coreboot
				for this, just clone coreboot, as it does in that script, like so:

				$ git clone http://review.coreboot.org/coreboot

				$ cd coreboot/

				Get the ID of the latest commit in this clone, by reading the commit ID using
				e.g.:

				$ git log

				In resources/scripts/helpers/download/coreboot you will
				find a line that says git reset --hard and then
				a commit ID next to it. Replace this with the commit ID of the latest
				commit from the coreboot version that you just downloaded.

				Delete the .git* resources. For example:

				$ rm -Rf .git*

				...this is to avoid the deblobbing script from picking up files
				in there as blobs, which would be only false positives and
				increase the amount of time taken. Now come out of coreboot:

				$ cd ../

				Check all coreboot file names/paths in deblob; if any
				of them no longer exist at that name/path in the coreboot tree that you downloaded,
				delete the reference(s) in deblob.

				Check all coreboot file names/paths in nonblobs; if
				any of them no longer exist at that name/path in the coreboot tree that you downloaded,
				delete the reference in nonblobs.

				Now, back in the main root directory of libreboot (git repository),
				run the deblob script. This is to prevent the findblobs
				scripts from finding the blobs that are already deleted
				when running the deblob script. Like so:

				$ ./resources/utilities/coreboot-libre/deblob

				Now search for new blobs:

				$ cd resources/utilities/coreboot-libre/

				$ ./findblobs

				WARNING: this will take a *long* time. Be patient!
				What this will do is look through the coreboot source directory,
				looking for blobs. It will not find the blobs that you deleted
				before (because they no longer exist), and it will ignore any
				files listed in nonblobs.

				Once the findblobs script has finished, check the file
				tocheck (from the root, this will be resources/utilities/coreboot-libre/tocheck).
				These are the files detected as blobs; some might be blobs, some not.
				The findblobs script doesn't know how to determine between blobs
				and non-blobs, it only knows patterns. Distinguishing between blobs and
				non-blobs must be performed by you, the human being.

						Files in tocheck that you identify as blobs,
						should be added appropriately to resources/utilities/coreboot-libre/deblob

						Files in tocheck that you identify as non-blobs,
						should be added appropriately to resources/utilities/coreboot-libre/nonblobs -
						also, if you feel it necessary, add an explanation of it in
						resources/utilities/coreboot-libre/nonblobs_notes

				Now come back to the main libreboot root directory (root
				of the git clone). If you are still in resources/utilities/coreboot-libre/
				for instance, you would do something like:

				$ cd ../../../

				Now delete the coreboot directory:

				$ rm -Rf coreboot/

				Download coreboot again, only this time, using the download
				script. The download script also applies custom patches
				to coreboot (see resources/scripts/helpers/download/coreboot);
				if they do not apply anymore, you will have to re-base them
				and then update resources/scripts/helpers/download/coreboot
				accordingly. Anyway, download coreboot like so:

				$ ./download coreboot

				If the custom patches no longer apply, and you have to re-base
				(or replace?) some patches, please do this in coreboot upstream,
				not in libreboot. Then re-include new patches from upstream,
				into libreboot. Here is coreboot's guide for contributing
				patches:

				http://www.coreboot.org/Git.

				Update all configs:

				$ ./build config corebootupdate

				This simply takes all of the coreboot .config files from
				resources/libreboot/config/ and does make oldconfig
				on them. It usually works. If it doesn't, you'll need to recreate
				those configs from scratch using ./build config corebootreplace (optionally
				add a config name), or ./build config corebootmodify (ditto)
				(see ../git/index.html#config)

				Finally, build *all* ROM images using the instructions at
				../git/index.html, to verify
				that everything still builds.

				Once you've verified that building isn't broken, test *all*
				boards (you don't need to test all ROM images, only one
				vesafb and one txtmode image for each configuration). If you
				do not have all systems supported in libreboot, then you will
				need to get other testers for those boards.

				If you have established a build issue, or a board no longer
				works (booting issues, bugs during/after boot, etc), you'll
				need to fix it upstream:
				http://www.coreboot.org/Git
				and then re-update coreboot (or apply patches from upstream).

				You should also test the resulting ROM images from building
				with the new or modified coreboot revision.

				Back to top of page.

Adding a new board to libreboot

				Make sure that the board is supported, and that the patches
				are included (if there are custom patches that you need).
				Add configs for it like so:

				$ ./build config corebootreplace payload/boardname

				This can also be used for replacing an existing config.

				Configure the board. Make sure to add the steps to the config section
				in ../git/index.html.

				When you're done, the config will be stored in resources/libreboot/config/.
				Now build-test it and then check that it actually works.

				The following scripts may also need to be modified before building:
				resources/scripts/helpers/build/roms/withgrub and
				resources/scripts/helpers/build/roms/helper

				The following can be used when updating coreboot-libre:

				$ ./build config corebootupdate (adding a board name on the end is optional)

				The following can be used if you want to modify an existing
				configuration:

				$ ./build config corebootmodify (adding a board name on the end is optional)

				Examples (GRUB payload):

				$ ./build config corebootmodify x60

				$ ./build config corebootreplace x60

				$ ./build config corebootupdate x60

				$ ./build config corebootmodify kfsn4-dre

				$ ./build config corebootreplace kfsn4-dre

				$ ./build config corebootupdate kfsn4-dre

				Back to top of page.

Add/remove/modify patches in coreboot-libre

				Under resources/scripts/helpers/download/coreboot you can find
				the instructions used for patching coreboot.

				Modify the commit ID on the git reset --hard line accordingly,
				and update the list of patches used accordingly. Do not cherry-pick
				from review.coreboot.org directly; instead, include the diff in
				resources/libreboot/patch/ and use git am
				(you can get the diff by using git-format-patch).

				When you're done, simply download coreboot again:

				$ ./download coreboot

				Finally, re-build the parts from coreboot that are used
				by the build system:

				$ ./build module coreboot

				You also need to build crossgcc:

				$ cd coreboot/

				$ make crossgcc-i386

				$ cd ../

				Instead of running the above command, you can save time
				by copying out the crossgcc that you compiled before
				(from coreboot/util/crossgcc/) and then putting it back.
				After you've done that, run everything in
				resources/scripts/helpers/build/module/coreboot
				except for the part that builds GCC.

				You should also test the resulting ROM images from building
				with the new or modified coreboot revision.

				Back to top of page.

Updating GRUB

				$ rm -Rf grub/

				$ git clone git://git.savannah.gnu.org/grub.git

				$ cd grub/

				$ git log

				Open the file resources/scripts/helpers/download/grub and
				replace the commit ID on the line that performs git reset --hard
				with the commit ID of the GRUB revision that you just downloaded.

				$ cd ../

				$ ./download grub

				If it fails because of merge conflicts, you'll need to re-base
				or (as appropriate) remove the offending patch(es) in
				resources/scripts/helpers/download/grub.

				Finally, verify that it will build:

				$ ./build module grub

				Since GRUB is the payload in libreboot, you should also
				build the ROM images and test them, with this different
				GRUB version that you have prepared.

				Back to top of page.

Change how the GRUB payload (grub.elf) is built (utility: grub-assemble)

				Look in resources/utilities/grub-assemble/.

				gen.sh creates ELF executables of GRUB with different configurations:
				text-mode or framebuffer mode in coreboot. Essentially,
				the text-mode version has no background nor any custom fonts,
				and contains MemTest86+. You probably don't need to modify these
				files at all.

				modules.conf defines which modules will be included in the GRUB
				ELF executable.

				Since GRUB is the payload in libreboot, you should also
				build the ROM images and test them, with this different
				GRUB version that you have prepared.

				Back to top of page.

Modify the configuration used in GRUB

				Look in resources/scripts/helpers/build/roms/withgrub to
				see how the GRUB configuration files are generated.

				You might need to modify this. You can also modify the
				default configuration by making changes to the files
				under resources/grub/config/

				Since GRUB is the payload in libreboot, you should also
				build the ROM images and test them, with this different
				GRUB version that you have prepared.

				Back to top of page.

Updating flashrom

				Modify these files: resources/scripts/helpers/download/flashrom
				and resources/scripts/helpers/build/module/flashrom.

				Patches are in resources/flashrom/patch/

				Back to top of page.

Updating bucts

				bucts doesn't really need updating, but the patches are
				in resources/bucts/patch, the download script
				is resources/scripts/helpers/download/bucts and
				the build script is resources/scripts/helpers/build/module/bucts.

				Back to top of page.

Updating MemTest86+

				MemTest86+ doesn't really need updating, but the patches are
				in resources/memtest86plus/patch, the download script
				is resources/scripts/helpers/download/memtest86plus and
				the build script is resources/scripts/helpers/build/module/memtest86plus.

				In the download script for memtest86plus, make sure to update the checksum that it matches
				for the downloaded source tarball.

				Back to top of page.

			Copyright ©  2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>Miscellaneous</title>

Miscellaneous

				Or Back to main index.

High Pitched Whining Noise on Idle (how to remove in Trisquel 7)

High Pitched Whining Noise on Idle (how to remove in Parabola)

X60/T60: Serial port - how to use (for dock owners)

Power Management Beeps on Thinkpads

Using diff and patch

Get EDID: Find out the name (model) of your LCD panel

High Pitched Whining Noise on Idle (how to remove in Trisquel 7)

Start powertop automatically at boot time

Included with libreboot is a script called 'powertop.trisquel7'. Run this as root and it will setup powertop to run with --auto-tune
					at boot time. Load the file in your text editor to see how it does that.

$ sudo ./resources/scripts/misc/powertop.trisquel7

Back to top of page

High Pitched Whining Noise on Idle (how to remove in Parabola)

The following removes most of the noise. It reduces what is a high frequency whine
			(that not everyone can hear) to a slight buzz (which most people can't hear or doesn't bother most people).

This is not perfect! The full solution is still not discovered but this is a step towards that.
			Also, in some instances you will need to run 'sudo powertop --auto-tune' again.
			This needs to be implemented properly in coreboot itself!

On the X60 with coreboot or libreboot, there is a high pitched sound when idle.
			So far we have use processor.max_cstate=2 or idle=halt in GRUB.
			These consume power. Stop using them!

Be root

			$ su -

Installed powertop:

			# pacman -S powertop

and added the following to /etc/systemd/system/powertop.service :

[Unit]
Description=Powertop tunings

[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/powertop --auto-tune
# "powertop --auto-tune" still needs a terminal for some reason. Possibly a bug?
Environment="TERM=xterm"

[Install]
WantedBy=multi-user.target

Finally, as root do that:

			# systemctl enable powertop

			# systemctl start powertop

The next time you boot the system, the buzz will be gone.

Back to top of page

X60/T60: Serial port - how to use (for dock owners)

				For the Thinkpad X60 you can use the "UltraBase X6" dock (for the X60 Tablet it is called
				X6 Tablet UltraBase). For the ThinkPad T60,
				you can use the "Advanced Mini Dock".

				If you are using one of the ROM images with 'serial' in the name, then you have serial port enabled in libreboot
				and you have memtest86+ included inside the ROM. Connect your null modem cable to the serial port on the dock
				and connect the other end to a 2nd system using your USB Serial adapter.

				On the 2nd system, you can try this (using GNU Screen):

				$ sudo screen /dev/ttyUSB0 115200

				How to quit GNU Screen: Ctrl+A then release and press K, and then press Y.

There are also others like Minicom but I like GNU Screen

				By doing this before booting the X60/T60, you will see console output from libreboot. You will also see
				GRUB displaying on the serial output, and you will be able to see MemTest86+ on the serial output aswell.
				You can also configure your distro so that a terminal (TTY) is accessible from the serial console.

				The following guide is for Ubuntu, and can be followed for Trisquel 6.0 which is based on Ubuntu 12.04
				(should also work in Trisquel 7, based on Ubuntu 14.04) to enable a serial console using GeTTY:

				https://help.ubuntu.com/community/SerialConsoleHowto

				Note: part of the tutorial above requires changing your grub.cfg. Just change the linux line to add instructions for enabling getty.
				See ../gnulinux/grub_cbfs.html.

Back to top of page

Power Management Beeps on Thinkpads

				When disconnecting or connecting the charger, a beep occurs.
				When the battery goes to a critically low charge level,
				a beep occurs. Nvramtool is included in libreboot, and can
				be used to enable or disable this behaviour.

				Disable or enable beeps when removing/adding the charger:

				$ sudo ./nvramtool -w power_management_beeps=Enable

				$ sudo ./nvramtool -w power_management_beeps=Disable

				Disable or enable beeps when battery is low:

				$ sudo ./nvramtool -w low_battery_beep=Enable

				$ sudo ./nvramtool -w low_battery_beep=Disable

				A reboot is required, for these changes to take effect.

Get EDID: Find out the name (model) of your LCD panel

				Get the panel name with sudo get-edid | strings

				Or look in /sys/class/drm/card0-LVDS-1/edid

				Alternatively you can use i2cdump. In Trisquel, this is in the package i2c-tools.

				$ sudo modprobe i2c-dev

				$ sudo i2cdump -y 5 0x50 (you might have to change the value for -y)

				$ sudo rmmod i2c-dev

				You'll see the panel name in the output (from the EDID dump).

				If neither of these options work (or they are unavailable), physically removing the LCD panel is an option.
				Usually, there will be information printed on the back.

Back to top of page.

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>
		Libreboot documentation: using diff and patch
	</title>

Diff and patch

This is just a quick guide for reference, use 'man' to know more.

				Back to index

			Apply a patch

				To apply a patch to a single file, do that in it's directory:

				$ patch < foo.patch

				Assuming that the patch is distributed in unified format identifying
				the file the patch should be applied to, the above will work. Otherwise:

				$ patch foo.txt < bar.patch

				You can apply a patch to an entire directory, but note the "p level".
				What this means is that inside patch files will be the files that you
				intend to patch, identified by path names that might be different
				when the files ane located on your own computer instead of on the computer
				where the patch was created. 'p' level instructs the 'patch' utility to
				ignore parts of the path name to identify the files correctly. Usually a
				p level of 1 will work, so you would use:

				$ patch -p1 < baz.patch

				Change to the top level directory before running this. If a patch level
				of 1 cannot identify the files to patch, then inspect the patch file for file names.
				For example:

				/home/user/do/not/panic/yet.c

				and you are working in a directory that contains panic/yet.c, use:

				$ patch -p5 < baz.patch

				You usually count one up for each path separator (forward slash)
				removed from the beginning of the path, until you are left with a path
				that exists in the current working directory. The count is the p level.

				Removing a patch using the -R flag

				$ patch -p5 -R < baz.patch

Back to top of page.

			Create a patch with diff

				Diff can create a patch for a single file:

				$ diff -u original.c new.c > original.patch

				For diff'ing a source tree:

				$ cp -R original new

				Do whatever you want in new/ and then diff it:

				$ diff -rupN original/ new/ > original.patch

Back to top of page.

			git diff

				git is something special.

				Note: this won't show new files created.

				Just make whatever changes you want to a git clone and then:

				$ git diff > patch.git

				Note the git revision that you did this with:

				$ git log

				Alternatively (better yet), commit your changes and then use:

				$ git format-patch -N

				Replace N with the number of commits that you want to show.

Back to top of page.

			git apply

it really is.

				Now to apply that patch in the future, just git clone it again and do
				with the git revision you found from above:

				$ git reset --hard REVISIONNUMBER

				Now put patch.git in the git clone directory and do:

				$ git apply patch.git

				If you use a patch from git format-patch, then use git am patch.git instead of git apply patch.git. git-am
				will re-create the commits aswell, instead of just applying the patch.

Back to top of page.

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>Libreboot release information</title>

Libreboot release information

				Updated versions of libreboot can be found at libreboot.org.

Old releases

				See archive_old.html for information about older libreboot releases.

Release YYYYMMDD

				Release date: Day Month Year.

					Installation instructions can be found at docs/install/index.html.
					Building instructions (for source code) can be found at docs/git/index.html#build.

Machines supported in this release:

						ASUS KFSN4-DRE server board

PCB revision 1.05G is the best version (can use 6-core CPUs)

Check notes in docs/hcl/kfsn4-dre.html

NOTE: not in libreboot 20150518. Only in git, for now.

						ThinkPad X60/X60s

								You can also remove the motherboard from an X61/X61s and replace it with an X60/X60s motherboard.
								An X60 Tablet motherboard will also fit inside an X60/X60s.

						ThinkPad X60 Tablet (1024x768 and 1400x1050) with digitizer support

See docs/hcl/index.html#supported_x60t_list for list of supported LCD panels

It is unknown whether an X61 Tablet can have it's mainboard replaced with an X60 Tablet motherboard.

						ThinkPad T60 (Intel GPU) (there are issues; see below):

See notes below for exceptions, and docs/hcl/index.html#supported_t60_list for known working LCD panels.

It is unknown whether a T61 can have it's mainboard replaced with a T60 motherboard.

See docs/future/index.html#t60_cpu_microcode.

T60P (and T60 laptops with ATI GPU) will likely never be supported: docs/hcl/index.html#t60_ati_intel

						ThinkPad X200

X200S and X200 Tablet are also supported, conditionally; see docs/hcl/x200.html#x200s

ME/AMT: libreboot removes this, permanently. docs/hcl/gm45_remove_me.html

						ThinkPad R400

See docs/hcl/r400.html

ME/AMT: libreboot removes this, permanently. docs/hcl/gm45_remove_me.html

						ThinkPad R500

See docs/hcl/r500.html

ME/AMT: libreboot removes this, permanently. docs/hcl/gm45_remove_me.html

NOTE: not in libreboot 20150518. Only in git, for now.

						ThinkPad T400

See docs/hcl/t400.html

ME/AMT: libreboot removes this, permanently. docs/hcl/gm45_remove_me.html

						ThinkPad T500

See docs/hcl/t500.html

ME/AMT: libreboot removes this, permanently. docs/hcl/gm45_remove_me.html

						Apple MacBook1,1 (MA255LL/A, MA254LL/A, MA472LL/A)

See docs/hcl/index.html#macbook11.

						Apple MacBook2,1 (MA699LL/A, MA701LL/A, MB061LL/A, MA700LL/A, MB063LL/A, MB062LL/A)

See docs/hcl/index.html#macbook21.

				Changes for this release, relative to r20150518 (earliest changes last, recent changes first)

Changelog not yet generated. Clone the git repository and check the git logs

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>Notes about DMA and the docking station (X60/T60)</title>

Notes about DMA and the docking station (X60/T60)

Use case:
---------
Usually when people do full disk encryption, it's not really full disk,
instead they still have a /boot in clear.

So an evil maid attack can still be done, in two passes:
1) Clone the hdd, Infect the initramfs or the kernel.
2) Wait for the user to enter its password, recover the password,
luksOpen the hdd image.

I wanted a real full-disk encryption so I've put grub in flash and I
have the following: The HDD has a LUKS rootfs(containing /boot) on an
lvm partition, so no partition is in clear.

So when the computer boots it executes coreboot, then grub as a payload.
Grub then opens the LUKS partition and loads the kernel and initramfs
from there.

To prevent hardware level tempering(like reflashing), I used nail
polish with a lot of gilder, that acts like a seal. Then a high
resolution picture of it is taken, to be able to tell the difference.

The problem:
------------
But then comes the docking port issue: Some LPC pins are exported
there, such as the CLKRUN and LDRQ#.

LDRQ# is "Encoded DMA/Bus Master Request": "Only needed by
peripherals that need DMA or bus mastering. Requires an
individual signal per peripheral. Peripherals may not share
an LDRQ# signal."

So now DMA access is possible trough the dock connector.
So I want to be able to turn that off.

If I got it right, the X60 has 2 superio, one is in the dock, and the
other one is in the laptop, so we have:
                            ________________
 _________________         |                |
|                 |        | Dock connector:|
|Dock: NSC pc87982|<--LPC--->D_LPC_DREQ0    |
|_________________|        |_______^________|
                                   |
                                   |
                                   |
                                   |
                ___________________|____
               |                   v    |
               | SuperIO:        DLDRQ# |
               | NSC pc87382     LDRQ#  |
               |___________________^____|
                                   |
                                   |
                                   |
                                   |
                ___________________|___
               |                   v   |
               | Southbridge:    LDRQ0 |
               | ICH7                  |
               |_______________________|

The code:
---------
Now if I look at the existing code, there is some superio drivers, like
pc87382 in src/superio/nsc, the code is very small.
The only interesting part is the pnp_info pnp_dev_info struct.

Now if I look inside src/mainboard/lenovo/x60 there is some more
complete dock driver:

Inside dock.c I see some dock_connect and dock_disconnect functions.

Such functions are called during the initialisation (romstage.c) and
from the X60 SMI handler (smihandler.c).

Questions:
----------
1) Would the following be sufficent to prevent DMA access from the
outside:
> int dock_connect(void)
> {
>          int timeout = 1000;
> +        int val;
> +
> +        if (get_option(&val, "dock") != CB_SUCCESS)
> +                val = 1;
> +        if (val == 0)
> +                return 0;
>          [...]
> }
>
> void dock_disconnect(void) {
> +        if (dock_present())
> +                return;
>          [...]
> }
2) Would an nvram option be ok for that? Should a Kconfig option be
added too?

> config DOCK_AUTODETECT
>         bool "Autodetect"
>         help
>           The dock is autodetected. If unsure select this option.
>
> config DOCK_DISABLED
>         bool "Disabled"
>         help
>           The dock is always disabled.
>
> config DOCK_NVRAM_ENABLE
>         bool "Nvram"
>         help
>           The dock autodetection is tried only if it is also enabled
> trough nvram.

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.


code:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

	<title>Security topics</title>

Security topics

				Or Back to main index.

ThinkPad X60/X60S: hardware security

ThinkPad T60: hardware security

			Copyright ©  2014, 2015 Francis Rowe <info@gluglug.org.uk>

			Permission is granted to copy, distribute and/or modify this document
			under the terms of the GNU Free Documentation License, Version 1.3
			or any later version published by the Free Software Foundation;
			with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
			A copy of the license can be found at ../gfdl-1.3.txt

			Updated versions of the license (when available) can be found at
			https://www.gnu.org/licenses/licenses.html

			UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
			EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
			AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
			ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
			IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
			WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
			PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
			ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
			KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
			ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

			TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
			TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
			NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
			INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
			COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
			USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
			ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
			DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
			IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

			The disclaimer of warranties and limitation of liability provided
			above shall be interpreted in a manner that, to the extent
			possible, most closely approximates an absolute disclaimer and
			waiver of all liability.