# Lenovo Thinkpad T520 doesn't boot with GPT slices on FreeBSD 9- BETA3



## Lothlorien (Oct 2, 2011)

Hi!

I've bought a brand new :e Lenovo Thinkpad T520 laptop and decided to install FreeBSD 9 Beta 3 following this guide (it's close to GPTZFSBoot wiki page, but considers an new installation layout on FreeBSD 9).

But when I rebooted the system, it simply doesn't boot (turns out to the BIOS boot menu). It's even doesn't boot with default FreeBSD 9 UFS-on-GPT installation scheme through bsdInstaller, but FreeBSD 9 UFS-on-MBR installation works.

I've tried to change BIOS Startup->UEFI/Legacy Boot from "Both" to "Legacy only" (AFAIK, FreeBSD doesn't support UEFI boot process), but there was no effect. I have latest BIOS (1.31) installed.

On the other thread there was a similar problem with Lenovo T420s laptop.

Is there any chance to get FreeBSD 9 working with gpt partition scheme on this laptop?


----------



## Crest (Oct 7, 2011)

I ran into the same problem with my T420. It sucks. The /boot/loader can't read from GPT formatted disks with a MBR partition type != 0xEE. I tried to use an invalid partition type to fool the UEFI. The FreeBSD kernel accepts this kludge. It is possible to boot from a UFS /boot on MBR+bsdlabel.


----------



## wblock@ (Oct 7, 2011)

Have you contacted Lenovo about this?  If enough people complain, maybe they'll issue a BIOS update.


----------



## Crest (Oct 7, 2011)

I have not. I found several threads in Linux distro specific forums and mailing lists on this issue suggesting Lenovo broke booting legacy operating systems from GPT formatted disks for everyone not just FreeBSD's /boot/gptzfsboot. One ugly workaround would be to patch /boot/loader into accepting PMBR's of invalid type (geom_part does). This prevents triggering the special case for GPT with valid PMBR in the UEFI. I'll look into it once I got acpi_ibm to work.

The acpi_ibm.ko module checks for IBM0068. Adding "LEN0068" to ibm_ids in sys/dev/acpi_support/acpi_ibm.c:293 allows the acpi_ibm module to attach but some features don't work (most important fan and brightness control). The read only fan speed valid but to high (i don't need my CPU to be cooled down to 40C). The brightness control with acpi_video (via sysctl) or function keys works on console, but results in one "CPU0: local APIC error 0x80" message per change. Brightness is not changeable while X.org (with nvidia blob version 280.13) controls the screen. I'm open to suggestions ;-).


----------



## Crest (Oct 7, 2011)

Adding this line to the device section in the xorg.conf enables brightness control in X.org with the nvidia blob on the T420.

```
Option "RegistryDwords" "EnableBrightnessControl=1"
```

Still each change triggers this message

```
CPU0: local APIC error 0x80
```


----------



## Lothlorien (Oct 8, 2011)

wblock@ said:
			
		

> Have you contacted Lenovo about this?  If enough people complain, maybe they'll issue a BIOS update.



Unfortunately they haven't an e-mail address for technical support, and the phone support knows nothing but Windows. 

I've wrote the same topic on Lenovo forums, but have no response from Lenovo officials.


----------



## Lothlorien (Oct 8, 2011)

Crest said:
			
		

> Adding this line to the device section in the xorg.conf enables brightness control in X.org with the nvidia blob on the T420.
> 
> ```
> Option "RegistryDwords" "EnableBrightnessControl=1"
> ```



Thanks. Well, I've also thought about adding "LEN0068" to ibm_ids too 



			
				Crest said:
			
		

> Still each change triggers this message
> 
> ```
> CPU0: local APIC error 0x80
> ```



I can confirm this on T520 too with 9.0-CURRENT. 8.2 doesn't show up such message.


----------



## Juh924 (Jan 17, 2012)

Hello,

Any news about this issue? I'm planning on buying a T420/420s but I'd like to know if the problem is solved or will be solved in the near future.

Thanks a lot,

PS: Just a quick question: Is there any other "big" problem with the T520 and FreeBSD?


----------



## T-Aoki (Jan 2, 2013)

Thanks to post [post=149737]#8[/post] in this thread by Crest, I could boot my ThinkPad T420 from GPT partition (9-STABLE). Details are in my web page with diffs. My modification in above page is "Quick and Dirty, minimum change to actual code", but "works for me".

Note that needed modifications are different before and after r243243, as described above page.

I guess the problem is in Lenovo UEFI BIOS, so modifying loader is quite ugly quirks. So I wonder these kind of quirks should be incorporated to base or not. At least, if genuine loader incorporated, 

Define an entry in /usr/src/sys/sys/diskmbr.h and use it.
/sbin/gpart should have support for managing GPT having non 0xEE ID.
are needed.

Probably, porting how GEOM does for detecting partition is best way, but I can't :x.


----------



## T-Aoki (Feb 24, 2013)

Recently, /usr/src/sys/boot/common/part.c was updated by r246938 (for Boot Camp support) in stable/9 branch.
FYI, I could confirm it does not affect my modification noted by my previous post.

But please beware, I've not tested multi boot environment. So modifying dummy partition ID of GPT slice can cause boot problem for other OS'es in multi boot environment!


----------



## T-Aoki (Mar 23, 2013)

For someone misunderstanding @Crest's post like me...



			
				Crest said:
			
		

> Adding this line to the device section in the xorg.conf enables brightness control in X.org with the nvidia blob on the T420.
> 
> ```
> Option "RegistryDwords" "EnableBrightnessControl=1"
> ```



Putting above-mentioned option in 
	
	



```
Section "Device"
```
 didn't work.

Putting the line in 
	
	



```
Section "Screen"
```
 according to hiren panchasara's post in freebsd-acpi ML worked fine for my ThinkPad T420.

But...



			
				Crest said:
			
		

> Still each change triggers this message
> 
> ```
> CPU0: local APIC error 0x80
> ```



above mentioned ACPI error keeps on emitting.


----------



## darcsis (Mar 31, 2013)

I've got a T430 and I've installed 9-PRERELEASE several times successfully using ZFS as root. Certainly it is ok to use GPT partition scheme.


----------

