2 title: Building for Raspberry Pi 4
6 [Raspberry Pi](https://www.raspberrypi.org/help/what-%20is-a-raspberry-pi/) is a small computer that is ideal for learning computing and computer languages.
7 The AGL Project supports building images for the
8 [Raspberry Pi 4](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) board.
9 These board comes in a variety of models.
11 [Raspberry Pi Product Page](https://www.raspberrypi.org/products/) for more information.
13 This section describes the steps you need to take to build the
14 AGL demo image for the Raspberry Pi 4 board.
16 ## 1. Making Sure Your Build Environment is Correct
19 "[Initializing Your Build Environment](./3_Initializing_Your_Build_Environment.md)"
20 section presented generic information for setting up your build environment
21 using the `aglsetup.sh` script.
22 If you are building the AGL demo image for a Raspberry Pi 4 board, you need to specify some
23 specific options when you run the script :
25 **Qt based IVI demo :**
28 $ source meta-agl/scripts/aglsetup.sh -f -m raspberrypi4 -b raspberrypi4 agl-demo agl-devel
29 $ echo '# reuse download directories' >> $AGL_TOP/site.conf
30 $ echo 'DL_DIR = "$HOME/downloads/"' >> $AGL_TOP/site.conf
31 $ echo 'SSTATE_DIR = "$AGL_TOP/sstate-cache/"' >> $AGL_TOP/site.conf
32 $ ln -sf $AGL_TOP/site.conf conf/
35 **HTML5 based IVI demo :**
38 $ source meta-agl/scripts/aglsetup.sh -f -m raspberrypi4 -b raspberrypi4 agl-demo agl-devel agl-profile-graphical-html5
39 $ echo '# reuse download directories' >> $AGL_TOP/site.conf
40 $ echo 'DL_DIR = "$HOME/downloads/"' >> $AGL_TOP/site.conf
41 $ echo 'SSTATE_DIR = "$AGL_TOP/sstate-cache/"' >> $AGL_TOP/site.conf
42 $ ln -sf $AGL_TOP/site.conf conf/
45 In each case, the "-m" option specifies the machine and the list of AGL features used with script are appropriate for development of
46 the AGL demo image suited for Raspberry Pi 4.
48 ## 2. Configuring the Build to Include Packages Under a Commercial License
50 Before launching the build, it is good to be sure your build
51 configuration is set up correctly (`/build/conf/local.conf` file).
52 The "[Customizing Your Build](./4_Customizing_Your_Build.md)"
53 section highlights some common configurations that are useful when
54 building any AGL image.
56 For the Raspberry Pi platforms, you need to take an additional
57 configuration step if you want to include any packages under a
60 For example, suppose you want to include an implementation of the
61 [OpenMAX](https://www.khronos.org/openmax/) Intagration Library
62 (`libomxil`) under a commercial license as part of your AGL image.
63 If so, you must include the following two lines in your
64 `/build/conf/local.conf` file:
68 LICENSE_FLAGS_WHITELIST = "commercial"
69 IMAGE_INSTALL_append = "libomxil"
74 This section shows the `bitbake` command used to build the AGL image.
76 Start the build using the `bitbake` command.
78 **NOTE:** An initial build can take many hours depending on your
79 CPU and and Internet connection speeds.
80 The build also takes approximately 100G-bytes of free disk space.
82 **Qt Based IVI demo :**
83 The target is `agl-demo-platform`.
86 $ time bitbake agl-demo-platform
89 By default, the build process puts the resulting image in the Build Directory and further exporting that as `$IMAGE_NAME`.
90 Here is example for the Raspberry Pi 4 board for Qt Based demo:
93 <build_dir>/tmp/deploy/images/raspberrypi4/agl-demo-platform-raspberrypi4.wic.xz
95 $ export IMAGE_NAME=agl-demo-platform-raspberrypi4.wic.xz
98 **HTML5 Based IVI demo :**
99 The target is `agl-demo-platform-html5`.
102 $ time bitbake agl-demo-platform-html5
105 By default, the build process puts the resulting image in the Build Directory and further exporting that as `$IMAGE_NAME`.
106 Here is example for the Raspberry Pi 4 board for HTML5 Based demo:
109 <build_dir>/tmp/deploy/images/raspberrypi4/agl-demo-platform-html5-raspberrypi4-64.wic.xz
111 $ export IMAGE_NAME=agl-demo-platform-html5-raspberrypi4-64.wic.xz
114 ## 4. Deploying the AGL Demo Image
116 Deploying the AGL demo image consists of copying the image on a MicroSD card,
117 plugging the card into the Raspberry Pi board, and then booting the board.
119 Follow these steps to copy the image to a MicroSD card and boot
120 the image on the Raspberry Pi 4 board:
122 1. Plug your MicroSD card into your Build Host (i.e. the system that has your build output).
124 2. Extract the image into the SD card of Raspberry Pi 4 :
126 **NOTE:** For Raspberry Pi 4, the image is at `<build-dir>/tmp/deploy/images/raspberrypi4/${IMAGE_NAME}`.
128 Be sure you are root, provide the actual device name for *sdcard_device_name*, and the actual image name for *image_name*.
132 $ sudo umount <sdcard_device_name>
133 $ xzcat ${IMAGE_NAME} | sudo dd of=<sdcard_device_name> bs=4M
137 **IMPORTANT NOTE:** Before re-writing any device on your Build Host, you need to
138 be sure you are actually writing to the removable MicroSD card and not some other
140 Each computer is different and removable devices can change from time to time.
141 Consequently, you should repeat the previous operation with the MicroSD card to
142 confirm the device name every time you write to the card.
144 To summarize this example so far, we have the following:
145 The first SATA drive is `/dev/sda` and `/dev/sdc` corresponds to the MicroSD card, and is also marked as a removable device.You can see this in the output of the `lsblk` command where "1" appears in the "RM" column for that device.
147 3. SSH into Raspberry Pi :
148 - Connect Raspberry Pi to network : `Homescreen > Settings`, IP address mentioned here.
152 $ ssh root@<Raspberry-Pi-ip-address>
155 4. Serial Debugging :
157 When things go wrong, you can take steps to debug your Raspberry Pi.
158 For debugging, you need a 3.3 Volt USB Serial cable to fascilitate
159 communication between your Raspberry Pi board and your build host.
161 You can reference the following diagram for information on the following steps:
163 ![](images/RaspberryPi2-ModelB-debug-serial-cable.png)
165 1. Connect the TTL cable to the Universal Asynchronous Receiver-Transmitter
166 (UART) connection on your Raspberry Pi board.
167 Do not connect the USB side of the cable to your build host at this time.
169 **CAUTION:** No warranty is provided using the following procedure.
170 Pay particular attention to the collors of your cable as they could
171 vary depending on the vendor.
173 2. Connect the cable's BLUE wire to pin 6 (i.e. Ground) of the UART.
175 3. Connect the able's GREEN RX line to pin 8 (i.e. the TXD line) of
178 4. Connect the cable's RED TX line to pin 10 (i.e. the RXD line) of
181 5. Plug the USB connector of the cable into your build host's USB port.
183 6. Use your favorite tool for serial communication between your build host
184 and your Raspberry Pi.
185 For example, if your build host is a native Linux machine (e.g. Ubuntu)
186 you could use `screen` as follows from a terminal on the build host:
189 $ sudo screen /dev/ttyUSB0 115200
194 Follow the step below to build AGL for Raspberry Pi with enabled software over
195 the air (SOTA) updates:
197 1. Include **agl-sota** feature.
199 2. In **bblayers.conf** replace meta-updater-qemux86-64 with
200 **meta-updater-raspberrypi**.
202 3. In **local.conf** set `SOTA_PACKED_CREDENTIALS` and `OSTREE_BRANCHNAME`.
204 More details are available [here](https://docs.ota.here.com/getstarted/dev/raspberry-pi.html).