1# Optional build configuration 2 3There are a set of ways in which a user can influence different parameters of 4the build. We list here the ones that are closely related to this BSP or 5specific to it. For the rest please check: 6<http://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html> 7 8## Compressed deployed files 9 101. Overwrite IMAGE_FSTYPES in local.conf 11 * `IMAGE_FSTYPES = "tar.bz2 ext3.xz"` 12 132. Overwrite SDIMG_ROOTFS_TYPE in local.conf 14 * `SDIMG_ROOTFS_TYPE = "ext3.xz"` 15 16Accommodate the values above to your own needs (ex: ext3 / ext4). 17 18## GPU memory 19 20* `GPU_MEM`: GPU memory in megabyte. Sets the memory split between the ARM and 21 GPU. ARM gets the remaining memory. Min 16. Default 64. 22 23* `GPU_MEM_256`: GPU memory in megabyte for the 256MB Raspberry Pi. Ignored by 24 the 512MB RP. Overrides gpu_mem. Max 192. Default not set. 25 26* `GPU_MEM_512`: GPU memory in megabyte for the 512MB Raspberry Pi. Ignored by 27 the 256MB RP. Overrides gpu_mem. Max 448. Default not set. 28 29* `GPU_MEM_1024`: GPU memory in megabyte for the 1024MB Raspberry Pi. Ignored by 30 the 256MB/512MB RP. Overrides gpu_mem. Max 944. Default not set. 31 32See: <https://www.raspberrypi.com/documentation/computers/config_txt.html#memory-options> 33 34## VC4 35 36By default, each machine uses `vc4` for graphics. This will in turn sets mesa as provider for `gl` libraries. `DISABLE_VC4GRAPHICS` can be set to `1` to disable this behaviour falling back to using `userland`. Be aware that `userland` has not support for 64-bit arch. If you disable `vc4` on a 64-bit Raspberry Pi machine, expect build breakage. 37 38## Add purchased license codecs 39 40To add your own licenses use variables `KEY_DECODE_MPG2` and `KEY_DECODE_WVC1` in 41local.conf. Example: 42 43 KEY_DECODE_MPG2 = "12345678" 44 KEY_DECODE_WVC1 = "12345678" 45 46You can supply more licenses separated by comma. Example: 47 48 KEY_DECODE_WVC1 = "0x12345678,0xabcdabcd,0x87654321" 49 50See: <https://www.raspberrypi.com/documentation/computers/config_txt.html#licence-key-and-codec-options> 51 52## Disable overscan 53 54By default the GPU adds a black border around the video output to compensate for 55TVs which cut off part of the image. To disable this set this variable in 56local.conf: 57 58 DISABLE_OVERSCAN = "1" 59 60## Disable splash screen 61 62By default a rainbow splash screen is shown after the GPU firmware is loaded. 63To disable this set this variable in local.conf: 64 65 DISABLE_SPLASH = "1" 66 67## Boot delay 68 69The Raspberry Pi waits a number of seconds after loading the GPU firmware and 70before loading the kernel. By default it is one second. This is useful if your 71SD card needs a while to get ready before Linux is able to boot from it. 72To remove (or adjust) this delay set these variables in local.conf: 73 74 BOOT_DELAY = "0" 75 BOOT_DELAY_MS = "0" 76 77## Boot media 78 79The Raspberry Pi 4 board can load the boot image files from SD card and USB memory. 80By default SD card media is used as boot media. 81 82To switch the boot media from SD card to USB memory, the following variables are supported 83in local.conf: `CMDLINE_ROOT_PARTITION` and `BOOT_MEDIA`. 84The default value of `CMDLINE_ROOT_PARTITION` is "/dev/mmcblk0p2" to mount SD card. If you want to mount USB memory partition, set CMDLINE_ROOT_PARTITION to "/dev/sda2". 85`BOOT_MEDIA` allows `mmc` and `usb`. The "mmc" is required to load an image from the SD card, following the u-boot specification. Similarly, if you want to load a boot image file from USB memory, set BOOT_MEDIA to "usb". 86 87For example, if you want to use USB boot, please define 88the following parameters in your local.conf file. 89 90 CMDLINE_ROOT_PARTITION = "/dev/sda2" 91 BOOT_MEDIA = "usb" 92 93## Set overclocking options 94 95The Raspberry Pi can be overclocked. As of now overclocking up to the "Turbo 96Mode" is officially supported by the Raspberry Pi and does not void warranty. Check 97the config.txt for a detailed description of options and modes. The following 98variables are supported in local.conf: `ARM_FREQ`, `GPU_FREQ`, `CORE_FREQ`, 99`SDRAM_FREQ` and `OVER_VOLTAGE`. 100 101Example official settings for Turbo Mode in Raspberry Pi 2: 102 103 ARM_FREQ = "1000" 104 CORE_FREQ = "500" 105 SDRAM_FREQ = "500" 106 OVER_VOLTAGE = "6" 107 108See: <https://www.raspberrypi.com/documentation/computers/config_txt.html#overclocking-options> 109 110## HDMI and composite video options 111 112The Raspberry Pi can output video over HDMI or SDTV composite (the RCA connector). 113By default the video mode for these is autodetected on boot: the HDMI mode is 114selected according to the connected monitor's EDID information and the composite 115mode is defaulted to NTSC using a 4:3 aspect ratio. Check the config.txt for a 116detailed description of options and modes. The following variables are supported in 117local.conf: `HDMI_FORCE_HOTPLUG`, `HDMI_DRIVE`, `HDMI_GROUP`, `HDMI_MODE`, 118`HDMI_CVT`, `CONFIG_HDMI_BOOST`, `SDTV_MODE`, `SDTV_ASPECT` and `DISPLAY_ROTATE`. 119 120Example to force HDMI output to 720p in CEA mode: 121 122 HDMI_GROUP = "1" 123 HDMI_MODE = "4" 124 125See: <https://www.raspberrypi.com/documentation/computers/configuration.html#hdmi-configuration> 126 127## Video camera support with V4L2 drivers 128 129Set this variable to enable support for the video camera (Linux 3.12.4+ 130required): 131 132 VIDEO_CAMERA = "1" 133 134## Enable offline compositing support 135 136Set this variable to enable support for dispmanx offline compositing: 137 138 DISPMANX_OFFLINE = "1" 139 140This will enable the firmware to fall back to off-line compositing of Dispmanx 141elements. Normally the compositing is done on-line, during scanout, but cannot 142handle too many elements. With off-line enabled, an off-screen buffer is 143allocated for compositing. When scene complexity (number and sizes 144of elements) is high, compositing will happen off-line into the buffer. 145 146Heavily recommended for Wayland/Weston. 147 148See: <http://wayland.freedesktop.org/raspberrypi.html> 149 150## Enable kgdb over console support 151 152To add the kdbg over console (kgdboc) parameter to the kernel command line, set 153this variable in local.conf: 154 155 ENABLE_KGDB = "1" 156 157## Disable rpi boot logo 158 159To disable rpi boot logo, set this variable in local.conf: 160 161 DISABLE_RPI_BOOT_LOGO = "1" 162 163## Boot to U-Boot 164 165To have u-boot load kernel image, set in your local.conf: 166 167 RPI_USE_U_BOOT = "1" 168 169This will select the appropriate image format for use with u-boot automatically. 170For further customisation the KERNEL_IMAGETYPE and KERNEL_BOOTCMD variables can 171be overridden to select the exact kernel image type (eg. zImage) and u-boot 172command (eg. bootz) to be used. 173 174To operate correctly, U-Boot requires `enable_uart=1` in `config.txt` file for 175the following boards: 176* Raspberry Pi Zero W 177* Raspberry Pi 3 32-bit 178* Raspberry Pi 3 64-bit 179* Raspberry Pi 4 32-bit 180* Raspberry Pi 4 64-bit 181 182It means that, for those boards, `RPI_USE_U_BOOT = "1"` is not compatible with 183`ENABLE_UART = "0"`. 184 185## Image with Initramfs 186 187To build an initramfs image: 188 189* Set this 3 kernel variables (in kernel's do_configure:prepend in linux-raspberrypi.inc after the line kernel_configure_variable LOCALVERSION "\"\"" 190) 191 - kernel_configure_variable BLK_DEV_INITRD y 192 - kernel_configure_variable INITRAMFS_SOURCE "" 193 - kernel_configure_variable RD_GZIP y 194 195* Set the yocto variables (e.g. in local.conf) 196 - `INITRAMFS_IMAGE = "<name for your initramfs image>"` 197 - `INITRAMFS_IMAGE_BUNDLE = "1"` 198 - `BOOT_SPACE = "1073741"` 199 - `INITRAMFS_MAXSIZE = "315400"` 200 - `IMAGE_FSTYPES:pn-${INITRAMFS_IMAGE} = "${INITRAMFS_FSTYPES}"` 201 202## Including additional files in the SD card image boot partition 203 204The SD card image class supports adding extra files into the boot 205partition, where the files are copied from either the image root 206partition or from the build image deploy directory. 207 208To copy files that are present in the root partition into boot, 209FATPAYLOAD is a simple space-separated list of files to be copied: 210 211 FATPAYLOAD = "/boot/example1 /boot/example2" 212 213To copy files from the image deploy directory, the files should be 214listed in the DEPLOYPAYLOAD as a space-separated list of entries. 215Each entry lists a file to be copied, and an optional destination 216filename can be specified by supplying it after a colon separator. 217 218 DEPLOYPAYLOAD = "example1-${MACHINE}:example1 example2" 219 220Files that are to be included from the deploy directory will be produced 221by tasks that image building task must depend upon, to ensure that the 222files are available when they are needed, so these component deploy 223tasks must be added to: RPI_SDIMG_EXTRA_DEPENDS. 224 225 RPI_SDIMG_EXTRA_DEPENDS:append = " example:do_deploy" 226 227## Enable SPI bus 228 229When using device tree kernels, set this variable to enable the SPI bus: 230 231 ENABLE_SPI_BUS = "1" 232 233## Enable I2C 234 235When using device tree kernels, set this variable to enable I2C: 236 237 ENABLE_I2C = "1" 238 239Furthermore, to auto-load I2C kernel modules set: 240 241 KERNEL_MODULE_AUTOLOAD:rpi += "i2c-dev i2c-bcm2708" 242 243## Enable PiTFT support 244 245Basic support for using PiTFT screens can be enabled by adding below in 246local.conf: 247 248* `MACHINE_FEATURES += "pitft"` 249 - This will enable SPI bus and i2c device-trees, it will also setup 250 framebuffer for console and x server on PiTFT. 251 252NOTE: To get this working the overlay for the PiTFT model must be build, added 253and specified as well (dtoverlay=<driver> in config.txt). 254 255Below is a list of currently supported PiTFT models in meta-raspberrypi, the 256modelname should be added as a MACHINE_FEATURES in local.conf like below: 257 258 MACHINE_FEATURES += "pitft <modelname>" 259 260List of currently supported models: 261* pitft22 262* pitft28r 263* pitft28c 264* pitft35r 265 266## Misc. display 267 268If you would like to use the Waveshare "C" 1024×600, 7 inch Capacitive Touch 269Screen LCD, HDMI interface (<http://www.waveshare.com/7inch-HDMI-LCD-C.htm>) Rev 2702.1, please set the following in your local.conf: 271 272 WAVESHARE_1024X600_C_2_1 = "1" 273 274## Enable UART 275 276RaspberryPi 0, 1, 2 and CM will have UART console enabled by default. 277 278RaspberryPi 0 WiFi and 3 does not have the UART enabled by default because this 279needs a fixed core frequency and enable_uart will set it to the minimum. Certain 280operations - 60fps h264 decode, high quality deinterlace - which aren't 281performed on the ARM may be affected, and we wouldn't want to do that to users 282who don't want to use the serial port. Users who want serial console support on 283RaspberryPi 0 Wifi or 3 will have to explicitly set in local.conf: 284 285 ENABLE_UART = "1" 286 287Ref.: 288* <https://github.com/raspberrypi/firmware/issues/553> 289* <https://github.com/RPi-Distro/repo/issues/22> 290 291## Enable USB Peripheral (Gadget) support 292 293The standard USB driver only supports host mode operations. Users who 294want to use gadget modules like g_ether should set the following in 295local.conf: 296 297 ENABLE_DWC2_PERIPHERAL = "1" 298 299## Enable USB host support 300 301By default in case of the Compute Module 4 IO Board the standard USB driver 302that usually supports host mode operations is disabled for power saving reasons. 303Users who want to use the 2 USB built-in ports or the other ports provided via 304the header extension should set the following in local.conf: 305 306 ENABLE_DWC2_HOST = "1" 307 308## Set CPUs to be isolated from the standard Linux scheduler 309 310By default Linux will use all available CPUs for scheduling tasks. For real time 311purposes there can be an advantage to isolating one or more CPUs from the 312standard scheduler. It should be noted that CPU 0 is special, it is the only CPU 313available during the early stages of the boot process and cannot be isolated. 314 315The string assigned to this variable may be a single CPU number, a comma 316separated list ("1,2"), a range("1-3"), or a mixture of these ("1,3-5") 317 318 ISOLATED_CPUS = "1-2" 319 320## Enable Openlabs 802.15.4 radio module 321 322When using device tree kernels, set this variable to enable the 802.15.4 hat: 323 324 ENABLE_AT86RF = "1" 325 326See: <https://openlabs.co/OSHW/Raspberry-Pi-802.15.4-radio> 327 328## Enable CAN 329 330In order to use CAN with an MCP2515-based module, set the following variables: 331 332 ENABLE_SPI_BUS = "1" 333 ENABLE_CAN = "1" 334 335In case of dual CAN module (e.g. PiCAN2 Duo), set following variables instead: 336 337 ENABLE_SPI_BUS = "1" 338 ENABLE_DUAL_CAN = "1" 339 340Some modules may require setting the frequency of the crystal oscillator used on the particular board. The frequency is usually marked on the package of the crystal. By default, it is set to 16 MHz. To change that to 8 MHz, the following variable also has to be set: 341 342 CAN_OSCILLATOR="8000000" 343 344Configure the interrupt pin to the one connected to the CAN module. By default, 345the pins are set to 25 for can0 and 24 for can1. To change them to 12 and 16, 346the following variables also have to be set: 347 348 CAN0_INTERRUPT_PIN = "12" 349 CAN1_INTERRUPT_PIN = "16" 350 351Tested modules: 352 353* PiCAN2 (16 MHz crystal): <http://skpang.co.uk/catalog/pican2-canbus-board-for-raspberry-pi-23-p-1475.html> 354* WaveShare RS485 CAN HAT (8 MHz or 12 MHz crystal): <https://www.waveshare.com/rs485-can-hat.htm> 355* PiCAN2 Duo (16 MHz crystal): <http://skpang.co.uk/catalog/pican2-duo-canbus-board-for-raspberry-pi-23-p-1480.html> 356 357## Enable infrared 358 359Users who want to enable infrared support, for example for using LIRC (Linux 360Infrared Remote Control), have to explicitly set in local.conf: 361 362 ENABLE_IR = "1" 363 364This will add device tree overlays gpio-ir and gpio-ir-tx to config.txt. 365Appropriate kernel modules will be also included in the image. By default the 366GPIO pin for gpio-ir is set to 18 and the pin for gpio-ir-tx is 17. Both pins 367can be easily changed by modifying variables `GPIO_IR` and `GPIO_IR_TX`. 368 369## Enable gpio-shutdown 370 371When using device tree kernels, set this variable to enable gpio-shutdown: 372 373 ENABLE_GPIO_SHUTDOWN = "1" 374 375This will add the corresponding device tree overlay to config.txt and include 376the gpio-keys kernel module in the image. If System V init is used, additional 377mapping is applied to bind the button event to shutdown command. Systemd init 378should handle the event out of the box. 379 380By default the feature uses gpio pin 3 (except RPi 1 Model B rev 1 enumerates 381the pin as gpio 1). This conflicts with the I2C bus. If you set `ENABLE_I2C` 382to `1` or enabled `PiTFT` support, or otherwise want to use another pin, use 383`GPIO_SHUTDOWN_PIN` to assign another pin. Example using gpio pin 25: 384 385 GPIO_SHUTDOWN_PIN = "25" 386 387## Enable One-Wire Interface 388 389One-wire is a single-wire communication bus typically used to connect sensors 390to the RaspberryPi. The Raspberry Pi supports one-wire on any GPIO pin, but 391the default is GPIO 4. To enable the one-wire interface explicitly set it in 392`local.conf` 393 394 ENABLE_W1 = "1" 395 396Once discovery is complete you can list the devices that your Raspberry Pi has 397discovered via all 1-Wire busses check the interface with this command 398 399`ls /sys/bus/w1/devices/` 400 401## Manual additions to config.txt 402 403The `RPI_EXTRA_CONFIG` variable can be used to manually add additional lines to 404the `config.txt` file if there is not a specific option above for the 405configuration you need. To add multiple lines you must include `\n` separators. 406If double-quotes are needed in the lines you are adding you can use single 407quotes around the whole string. 408 409For example, to add a comment containing a double-quote and a configuration 410option: 411 412 RPI_EXTRA_CONFIG = ' \n \ 413 # Raspberry Pi 7\" display/touch screen \n \ 414 lcd_rotate=2 \n \ 415 ' 416## Enable Raspberry Pi Camera Module 417 418Raspberry Pi does not have the unicam device ( Raspberry Pi Camera ) enabled by default. 419Because this unicam device ( bcm2835-unicam ) as of now is used by libcamera opensource. 420So we have to explicitly enable it in local.conf. 421 422 RASPBERRYPI_CAMERA_V2 = "1" 423 424This will add the device tree overlay imx219 ( Raspberry Pi Camera Module V2 sensor driver 425) to config.txt. Also, this will enable adding Contiguous Memory Allocation value in the 426cmdline.txt. 427 428Similarly, the Raspberry Pi Camera Module v3 also has to be explicitly enabled in local.conf. 429 430 RASPBERRYPI_CAMERA_V3 = "1" 431 432This will add the device tree overlay imx708 ( Raspberry Pi Camera Module V3 sensor driver ) 433to config.txt. 434 435See: 436* <https://www.raspberrypi.com/documentation/computers/camera_software.html> 437* <https://www.raspberrypi.org/blog/an-open-source-camera-stack-for-raspberry-pi-using-libcamera/> 438 439## WM8960 soundcard support 440 441Support for WM8960 based sound cards such as the WM8960 Hi-Fi Sound Card HAT for Raspberry Pi from Waveshare, and ReSpeaker 2 / 4 / 6 Mics Pi HAT from Seeed Studio, can be enabled in `local.conf` 442 443 MACHINE_FEATURES += "wm8960" 444 445You may need to adjust volume and toggle switches that are off by default 446 447 amixer -c1 sset 'Headphone',0 80%,80% 448 amixer -c1 sset 'Speaker',0 80%,80% 449 amixer -c1 sset 'Left Input Mixer Boost' toggle 450 amixer -c1 sset 'Left Output Mixer PCM' toggle 451 amixer -c1 sset 'Right Input Mixer Boost' toggle 452 amixer -c1 sset 'Right Output Mixer PCM' toggle 453 454Audio capture on ReSpeaker 2 / 4 / 6 Mics Pi HAT from Seeed Studio is very noisy. 455 456## Support for RTC devices 457 458The RaspberryPi boards don't feature an RTC module and the machine 459configurations provided in this BSP layer have this assumption (until, if at 460all, some later boards will come with one). 461 462`rtc` is handled as a `MACHINE_FEATURES` in the context of the build system 463which means that if an attached device is provided for which support is needed, 464the recommended way forward is to write a new machine configuration based on an 465existing one. Check the documentation for 466`MACHINE_FEATURES_BACKFILL_CONSIDERED` for how this is disabled for the 467relevant machines. 468 469Even when `MACHINE_FEATURES` is tweaked to include the needed `rtc` string, 470make sure that your kernel configuration is supporting the attached device and 471the device tree is properly tweaked. Also, mind the runtime components that 472take advantage of your RTC device. You can do that by checking what is 473included/configured in the build system based on the inclusion of `rtc` in 474`MACHINE_FEATURES`. 475 476## Raspberry Pi Distro VLC 477 478To enable Raspberry Pi Distro VLC, the `meta-openembedded/meta-multimedia` layer must be 479included in your `bblayers.conf`. 480 481VLC does not support HW accelerated video decode through MMAL on a 64-bit OS. 482 483See: 484* <https://forums.raspberrypi.com/viewtopic.php?t=275370> 485* <https://forums.raspberrypi.com/viewtopic.php?t=325218#p1946169> 486 487MMAL is not enabled by default. To enable it add 488 489 DISABLE_VC4GRAPHICS = "1" 490 491to `local.conf`. Adding `vlc` to `IMAGE_INSTALL` will then default to building the oe-core 492implementation of ffmpeg and the meta-openembedded/meta-multimedia implementation of VLC. 493The Raspberry Pi's Distro implementation of VLC with HW accelerated video decode through 494MMAL and the Raspberry PI's Distro implementation of ffmpeg. Can however be selected via: 495 496 PREFERRED_PROVIDER_vlc = "rpidistro-vlc" 497 PREFERRED_PROVIDER_ffmpeg = "rpidistro-ffmpeg" 498 PREFERRED_PROVIDER_libav = "rpidistro-ffmpeg" 499 PREFERRED_PROVIDER_libpostproc = "rpidistro-ffmpeg" 500 501Usage example: Start VLC with mmal_vout plugin and without an active display server. 502 503 DISPLAYNUM=$(tvservice -l | tail -c 2) 504 MMAL_DISPLAY=$(expr $DISPLAYNUM + 1) 505 VLC_SETTINGS="-I dummy --vout=mmal_vout --mmal-resize --mmal-display hdmi-$MMAL_DISPLAY --no-dbus" 506 cvlc $VLC_SETTINGS <video/playlist> 507