element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Kernel compilation walk-through
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 24 replies
  • Subscribers 686 subscribers
  • Views 3469 views
  • Users 0 members are here
  • compilation
  • kernel
Related

Kernel compilation walk-through

timg73
timg73 over 11 years ago

There have been a few comments recently about compilation of the "Cirrus-Logic" Linux kernel, so I thought I'd post my recipe.  This is for native compilation running on a fresh installation of Rasbian 2014-12-24 (2014-12-24-wheezy-raspbian.zip).  It takes about 10 hours so let it run overnight.  The comments are minimal, but the process is well described in the Debian documentation.

NB this will compile the v3.12 kernel, which only works on the original Raspberry Pi series.  It will not work on an Raspberry Pi 2.

 

# How to recompile the Raspberry-Pi kernel

# see http://elinux.org/Raspberry_Pi_Kernel_Compilation

 

### PREREQUISITES : install compiler (~2MB of disk space)

 

sudo apt-get update

sudo apt-get -y dist-upgrade

sudo apt-get -y install gcc make bc screen ncurses-dev

 

### get source for alternative kernel

 

mkdir ~/tmp

cd ~/tmp

git init

 

git clone --depth 1 https://github.com/CirrusLogic/wiki-content.git # download audio-card config scripts

mv wiki-content/scripts ~/

rm -rf wiki-content

 

git clone -b rpi-3.12.y --depth 1 https://github.com/CirrusLogic/rpi-linux.git # download kernel source

tar -czvf rpi-kernel-3-12-33-cirrus.tgz rpi-linux # save source as tar for next time

#tar -xzvf rpi-kernel-3-12-33-cirrus.tgz # extract source from saved tar instead of re-downloading

cd rpi-linux

 

### configure & compile kernel

 

make mrproper         # clean up build directory

make bcmrpi_defconfig # create config for Cirrus Logic audio card (same as official instructions)

make oldconfig        # ensure config is up to date

make menuconfig       # give kernel unique suffix : General Setup -> Local version

#zcat /proc/config.gz | diff - .config # compare with running config

uname -a              # running kernel version

make kernelversion    # new kernel version

make kernelrelease

nohup make &          # compile (about 10 hours)

 

### compile and install kernel and modules

 

make KBUILD_DEBARCH=armhf deb-pkg # create packages

ver=$(make kernelrelease)         # get release string

sudo dpkg -i ../linux-image-${ver}_${ver}-1_armhf.deb

sudo mv /boot/vmlinuz-${ver} /boot/kernel_new.img

