VC4 complete Raspbian upgrade

Stefan Schake edited this page Jan 17, 2018 · 24 revisions

These are instructions for a complete replacement of the system's kernel, Mesa, and X Server on Raspbian Jessie (2016-05-27 desktop image) with upstream, for testing the current driver stack.

You do not need these instructions just to use the driver. Raspbian ships with the driver and it can be enabled with raspi-config. And if you want to just update the kernel, or Mesa, or the X Server, any of those should be individually installable without complete replacement.

First boot

Set your hostname and resize your partition, then:

sudo apt-get update
sudo apt-get dist-upgrade

sudo apt-get install ccache
export PATH=/usr/lib/ccache:$PATH

Building the kernel

git clone
cd linux

This will get you git master, which what is trending toward being the next released kernel. You may also want to test:

git remote add anholt
git fetch anholt
git checkout -b drm-vc4-fixes anholt/drm-vc4-fixes # The current set of VC4 fixes to be merged to the next kernel release
git checkout -b drm-vc4-next anholt/drm-vc4-next # The current set of VC4 changed to be merged to the kernel after the next release.


git remote add next git://
git fetch next
git checkout -b next next/master # All changes to be merged to the kernel after the next relese.

Next, do the build. Pick one of:

make bcm2835_defconfig # Raspberry Pi 0/1
make multi_v7_defconfig # Raspberry Pi 2

# kernel build deps
sudo apt-get install bc libncurses5-dev

# We need to enable "General setup" -> "Namespaces support" for systemd-hostnamed
make menuconfig


sudo make zinstall modules_install dtbs_install
echo KERNELVERSION is `make kernelrelease 2> /dev/null`

Edit /boot/config.txt to add:

device_tree=dtbs/KERNELVERSION/bcm2836-rpi-2-b.dtb # replace with the appropriate dtb for your board

Edit /boot/cmdline.txt to add:


Now you should be able to reboot to the new kernel. If there is any trouble, you will need a serial console for debug.


Until Raspbian gets its libdrm updated, we need to build it ourselves.

sudo apt-get install \
    xutils-dev libpthread-stubs0-dev \
    automake autoconf libtool
git clone git://
cd drm
./ \
    --prefix=/usr \
sudo make install


sudo apt-get install \
    flex bison python-mako \
    libxcb-dri3-dev libxcb-dri2-0-dev \
    libxcb-glx0-dev libx11-xcb-dev \
    libxcb-present-dev libxcb-sync-dev \
    libxshmfence-dev \
    libxdamage-dev libxext-dev libxfixes-dev \
    x11proto-dri2-dev x11proto-dri3-dev \
    x11proto-present-dev x11proto-gl-dev \
    libexpat1-dev libudev-dev gettext

git clone git://
cd mesa
./ \
    --prefix=/usr \
    --libdir=/usr/lib/arm-linux-gnueabihf \
    --with-gallium-drivers=vc4 \
    --with-dri-drivers= \
sudo make install

X Server

# We're going to be using modesetting, so remove the fbturbo override.
sudo rm /usr/share/X11/xorg.conf.d/99-fbturbo.conf

sudo apt-get install \
    libepoxy-dev libpixman-1-dev \
    libevdev-dev libmtdev-dev \
    libfontenc-dev libxkbfile-dev \
    libpciaccess-dev libssl-dev \
    x11proto-bigreqs-dev x11proto-composite-dev \
    x11proto-dri2-dev x11proto-dri3-dev \
    x11proto-damage-dev x11proto-fixes-dev x11proto-fonts-dev \
    x11proto-input-dev x11proto-kb-dev \
    x11proto-randr-dev x11proto-render-dev \
    x11proto-record-dev x11proto-resource-dev \
    x11proto-scrnsaver-dev x11proto-video-dev \
    x11proto-xinerama-dev \
    x11proto-xcmisc-dev x11proto-xf86dri-dev \

# Raspbian needs its protos updated
git clone git://
(cd xproto && ./ --prefix=/usr && make && sudo make install)

git clone git://
(cd randrproto && ./ --prefix=/usr && make && sudo make install)

# Raspbian is missing libxfont2.
git clone git://
(cd libXfont && ./ --prefix=/usr --libdir=/usr/lib/arm-linux-gnueabihf && make && sudo make install)

git clone git://
cd xserver
./ \
    --prefix=/usr \
    --libdir=/usr/lib/arm-linux-gnueabihf \
    --with-log-dir=/var/log \
sudo make install

# Build the evdev driver, since it's not included in the server.
git clone git://
(cd xf86-input-evdev/ && ./ --prefix=/usr --libdir=/usr/lib/arm-linux-gnueabihf && make && sudo make install)

First tests

sudo reboot # Switch to new kernel and X Server.

sudo apt-get install mesa-utils
LIBGL_DEBUG=verbose glxinfo # Should report vc4 gallium renderer
glxgears # Should run at 60fps.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.