Skip to content

VC4 complete Raspbian upgrade

Eric Anholt edited this page Sep 7, 2016 · 26 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.

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 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
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 [email protected]:anholt/linux.git
git fetch anholt
git checkout -b drm-vc4-fixes  # The current set of VC4 fixes to be merged to the next kernel release
git checkout -b drm-vc4-next  # The current set of VC4 changed to be merged to the kernel after the next release.

or

git remote add next git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-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

then:

# kernel build deps
sudo apt-get install bc
make
# WARNING: Testing these instructions has only made it this far so far.
sudo make zinstall modules_install dtbs_install
echo KERNELVERSION is `make kernelrelease 2> /dev/null`

Edit /boot/config.txt to add:

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

Edit /boot/cmdline.txt to add:

cma=256M@512M 

Now you should be able to reboot to the new kernel. If there is any trouble, you want to use a serial console with the following appended to /boot/cmdline.txt:

earlyprintk console=ttyAMA0,115200 kgdboc=ttyAMA0,115200

libdrm

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

sudo apt-get install xutils-dev libpthread-stubs0-dev
git clone git://anongit.freedesktop.org/mesa/drm
cd drm
./autogen.sh \
    --prefix=/usr \
    --libdir=/usr/lib/arm-linux-gnueabihf
make
sudo make install

Mesa

sudo apt-get install \
    automake autoconf libtool \
    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

git clone git://anongit.freedesktop.org/mesa/mesa
cd mesa
./autogen.sh \
    --prefix=/usr \
    --libdir=/usr/lib/arm-linux-gnueabihf \
    --with-gallium-drivers=vc4 \
    --with-dri-drivers= \
    --with-egl-platforms=x11,drm
make
sudo make install

X Server

sudo apt-get install libepoxy-dev
git clone git://git.freedesktop.org/git/xorg/xserver
cd xserver
./autogen.sh \
    --prefix=/usr \
    --libdir=/usr/lib/arm-linux-gnueabihf \
    --with-log-dir=/var/log \
    --enable-install-setuid
make
sudo make install
Clone this wiki locally