meta-raspberrypi

repository·master·Indexed 20 days ago

https://github.com/agherzan/meta-raspberrypi

A Yocto Project Board Support Package (BSP) layer providing hardware-specific support for Raspberry Pi boards. It includes configurations for building images via BitBake or kas, and provides extensive options for tuning hardware such as GPU memory split, UART, SPI/I2C buses, USB boot for Raspberry Pi 4, overclocking, and U-Boot integration.

Tokens
5.5K
Snippets
34
Records
40
Agent score
71%

What's inside meta-raspberrypi

  1. Use multi-board machines for wider compatibility

    master

    If your use case requires a single image to be compatible across a wider range of Raspberry Pi hardware rather than a specific board, use the multi-board machine targets. These machines pull in firmware, kernel images, and modules for all relevant boards in their respective architecture class.

    • raspberrypi-armv7: Targets all ARMv7-based Raspberry Pi boards.
    • raspberrypi-armv8: Targets all ARMv8-based Raspberry Pi boards.
  2. Understand WiFi and Bluetooth firmware availability

    master

    Standard linux-firmware from OE-Core (poky) does not include the necessary WiFi and Bluetooth firmware for Raspberry Pi boards.

    This layer resolves this by using .bbappends to add files from Raspbian repositories to the linux-firmware recipe. All machines in this layer automatically include the required wireless firmware via the MACHINE_EXTRA_RRECOMMENDS variable. For example, raspberrypi3 includes multiple firmware packages to support 3, 3B, and 3B+ models.

  3. Communicate via the Yocto Project mailing list

    master
    The project uses the global Yocto Project mailing list for communication. When asking questions, you must prepend your email subject with [meta-raspberrypi] to help maintainers identify the context, as this is a shared list and not a dedicated one for this layer.
  4. Enable WM8960 soundcard support

    master

    To support WM8960-based sound cards (e.g., Waveshare Hi-Fi HAT or Seeed Studio ReSpeaker), add wm8960 to MACHINE_FEATURES. You may need to use amixer to configure volume and toggle mixer settings manually.

    MACHINE_FEATURES += "wm8960"
    
    # Example amixer configuration
    amixer -c1 sset 'Headphone',0 80%,80%
    amixer -c1 sset 'Speaker',0 80%,80%
    amixer -c1 sset 'Left Input Mixer Boost' toggle
    amixer -c1 sset 'Left Output Mixer PCM' toggle
    amixer -c1 sset 'Right Input Mixer Boost' toggle
    amixer -c1 sset 'Right Output Mixer PCM' toggle
  5. Configure Raspberry Pi Distro VLC and MMAL

    master

    To use the Raspberry Pi Distro version of VLC with hardware-accelerated video decode via MMAL, follow these steps:

    1. Ensure meta-openembedded/meta-multimedia is in your bblayers.conf.
    2. Disable VC4 graphics by setting DISABLE_VC4GRAPHICS = "1" in local.conf (MMAL is not enabled by default).
    3. Set the preferred providers for VLC and ffmpeg/libav to rpidistro-vlc and rpidistro-ffmpeg respectively.

    Usage Example: Start VLC with the mmal_vout plugin without a display server:

    DISPLAYNUM=$(tvservice -l | tail -c 2)
    MMAL_DISPLAY=$(expr $DISPLAYNUM + 1)
    VLC_SETTINGS="-I dummy --vout=mmal_vout --mmal-resize --mmal-display hdmi-$MMAL_DISPLAY --no-dbus"
    cvlc $VLC_SETTINGS <video/playlist>
    DISABLE_VC4GRAPHICS = "1"
    PREFERRED_PROVIDER_vlc = "rpidistro-vlc"
    PREFERRED_PROVIDER_ffmpeg = "rpidistro-ffmpeg"
    PREFERRED_PROVIDER_libav = "rpidistro-ffmpeg"
    PREFERRED_PROVIDER_libpostproc = "rpidistro-ffmpeg"
  6. Enable CAN bus support

    master

    To use CAN with MCP2515-based modules, enable the SPI bus and the CAN interface. For dual CAN modules (like PiCAN2 Duo), use the ENABLE_DUAL_CAN variable instead. You can also configure the crystal oscillator frequency and the interrupt pins for can0 and can1.

    # For MCP2515-based modules
    ENABLE_SPI_BUS = "1"
    ENABLE_CAN = "1"
    
    # For dual CAN modules (e.g. PiCAN2 Duo)
    ENABLE_SPI_BUS = "1"
    ENABLE_DUAL_CAN = "1"
    
    # Configure oscillator frequency (default is 16MHz, e.g., to set 8MHz)
    CAN_OSCILLATOR="8000000"
    
    # Configure interrupt pins (defaults: can0=25, can1=24)
    CAN0_INTERRUPT_PIN = "12"
    CAN1_INTERRUPT_PIN = "16"
    
    # For 2-Channel CAN-BUS(FD) Shield (MCP2518FD)
    ENABLE_DUAL_CAN_SEED_FD_HAT_V2 = "1"
  7. Submit patches via GitHub or Mailing List

    master

    There are two primary ways to contribute to meta-raspberrypi:

    1. GitHub Pull Requests (Preferred): Submit pull requests directly to the GitHub mirror at https://github.com/agherzan/meta-raspberrypi.
    2. Mailing List: Send patches to the Yocto Project mailing list. If using this method, you must use specific git formatting for the subject line and use git send-email to deliver them.

    When sending to the mailing list, the maintainer will periodically include your patches in a GitHub pull request to trigger CI workflows.

    # Generate patches with the correct subject prefix
    git format-patch -s --subject-prefix='meta-raspberrypi][PATCH' origin
    
    # Send the generated patch to the mailing list
    git send-email --to yocto@lists.yoctoproject.org <generated patch>
  8. Quick Start: Build a Raspberry Pi image with BitBake

    master

    To build a Raspberry Pi image using standard Yocto/OpenEmbedded workflows, follow these steps:

    1. Initialize the build environment:
      source openembedded-core/oe-init-build-env rpi-build
    2. Configure bblayers.conf to include meta-raspberrypi and its required dependencies (bitbake, openembedded-core, and meta-yocto).
    3. Configure local.conf by setting the MACHINE variable to one of the supported Raspberry Pi boards.
    4. Execute the build:
      bitbake core-image-base
    5. Flash the resulting .wic.bz2 file to an SD card using bmaptool.
    6. Boot the Raspberry Pi.
    source openembedded-core/oe-init-build-env rpi-build
    bitbake core-image-base
  9. Enable Raspberry Pi Camera modules

    master

    Camera modules are not enabled by default. You must explicitly enable them in local.conf to add the correct device tree overlays and memory allocations.

    • Camera Module V2: Uses imx219 overlay. Set RASPBERRYPI_CAMERA_V2 = "1".
    • Camera Module V3: Uses imx708 overlay. Set RASPBERRYPI_CAMERA_V3 = "1".
    RASPBERRYPI_CAMERA_V2 = "1"
    RASPBERRYPI_CAMERA_V3 = "1"
  10. Enable GPIO shutdown button

    master

    To enable a hardware shutdown button using device tree kernels, set ENABLE_GPIO_SHUTDOWN = "1". This includes the gpio-keys kernel module.

    Note: The default pin is GPIO 3, which conflicts with the I2C bus. If you are using I2C or PiTFT, you must assign a different pin using GPIO_SHUTDOWN_PIN.

    ENABLE_GPIO_SHUTDOWN = "1"
    GPIO_SHUTDOWN_PIN = "25"
  11. Quick Start: Build a Raspberry Pi image with kas

    master

    If you prefer using the kas build tool, follow these steps:

    1. Install kas via PyPi:
      sudo pip3 install kas
    2. Edit the `kas-poky-rpi.yml` file and set the `machine:` key to one of the supported boards (refer to `conf/machine/*.conf` for available options).
    3. Run the build using `kas`:
       ```bash
       kas build meta-raspberrypi/kas-poky-rpi.yml
    1. Flash the generated .wic.bz2 file to an SD card using bmaptool.
    2. Boot the Raspberry Pi.
    sudo pip3 install kas
    kas build meta-raspberrypi/kas-poky-rpi.yml