Skip to content

Building the code

Francis Bain edited this page Nov 28, 2014 · 28 revisions

Cirrus Logic Logo

Building the code for the Element 14 Wolfson audio card

Last updated : Friday, 28 November 2014

This tutorial shows how to build a Raspberry PI kernel and install it on to your device. This tutorial assumes that you are building on a Linux machine as building on the Raspberry PI nativily is very slow.

Note: This has been tested with the lastest updates to Raspian as of the time of writing. Download Raspian from here. To install Raspian follow the instructions here.

  1. Download the Raspberry PI cross-compilers:
cd ~/bin
mkdir raspberrypi
cd raspberrypi
git clone https://github.com/raspberrypi/tools
  1. Set CCPREFIX environment variable:
export CCPREFIX=/home/<user>/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-
${CCPREFIX}gcc -v

Note : Change <user> to your username

  1. Download the Cirrus Raspberry PI kernel
cd ~
mkdir code
cd code
git clone https://github.com/CirrusLogic/rpi-linux.git
cd rpi-linux
  1. Copy the config file from your Raspberry PI. This assumes your Raspberry PI is connected to the network and your know the ip address.
scp pi@<ip-addr>:/proc/config.gz .
gunzip -c config.gz > . config

Note : Change <ip-addr> to the ip-address of your Raspberry PI.

  1. Create a .config file based on your Raspberry PI config downloaded in the previous step. Note : If you have a really old kernel you may get asked a lot of config questions.
ARCH=arm CROSS_COMPLILE=${CCPREFIX} make oldconfig
  1. Build the kernel and kernel modules
ARCH=arm CROSS_COMPILE=${CCPREFIX} make -j <num-cores>
ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=../modules make modules_install

Note : Where <num-cores> is the number of processor cores dedicated to the build

  1. Upload the new kernel and modules to the Raspberry PI
cd /home/<user>/raspberrypi/tools/mkimage
./imagetool-uncompressed.py ~/<user>/code/rpi-linux/arch/arm/boot/zImage
scp kernel.img pi@<ip-addr>:/tmp
cd ~/<user>/code/modules
tar czf modules.tgz *
scp modules.tgz pi@<ip-addr>:/tmp
  1. Install the kernel and modules on the Raspberry PI. Connect to your Raspberry PI over SSH and do the following:
cd /
sudo mv /tmp/kernel.img /boot/
sudo tar xzf /tmp/modules.tgz
rm /tmp/modules.tgz
  1. Blacklist modules. There are certain modules that cause errors and warnings that should be blacklisted. Connect to the Raspberry PI over SSH and do the following:
sudo nano /etc/modprobe.d/raspi-blacklist.conf

Add the following lines to the file

blacklist snd_soc_pcm512x
softdep arizona-spi pre: arizona-ldo1
  1. Restart the Raspberry PI sudo shutdown -r now

  2. When the Raspberry PI reboots connect over SSH and run:

uname -a

This will display the new kernel version.

Clone this wiki locally