AGL Building for Raspberry Pi 5/Pi 4
The [Raspberry Pi](https://www.raspberrypi.org/help/what– is-a-raspberry-pi/) is a small computer that is ideal for learning computing and computer languages. The AGL Project supports building images for the Raspberry Pi 5 board. These board comes in a variety of models. See the Raspberry Pi Product Page for more information.
This section describes the steps you need to take to build the AGL demo image for the Raspberry Pi 5 board.
0. Ubuntu and Debian Build Server
Currently, the 5.0.999 release (“Scarthgap”) of the Yocto Project is supported on the following distributions:
- Ubuntu 20.04 (LTS)
- Ubuntu 22.04 (LTS)
- Ubuntu 23.04
Here are the packages needed to build an image on a headless system with a supported Ubuntu or Debian Linux distribution:
$ sudo apt install build-essential chrpath cpio debianutils diffstat file gawk gcc git iputils-ping libacl1 liblz4-tool locales python3 python3-git python3-jinja2 python3-pexpect python3-pip python3-subunit socat texinfo unzip wget xz-utils zstd
You also need to ensure you have the en_US.UTF-8 locale enabled:
$ locale --all-locales | grep en_US.utf8
If this is not the case, you can reconfigure the locales package to add it (requires an interactive shell):
$ sudo dpkg-reconfigure locales
Note
-
If you are not in an interactive shell,
dpkg-reconfigurewill not work as expected. To add the locale you will need to edit/etc/locale.genfile to add/uncomment theen_US.UTF-8locale. A naive way to do this as root is:$ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen $ locale-gen -
If your build system has the
oss4-devpackage installed, you might experience QEMU build failures due to the package installing its own custom/usr/include/linux/soundcard.hon the Debian system. If you run into this situation, try either of these solutions:$ sudo apt build-dep qemu $ sudo apt remove oss4-dev
Here are the packages needed to build Project documentation manuals:
$ sudo apt install git librsvg2-bin locales make python3-saneyaml python3-sphinx-rtd-theme sphinx
In addition to the previous packages, here are the packages needed to build the documentation in PDF format:
$ sudo apt install fonts-freefont-otf latexmk tex-gyre texlive-fonts-extra texlive-fonts-recommended texlive-lang-all texlive-latex-extra texlive-latex-recommended texlive-xetex
1. Making Sure Your Build Environment is Correct
The "Initializing Your Build Environment" section presented generic information for setting up your build environment using the aglsetup.sh script. If you are building the AGL demo image for a Raspberry Pi 5 board, you need to specify some specific options when you run the script :
Note: for Pi4 board, replace "-m raspberrypi5" with "-m raspberrypi4" below.
ALL Setting Enabled:
agl -f -m raspberrypi5 -b rpi5-u24 agl-all-features
agl-cache
Qt based IVI demo :
$ source meta-agl/scripts/aglsetup.sh -f -m raspberrypi5 -b raspberrypi5 agl-demo agl-devel
$ echo "# reuse download directories" >> $AGL_TOP/site.conf
$ echo "DL_DIR = \"$HOME/downloads/\"" >> $AGL_TOP/site.conf
$ echo "SSTATE_DIR = \"$AGL_TOP/sstate-cache/\"" >> $AGL_TOP/site.conf
$ ln -sf $AGL_TOP/site.conf conf/
HTML5 based IVI demo :
$ source meta-agl/scripts/aglsetup.sh -f -m raspberrypi5 -b raspberrypi5 agl-demo agl-devel agl-profile-graphical-html5
$ echo "# reuse download directories" >> $AGL_TOP/site.conf
$ echo "DL_DIR = \"$HOME/downloads/\"" >> $AGL_TOP/site.conf
$ echo "SSTATE_DIR = \"$AGL_TOP/sstate-cache/\"" >> $AGL_TOP/site.conf
$ ln -sf $AGL_TOP/site.conf conf/
In each case, the "-m" option specifies the machine and the list of AGL features used with script are appropriate for development of the AGL demo image suited for Raspberry Pi 5.
2. Configuring the Build to Include Packages Under a Commercial License¶
Before launching the build, it is good to be sure your build configuration is set up correctly (/build/conf/local.conf file). The "Customizing Your Build" section highlights some common configurations that are useful when building any AGL image.
For the Raspberry Pi platforms, you need to take an additional configuration step if you want to include any packages under a commercial license.
For example, suppose you want to include an implementation of the OpenMAX Intagration Library (libomxil) under a commercial license as part of your AGL image. If so, you must include the following two lines in your /build/conf/local.conf file:
# For libomxil
LICENSE_FLAGS_WHITELIST = "commercial"
IMAGE_INSTALL_append = "libomxil"
3. Using BitBake
This section shows the bitbake command used to build the AGL image.
Start the build using the bitbake command.
NOTE: An initial build can take many hours depending on your CPU and and Internet connection speeds. The build also takes approximately 100G-bytes of free disk space.
Qt Based IVI demo : The target is agl-ivi-demo-qt.
$ time bitbake agl-ivi-demo-qt
By default, the build process puts the resulting image in the Build Directory and further exporting that as $IMAGE_NAME. Here is example for the Raspberry Pi 5 board for Qt Based demo:
/tmp/deploy/images/raspberrypi5/agl-ivi-demo-qt-raspberrypi5.rootfs.wic.xz
$ export IMAGE_NAME=agl-ivi-demo-qt-raspberrypi5.rootfs.wic.xz
Flutter Based IVI demo : The target is agl-ivi-demo-flutter.
$ time bitbake agl-ivi-demo-flutter
By default, the build process puts the resulting image in the Build Directory and further exporting that as $IMAGE_NAME. Here is example for the Raspberry Pi 5 board for HTML5 Based demo:
/tmp/deploy/images/raspberrypi5/agl-ivi-demo-rlutter-raspberrypi5-64.rootfs.wic.xz
$ export IMAGE_NAME=agl-ivi-demo-flutter-raspberrypi5-64.rootfs.wic.xz
4. Deploying the AGL Demo Image
Deploying the AGL demo image consists of copying the image on a MicroSD card, plugging the card into the Raspberry Pi board, and then booting the board.
Follow these steps to copy the image to a MicroSD card and boot the image on the Raspberry Pi 5 board:
-
Plug your MicroSD card into your Build Host (i.e. the system that has your build output).
-
Extract the image into the SD card of Raspberry Pi 5 :
NOTE: For Raspberry Pi 5, the image is at
<build-dir>/tmp/deploy/images/raspberrypi5/${IMAGE_NAME}.Be sure you are root, provide the actual device name for sdcard_device_name, and the actual image name for image_name.
$ lsblk $ sudo umount$ xzcat ${IMAGE_NAME} | sudo dd of= bs=4M $ sync IMPORTANT NOTE: Before re-writing any device on your Build Host, you need to be sure you are actually writing to the removable MicroSD card and not some other device. Each computer is different and removable devices can change from time to time. Consequently, you should repeat the previous operation with the MicroSD card to confirm the device name every time you write to the card.
To summarize this example so far, we have the following: The first SATA drive is
/dev/sdaand/dev/sdccorresponds to the MicroSD card, and is also marked as a removable device.You can see this in the output of thelsblkcommand where "1" appears in the "RM" column for that device. -
SSH into Raspberry Pi :
- Connect Raspberry Pi to network :
Homescreen > Settings, IP address mentioned here. - SSH :
$ ssh root@ - Connect Raspberry Pi to network :
-
Serial Debugging :
When things go wrong, you can take steps to debug your Raspberry Pi. For debugging, you need a 3.3 Volt USB Serial cable to fascilitate communication between your Raspberry Pi board and your build host.
You can reference the following diagram for information on the following steps:

-
Connect the TTL cable to the Universal Asynchronous Receiver-Transmitter (UART) connection on your Raspberry Pi board. Do not connect the USB side of the cable to your build host at this time.
CAUTION: No warranty is provided using the following procedure. Pay particular attention to the collors of your cable as they could vary depending on the vendor.
-
Connect the cable’s BLUE wire to pin 6 (i.e. Ground) of the UART.
-
Connect the able’s GREEN RX line to pin 8 (i.e. the TXD line) of the UART.
-
Connect the cable’s RED TX line to pin 10 (i.e. the RXD line) of the UART.
-
Plug the USB connector of the cable into your build host’s USB port.
-
Use your favorite tool for serial communication between your build host and your Raspberry Pi. For example, if your build host is a native Linux machine (e.g. Ubuntu) you could use
screenas follows from a terminal on the build host:
$ sudo screen /dev/ttyUSB0 115200 -
Next Building for Supported Renesas Boards
PreviousBuilding for x86 (Emulation and Hardware)
Documentation built with MkDocs using Windmill theme by Grist Labs.