sudo rm /boot/*${ver}

 

### configure bootloader and modules

 

sudo perl -i.original -pe 's/^\s*(kernel=.+)$/\#${1}/' /boot/config.txt

echo -e "\n#Use new kernel\nkernel=kernel_new.img" | sudo tee -a /boot/config.txt

 

sudo perl -i.original -pe 's/^(snd-bcm2835)/\#${1}/' /etc/modules # disable onboard sound

echo 'snd-soc-rpi-wsp' | sudo tee -a /etc/modules # enable Cirrus sound

 

sudo perl -i.original -pe 's/^(.+-bcm2708)/\#${1}/' /etc/modprobe.d/raspi-blacklist.conf # enable spi and i2c

echo 'softdep arizona-spi pre: arizona-ldo1

blacklist snd-soc-pcm512x

#blacklist snd-soc-wm8804

' | sudo tee -a /etc/modprobe.d/raspi-blacklist.conf

 

### configure alsa

 

echo 'pcm.!default {

        type hw

        card sndrpiwsp

}

 

ctl.!default {

        type hw

        card sndrpiwsp

}' > ~/.asoundrc

 

# power off, connect Cirrus Audio Card & reboot

sudo halt

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    Former Member over 11 years ago

    there is a new 3.18y with device overlay on the cirrus github now. compiled it, didn't work, loaded pcm512x modules which complains alot about regulator.

     

    anybody able to make it work?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 11 years ago

    there is a new 3.18y with device overlay on the cirrus github now. compiled it, didn't work, loaded pcm512x modules which complains alot about regulator.

     

    anybody able to make it work?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    This should work and provide full audio card support.

    Can I check of you have followed the instructions on the wiki, "Building the code"? This has been updated to reflect 3.18. (update to reflect latest wiki instructions)

    We did see something similar which was resolved in step 4, specifically the important notice about adding trailer support to the kernel..

     

    Background here if required

    http://www.raspberrypi.org/documentation/configuration/device-tree.md

    If the kernel fails to come up in DT mode, this is probably because the kernel image does not have a valid trailer. Use knlinfo to check for one, and mkknlimg utility to add one.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    Hi Scott,

     

    I built the kernel on the pi. Took 1.5Hrs. Followed this guide here. http://www.raspberrypi.org/documentation/linux/kernel/building.md new kernel boots fine but no card detected.

     

    Now i mkknlimg the kernel, but still not detecting the card.

     

    Here is some info from the pi.

     

    pi@raspberrypi ~ $ uname -a
    Linux raspberrypi 3.18.9-v7 #1 SMP PREEMPT Tue Mar 24 21:25:06 UTC 2015 armv7l GNU/Linux
    pi@raspberrypi ~ $ aplay -l
    aplay: device_list:252: no soundcards found...
    pi@raspberrypi ~ $ lsmod
    Module                  Size  Used by
    arizona_ldo1            2708  0
    arizona_spi             1285  0
    spi_bcm2708             5117  0
    snd_soc_rpi_wsp         7785  0
    snd_soc_wm8804          8721  0
    snd_soc_bcm2708_i2s     6344  0
    regmap_spi              1732  2 snd_soc_wm8804,arizona_spi
    regmap_mmio             2949  1 snd_soc_bcm2708_i2s
    regmap_i2c              2273  1 snd_soc_wm8804
    snd_soc_core          136200  3 snd_soc_wm8804,snd_soc_rpi_wsp,snd_soc_bcm2708_i2s
    snd_compress            7598  1 snd_soc_core
    snd_pcm_dmaengine       3323  1 snd_soc_core
    snd_pcm                73019  4 snd_soc_wm8804,snd_soc_core,snd_soc_rpi_wsp,snd_pcm_dmaengine
    snd_seq                52256  0
    snd_seq_device          5449  1 snd_seq
    snd_timer              17524  2 snd_pcm,snd_seq
    snd                    50614  6 snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
    evdev                   9873  3
    joydev                  8689  0
    fixed                   2421  2
    i2c_bcm2708             4964  0
    uio_pdrv_genirq         3001  0
    uio                     7732  1 uio_pdrv_genirq
    pi@raspberrypi ~ $ sudo ./knlinfo /boot/kernel.new.dt
    Kernel trailer found at 3959160/0x3c6978:
      KVer: "Linux version 3.18.9-v7 (pi@raspberrypi) (gcc version 4.6.3 (Debian 4.6.3-14+rpi1) ) #1 SMP PREEMPT Tue Mar 24 21:25:06 UTC 2015"
      DTOK: true
    pi@raspberrypi ~ $ ls /boot/overlays/
    ds1307-rtc-overlay.dtb         pcf2127-rtc-overlay.dtb
    hifiberry-amp-overlay.dtb      pcf8523-rtc-overlay.dtb
    hifiberry-dac-overlay.dtb      pps-gpio-overlay.dtb
    hifiberry-dacplus-overlay.dtb  README
    hifiberry-digi-overlay.dtb     rpi-cirrus-wm5102-overlay.dtb
    iqaudio-dac-overlay.dtb        w1-gpio-overlay.dtb
    iqaudio-dacplus-overlay.dtb    w1-gpio-pullup-overlay.dtb
    lirc-rpi-overlay.dtb
    pi@raspberrypi ~ $ cat /boot/config.txt
    # For more options and information see
    # http://www.raspberrypi.org/documentation/configuration/config-txt.md
    # Some settings may impact device functionality. See link above for details

     

    # uncomment if you get no picture on HDMI for a default "safe" mode
    #hdmi_safe=1

     

    # uncomment this if your display has a black border of unused pixels visible
    # and your display can output without overscan
    #disable_overscan=1

     

    # uncomment the following to adjust overscan. Use positive numbers if console
    # goes off screen, and negative if there is too much border
    #overscan_left=16
    #overscan_right=16
    #overscan_top=16
    #overscan_bottom=16

     

    # uncomment to force a console size. By default it will be display's size minus
    # overscan.
    #framebuffer_width=1280
    #framebuffer_height=720

     

    # uncomment if hdmi display is not detected and composite is being output
    #hdmi_force_hotplug=1

     

    # uncomment to force a specific HDMI mode (this will force VGA)
    #hdmi_group=1
    #hdmi_mode=1

     

    # uncomment to force a HDMI mode rather than DVI. This can make audio work in
    # DMT (computer monitor) modes
    #hdmi_drive=2

     

    # uncomment to increase signal to HDMI, if you have interference, blanking, or
    # no display
    #config_hdmi_boost=4

     

    # uncomment for composite PAL
    #sdtv_mode=2

     

    #uncomment to overclock the arm. 700 MHz is the default.
    #arm_freq=800

     

    dtoverlay=rpi-cirrus-wm5102-overlay
    kernel=kernel.new.dt
    pi@raspberrypi ~ $ cat /etc/modules
    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    # Parameters can be specified after the module name.

     

    #snd-bcm2835
    pi@raspberrypi ~ $ cat /etc/modprobe.d/raspi-blacklist.conf
    softdep arizona-spi pre: arizonaldo1
    softdep spi-bcm2708 pre: fixed

     

    #blacklist snd_soc_pcm512x
    #blacklist snd_soc_tas5713
    #blacklist snd_soc_pcm512x_i2c

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    Hi,

     

    Thanks for the info - I have managed  to recreate your issue of card not detected.

     

    Can you try two things

     

    1. Remove the # from bcm-2835 in etc/modules. Therefore leave this enabled as per the default file configuration.

     

    2. softdep arizona-spi pre: arizonaldo1 should be softdep arizona-spi pre: arizona-ldo1 (the dash is missing)

     

    The Cirrus github instructions have also been updated this morning to include details on compiling locally on the Raspberry Pi. Please let me know how you get on.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    Hi Scott,

     

    It is probable the arizonaldo1. I already dd'ed the card and i can't check it.

     

    I build the kernel earlier today and both local and cross compiled kernel work with #bcm-2835 still in /etc/modules.

     

    Anyway, is there any way to access the parametric eq on the wm5102 or at least change the frequency band on the 5 band eq?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    You are correct, it is only the softdep that you need fix. The #bcm-2835 is OK to leave.

     

    Yes you can access the EQ,see below for a couple of posts where this has been implemented already

    http://www.element14.com/community/community/raspberry-pi/raspberry-pi-accessories/wolfson_pi/blog/2014/08/17/wolfson-audio-paths-how-to-use-eq-and-lhpf

    http://www.element14.com/community/thread/37660/l/example-use-of-eq-on-playback

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 11 years ago in reply to Former Member

    I also got a lot of errors about voltage regulators not found and my card was not detected.

    All that went away after I updated my firmware, I was still on firmware for my old 3.12 kernel.

     

    Now happy listening to music from the Cirrus Logic card on a B+ with kernel 3.18 image

    The Compile Machine is busy cooking one up for the Pi2...

    --

    Ragnar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube