FreeBSD 10.1 using UEFI

Posted on Fri 21 November 2014 in FreeBSD

This tutorial is about installing the latest stable FreeBSD 10.1 with UEFI and run a desktop with KDE with a NVIDIA video card.

Before Install

With my motherboard is does not work to boot UEFI if the CMS compatibly mode is turned off completely. Someone else second this problem with the same motherboard I am using. If you're facing a similar problem, please report it to the mailing list. https://lists.freebsd.org/pipermail/freebsd-stable/2014-November/081110.html

So even if you install using the UEFI image you maybe have to turn your UEFI/CMS mode to "both".

ZFS is not possible with UEFI. Keep in mind that this installation with UEFI forces you to use UFS up to now! The UEFI loader is not able to load the ZFS root partition up to now.

Install base system

The installation is quite straight forward. Just boot, select what you want and the target disk. Select UFS filesystem and go for it.

Setup pkg

If you want to go with the prebuild packages setup pkg by running the command and run pkg update.

Install Xorg, KDE and nvidia-drivers

I used the binary packages except for the nvidia-drivers. There is a conflict between some KDE packages and nvidia-drivers (https://forums.freebsd.org/threads/nvidia-driver-and-kde-4-on-10-1-release.48994/). You need to build the nvidia drivers without doc option and it will work to install everything correctly.

Install Xorg and KDE

pkg install xorg kde

Build kde4-workspace without  option

cd /usr/ports/x11/kde4-workspace
make config

snapshopt2

Disable the "OpenGL ES 2.0 support" here to not get some file conflicts between nvidia-drivers version of some files and the libEGL ones.

Configure system

Configure X

Here is my xorg.conf I created it useing "X -configure" and removed the duplicated parts and set the driver to nvidia

Section "ServerLayout"
 Identifier "X.org Configured"
 Screen 0 "Screen0" 0 0
 InputDevice "Mouse0" "CorePointer"
 InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
 ModulePath "/usr/local/lib/xorg/modules"
 FontPath "/usr/local/lib/X11/fonts/misc/"
 FontPath "/usr/local/lib/X11/fonts/TTF/"
 FontPath "/usr/local/lib/X11/fonts/OTF/"
 FontPath "/usr/local/lib/X11/fonts/Type1/"
 FontPath "/usr/local/lib/X11/fonts/100dpi/"
 FontPath "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
 Load "dbe"
 Load "dri"
 Load "dri2"
 Load "extmod"
 Load "record"
 Load "glx"
EndSection

Section "InputDevice"
 Identifier "Keyboard0"
 Driver "kbd"
EndSection

Section "InputDevice"
 Identifier "Mouse0"
 Driver "mouse"
 Option "Protocol" "auto"
 Option "Device" "/dev/sysmouse"
 Option "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
 Identifier "Monitor0"
 VendorName "Monitor Vendor"
 ModelName "Monitor Model"
EndSection


Section "Device"
 Identifier "Card0"
 Driver "nvidia"
 BusID "PCI:2:0:0"
EndSection


Section "Screen"
 Identifier "Screen0"
 Device "Card0"
 Monitor "Monitor0"
 SubSection "Display"
 Viewport 0 0
 Depth 1
 EndSubSection
 SubSection "Display"
 Viewport 0 0
 Depth 4
 EndSubSection
 SubSection "Display"
 Viewport 0 0
 Depth 8
 EndSubSection
 SubSection "Display"
 Viewport 0 0
 Depth 15
 EndSubSection
 SubSection "Display"
 Viewport 0 0
 Depth 16
 EndSubSection
 SubSection "Display"
 Viewport 0 0
 Depth 24
 EndSubSection
EndSection
Setting different keyboard layout than the default "qwerty" for KDM

I want to have a different keyboardlayout at login time with KDM and later in KDE. Changing it for KDE itself is not a big deal. Just open the system settings -> input devices and add the keyboard layout you want.

FreeBSD-change-keyboard-layout-KDE

To Change it in KDM at login time this was more a pain to find the correct configuration file. But here is how to do it. As root user open the file: /usr/local/share/config/kdm/Xsetup and add the following line:

setxkbmap -model pc105 -layout de

Of course replace the de with the layout you prefer!

For the record. Adding the hal policy as mentioned in other places on the web, did not work for KDM on my FreeBSD 10.1 STABLE system.

Configure rc.conf to load nvidia start dbus and hald and kdm

There is a problem loading the nvidia driver when you're using UEFI https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193770d

Because of this bug I added the load of nvidia driver into the rc.conf. I am not sure if this is the recommended way for the future but it works for me quite well.

This leads to the following additional lines for the rc.conf

dbus_enable="YES"
hald_enable="YES"
kld_list="nvidia"
kdm4_enable="YES"
linux_enable="YES"
Configure sysctl.conf for Chrome and set the correct Audio device for me
kern.ipc.shm_allow_removed=1
hw.snd.default_unit=8

Thats it. If I missed something just let me know.