Compile Wolfson Audio Card driver for kernel 3.12.y

Hi,

This howto is obsolete!

If this part

git reset –hard 4639d2b773b318d4b0409f67d3d5e73a513ba64b

does not work for you, do it the easy way and checkout the patched sources from here.

Compile and install as described here -> http://elinux.org/RPi_Kernel_Compilation

 

 

this is a quick ’n dirty howto for compiling the Wolfson Audio card drivers for the Raspberry Pi. To do that quickly we don’t compile on the Raspberry Pi but we install a cross compiling environment.

This howto is intendet for users who are (or sholud be) familiar with linux, bash, kernel compilation, full realtime preemption and cross compiling.

If your are NOT you are strongly adviced to read these sites in detail:

Read these sites CAREFULLY ->
http://elinux.org/RPi_Kernel_Compilation
http://wiki.linuxaudio.org/wiki/raspberrypi
http://www.element14.com/community/thread/31714/l/instructions-for-compiling-the-wolfson-audio-card-kernel-drivers-and-supported-use-cases

Here we go:

Read something about cross compiling and install cross compiling environment on your linuxbox
http://elinux.org/RPi_Kernel_Compilation#2._Cross_compiling_from_Linux

Download 2014-01-07-wheezy-raspbian.zip from
http://www.raspberrypi.org/downloads/

unzip and copy to sdcard as described here ->
http://www.raspberrypi.org/documentation/installation/installing-images/README.md
boot your Raspberry Pi (in this howto it’s called rpi)

On your linux box (mine has Ubuntu Studio 14.04 running) follow these steps
Let’s cross compile
Install youre cross compiler environment as described here ->
http://elinux.org/RPi_Kernel_Compilation#2._Cross_compiling_from_Linux
then follow these steps:

1.  mkdir ~/linux_rt_wlfsn
2.  cd ~/linux_rt_wlfsn
3.  git init
4.  git clone –depth 1 git://github.com/raspberrypi/linux.git
5.  cd linux
6.  git checkout rpi-3.12.y
7.  git reset –hard 4639d2b773b318d4b0409f67d3d5e73a513ba64b
8.  cd ..
9.  mkdir -P patches/wolfson_drivers
10. cd patches
11. wget -c https://www.kernel.org/pub/linux/kernel/projects/rt/3.12/patch-3.12.15-rt25.patch.xz
12. Read http://www.element14.com/community/thread/31714/l/instructions-for-compiling-the-wolfson-audio-card-kernel-drivers-and-supported-use-cases
13. wget -c http://downloads.element14.com/wolfson/wolfson_drivers.tar.gz?COM=WolfsonAudioCard -O wolfson_drivers.tar.gz
14. unxz patch-3.12.15-rt25.patch.xz
15. cd wolfson_drivers
16. tar -zxvf wolfson_drivers.tar.gz
17. cd ~/linux_rt_wlfsn
18. mkdir raspi_rt_image
19. export ARCH=arm
20. export CROSS_COMPILE=/data/download/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-
21. export INSTALL_MOD_PATH=~/linux_rt_wlfsn/raspi_rt_image
22. cd linux
23. //clean the kernel sources
24. git clean -xfd
25. git reset –hard
26. git checkout -f
27. git pull –rebase
28. git reset –hard 4639d2b773b318d4b0409f67d3d5e73a513ba64b
//This should show something like ->
//HEAD ist jetzt bei 4639d2b ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup
29. git checkout rpi-3.12.y
30. git status
//should show something like this:
//# On branch rpi-3.12.y
//# Your branch is behind ‚origin/rpi-3.12.y‘ by 198 commits, and can be fast-forwarded.
//#
//nothing to commit (working directory clean)
31. make -j4  ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} mrproper

32. Download the Wolfson Audio Card patches for the 3.12.y kernel

a.) including full realtime preemption patch, sdhci patch to get the sdhci card running with rt and bogoMips patch to get jackd running without error

here : 0001-RT_3.12.13-rt21-BogoMips-SDHCI-for-rpi.patch_.xz and do a

