17

I'm interested in compiling a custom kernel for the pi. I have the source from the github archive, which includes a make target for a default configuration:

make ARCH=arm bcmrpi_defconfig

But (as with normal linux distro kernels) this includes a lot of stuff I will never need, and some things that I'd like to change.

What are the options that are actually required to make various common pi-centric things work?

0

4 Answers 4

27

Starting with the default configuration, or one you know works already, is a good idea. Beware that for the Pi 2, you should use:

make bcm2709_defconfig

Instead of bcmrpi_defconfig.

Note that if you want to avoid clobbering an existing kernel install of the same version, set the General setup -> Local version - append to kernel release string to a unique value.

I've used the actual labels from .config here, sans CONFIG_; if you are using e.g., make menuconfig, you can find the relevant option with the search (forward slash /). These labels are also used at the top of the "Help" page for each option. Note that the term enable(d) refers to something which causes an option to appear, distinct from actually selecting the option to be built.

Where there are differences between the A/B/B+/A+ boards and the Pi 2, this is indicated. In some places this is the difference between the Broadcom 2708 and 2709 families, but in other places, the Pi 2 uses the same 2708 (or 2835) option as the other boards.


System

For A/A+/B/B+:

  • ARCH_BCM2708 (System Type -> Arm System Type -> Broadcom BCM2708 family)

For Pi 2:

  • ARCH_BCM2709 (System Type -> Arm System Type -> Broadcom BCM2709 family) ...This is at the very bottom of the list and not in alphabetical order.
  • SMP (Kernel Features -> Symmetric Multi-Processing)
  • NEON (Floating Point Emulation -> Advanced SIMD (Neon) Extension support) And "Support for NEON in kernel mode".

Kernel Memory Split:

Because of problems with a couple of pieces of legacy software, the default config may use 3G/1G here which will leave 25% of the Pi 2's RAM unavailable to user space. If you are concerned about this, check Kernel Features -> Memory Split.


SD card

These can't be modules, obviously, since they are needed to access /lib/modules; they must be built-in. They're in the "Device Drivers" section of menuconfig.

  • MMC (MMC/SD/SDIO card support): Necessary to get options for the mmc driver, but not sufficient. Within those options:
    • MMC_BCM2835 (MMC support on BCM2835).
    • MMC_BCM2835_DMA (DMA support on BCM2835 Arasan controller): Enabled but not selected by MMC_BCM2835.
    • MMC_SDHCI (Secure Digital Host Controller Interface support)

Since the root partition is usually ext formatted, you also want that built in:

  • EXT4_FS (The Extended 4 (ext4) filesystem) under "File Systems". Probably ext2 and ext3 are a good idea too.

The boot partition is vfat, so:

  • VFAT_FS (VFAT (Windows-95) fs support) is under "File Systems -> DOS/FAT/NT Filesystems".

Miscellaneous

These are various things you (almost certainly) need, so I've listed them first.

  • VFP (VFP-format floating point maths) under "Floating point emulation".
  • UNIX (Unix domain sockets) under "Networking support". Basic system software will require this even if you are not doing any real networking.
  • BINFMT_ELF (Kernel support for ELF binaries) under "Userspace binary formats".
  • TTY (Enable TTY) under "Device Drivers -> Character Devices"; this enables VT (Virtual terminal) and UNIX98_PTYS (Unix98 PTY support) which you should select. VT then enables VT_CONSOLE (Support for console on virtual terminal) and CONSOLE_TRANSLATIONS (Enable character translations in console) which should also be selected.
  • PROC_FS, SYSFS, and TMPFS under "File Systems -> Pseudo Filesystems".
  • SERIAL_AMBA_PL011 (ARM AMBA PL011 serial port support) under "Device Drivers -> Character Devices -> Serial Drivers" and SERIAL_AMBA_PL011_CONSOLE (Support for console on AMBA serial port). Raspbian systems will complain about "/dev/ttyAMA0: No such file or directory" without this.
  • MAILBOX and BCM2708_MBOX (on 4.x kernels). This is Device Drivers->Mailbox Hardware Support and the BCM 2708 option in the submenu. See zub's answer.

USB

  • USB (Support for Host-side USB), in "Device Drivers -> USB Support", enabling USB_DWCOTG (Synopsis DWC host support) down the page, which should also be selected.
  • USB_ANNOUNCE_NEW_DEVICES (Device Drivers -> USB Support -> USB announce new devices).
  • USB_DEFAULT_PERSIST (Device Drivers -> USB Support -> Enable USB persist by default).

For keyboards and mice:

  • HID_GENERIC (Generic HID driver) in "Device Drivers->HID support"
  • Then in "USB HID support": USB_HID (USB HID transport layer)
  • INPUT_MOUSEDEV (Mouse interface) in "Device Drivers -> Input Device Support".

For hard drives:

  • SCSI (SCSI device support) and then BLK_DEV_SD (SCSI disk support) in "Device Drivers -> SCSI Support".
  • USB_STORAGE (USB Mass Storage support) in "Device Drivers -> USB Support".

For tethering Android devices, see my answer here.


Ethernet

USB must be enabled first.

  • NET (Networking support), a top level option; inside that are:

    • PACKET (Packet socket).
    • INET (TCP/IP networking). This should enable a variety of IP related defaults which you can leave.
    • NETFILTER (Network packet filtering framework), necessary for the kernel "ip tables" packet filter firewall.
  • NETDEVICES (Network device support) in "Device Drivers", then:

    • NET_CORE (Network core driver support).
    • USB_NET_DRIVERS (USB Network Adapters) ->
      • USB_USBNET (Multi-purpose USB Networking Framework).
      • USB_NET_SMSC95XX (SMSC LAN95XX based USB 2.0 10/100 ethernet devices)

Sound

To enable the onboard sound:

  • SOUND (in Device Drivers), then:
    • SND (Advanced Linux Sound Architecture) and in that:
    • SND_ARM (ARM sound devices) and finally in that SND_BCM2835 (BCM2835 ALSA driver)

Video

  • CONFIG_BCM2708_VCHIQ (Device Drivers -> Misc Devices -> Videocore VCHIQ).

There's nothing further required for X server support; there are no DRI driver options for the pi's SoC.

If you want to use the framebuffer, which allows applications such as fbi and omxplayer to display graphics outside of X:

  • FB (Device Drivers -> Graphics Support -> Frame buffer Devices -> Support for frame buffer devices), then in the same menu, FB_BCM2708 (BCM2708 framebuffer support).

If you do this and you want the penguin (or rather, the raspberry) on the boot console, remember LOGO (Bootup logo) under Graphics Support.

You may also want to look at options under System Type -> Broadcom2708 (or 9) Implementations.


GPIO / I2C

  • BCM2708_GPIO (System Type -> Broadcom BCM2708 Implementations) Or for the Pi 2, the corresponding BCM2709 option.
  • GPIO_SYSFS (Device Drivers -> GPIO Support) for the /sys/class/gpio interface.
  • I2C (Device Drivers -> I2C support), which enables I2C_CHARDEV (I2C device interface). Then under "I2C Hardware Bus support":
    • I2C_BCM2708 (BCM2708 BSC).

Raspicam

  • MEDIA_CAMERA_SUPPORT (Device drivers -> Multimedia Support -> Cameras/video grabbers support).
  • V4L_PLATFORM_DRIVERS (Device drivers->Multimedia Support -> V4L Platform Devices"). This enables a submenu where you want to select:
    • CONFIG_SOC_CAMERA (SoC Camera Support).
    • CONFIG_VIDEO_BCM2835 (Broadcom BCM2835 camera interface driver). This enables "Broadcom BM2835 MMAL camera interface driver (CONFIG_VIDEO_BCM2835_MMAL) which you should also select.

Thermal sensor

You have a choice here; if you try to choose both, the first one will be cancelled (although you can build one as a module, change the config, build the other, and use them both if you really want to).

  • SENSORS_BCM2835 (Device Drivers->Hardware Monitoring support->Broadcom BCM2835 HWMON Driver). This is at the bottom of the list if you don't select "BCM2835 Thermal Driver", below. It gives you access to thermal stuff in /sys/devices/platform/bcm2835_hwmon -- temp1_input and temp1_max. The former is the same /sys/devices/virtual/thermal/thermal_zone0/temp; the latter is always 85000 (i.e. 85 °C).
  • THERMAL_BCM2835 (Device Drivers->Generic Thermal sysfs driver->BCM2835 Thermal Driver). Also choose Device Drivers->Hardware Monitoring support (but not the individual driver in that menu) so that "Expose thermal sensors as hwmon device" appears here and you can choose that (4.0.y seems to not have this). Choosing this will unchoose SENSORS_BCM2835, above. It gives you access to the easier to remember and find /sys/class/devices/virtual/thermal/thermal_zone0 which includes temp and trip_point_0_temp (the same as temp1_max, above). Various userspace monitors will probably prefer this and may not work without it.
0
5

A comment to goldilock's great post:

Just wanted to add one thing I observe with rpi-4.1.y branch (05376fce25aaab4f47182a5af04928bfa06f30d6): In order to have USB working (this includes the USB-connected ethernet), one has to also enable BCM2708_MBOX (Device Drivers->Mailbox Hardware Support->Broadcom BCM2708 Mailbox (vcio)).

Without this option USB starts initializing but only produces a bunch of scary messages like:

[    1.193854] WARN::dwc_otg_core_reset:5109: dwc_otg_core_reset() HANG! Soft Reset GRSTCTL=80000001
[    1.441137] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0x9fc0c000 dma = 0x5d5e4000 len=9024

Btw. BCM2708_MBOX is also a prerequisite for THERMAL_BCM2835 and for SND_BCM2835.

2

Video (framebuffer)

In addition for video support, it looks like you need to enable:

Device Drivers ->
  DMA Engine support ->
    BCM2835 DMA engine support (CONFIG_DMA_BCM2835)

In order to load framebuffer driver correctly. You can enable it without DMA enabled, but it will fail to load.

Integrated Wireless

In order to have Integrated Wireless (RPi 3 and Pi Zero W), you need to select the following:

Networking support ->
  Wireless ->
    cfg80211 - wireless configuration API (CONFIG_CFG80211)

Device Drivers ->
  Network device support ->
    Wireless LAN ->
      Broadcom IEEE802.11n embedded FullMAC WLAN driver (CONFIG_BRCMFMAC)
0

Might be old, but I got here using the search. For the SDHC card you additionally need

Device Drivers -> -> MMC block device driver )CONFIG_MMC_BLOCK)

otherwise your kernel will detect the SDHC card, but no partitions on it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.