git apply –check ../patches/0001-RT_3.12.13-rt21-BogoMips-SDHCI-for-rpi.patch

if there is no error message apply again without checking ->

git apply ../patches/0001-RT_3.12.13-rt21-BogoMips-SDHCI-for-rpi.patch

The original patch is developed by Ingo Molnar and other kernel developers and can be downloaded here ->

https://www.kernel.org/pub/linux/kernel/projects/rt/

More info about full  realtime preemption can be found here ->

https://rt.wiki.kernel.org/index.php/Main_Page

b.) only the Wolfson Audio Card patches for the 3.12.y kernel

here: rpi_wlf_3.12_beta.tar.xz

git apply –check ../patches/rpi_wlf_3.12_beta/*.patch

if there is no error message apply again without checking ->

git apply  ../patches/rpi_wlf_3.12_beta/*.patch

33. Download working config file and save it   in „patches“ folder

cp ../patches/config.txt .config

34. make -j4  ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} olddefconfig

35.  //for those with e.g. 4 cpu’s
make -j4  ARCH=arm CROSS_COMPILE=${CROSS_COMPILE}
//otherwise (1 cpu only)
make ARCH=arm CROSS_COMPILE=${CROSS_COMPILE}

36. make -j4 ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} modules
37. make -j4 ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} INSTALL_MOD_PATH=${INSTALL_MOD_PATH} modules_install

38. mkdir -p ~/linux_rt_wlfsn/raspi_rt_image/boot
39. cp arch/arm/boot/Image ~/linux_rt_wlfsn/raspi_rt_image/boot/kernel_3.12.15-rt25.img
// let’s get the right firmware for the new kernel
// http://elinux.org/RPi_Kernel_Compilation#Get_the_firmware
40. cd ~/linux_rt_wlfsn
41. git clone -b next –depth 5 https://github.com/raspberrypi/firmware.git
42. cd firmware/boot
43. rm start_cd.elf start.elf kernel_emergency.img kernel.img fixup_cd.dat fixup.dat LICENCE.broadcom COPYING.linux
44. mv start_x.elf start.elf
45. mv fixup_x.dat fixup.dat
46. cd ..
47. rm -rf documentation extra README opt modules
48. mv hardfp/opt opt
49. rm -rf opt/vc/src hardfp
50. cp -R * ~/linux_rt_wlfsn/raspi_rt_image
51. cd ~/linux_rt_wlfsn/raspi_rt_image

//for Wolfson Drivers only
52 a) rm -f -r lib/modules/3.12.13+/build
52 a) rm -f -r lib/modules/3.12.13+/source

// for Wolfson Drivers on rt incl. all patches

52 b) rm -f -r lib/modules/3.12.13-rt21+/build
52 b) rm -f -r lib/modules/3.12.13-rt21+/source

If everything is fine you are ready to copy the new kernel and firmware on your rraspberry pi.

You can use scp to do this. Boot your Pi and on your linux box run this:

53. scp  -r ~/linux_rt_wlfsn/raspi_rt_image/* pi@ip-of-your-pi:.  (the dot at the end of the line is important! Do not miss).

login to your pi via ssh

ssh -X pi@ip-of-your-pi

on rpi you should copy the whole content of the ~/boot ~lib and ~opt directories to your root directory /

cp -rf boot/* /boot

cp -rf lib/* /lib

cp -rf opt/* /opt

sudo reboot

ssh into your pi after reboot and do a

uname -a

which should give you
Linux raspberrypi 3.12.13-rt21+ #1 PREEMPT RT Thu Mar 27 16:58:09 CET 2014 armv6l GNU/Linux

If you got this feel happy and

Have fun.

This howto was possible because of this excellent site which describes how to use the raspberry pi with full realtime preemption and jackd ->

http://linux.autostatic.com/2013/10/20/using-a-raspberry-pi-as-a-piano

Thanks a lot to autostatic!

Dieser Eintrag wurde veröffentlicht unter Linux. Lesezeichen für Permalink hinzufügen.