Adding file naming and indexing
[AGL/documentation.git] / docs / 01_Getting_Started / 02_Building_AGL_Image / 09_Building_for_Supported_Renesas_Boards.md
1 ---
2 title: Building for Supported Renesas Boards
3 ---
4
5 AGL supports building for several automotive
6 [Renesas](https://www.renesas.com/us/en/solutions/automotive.html) board kits.
7 Renesas is the number one supplier of vehicle control microcontrollers and
8 System on a Chip (SoC) products for the automotive industry.
9
10 This section provides the build and deploy steps you need to create an
11 image for the following Renesas platforms:
12
13 * [Renesas R-Car Starter Kit Pro Board](https://www.elinux.org/R-Car/Boards/M3SK)
14 * [Renesas R-Car Starter Kit Premier Board](https://www.elinux.org/R-Car/Boards/H3SK)
15 * [Renesas Salvator-X Board](https://www.elinux.org/R-Car/Boards/Salvator-X)
16 * [Renesas Kingfisher Infotainment Board](https://elinux.org/R-Car/Boards/Kingfisher)
17
18 **NOTE:** You can find similar information for the Pro and Premier board kits on the
19 [R-Car/Boards/Yocto-Gen3](https://elinux.org/R-Car/Boards/Yocto-Gen3) page on [elinux.org](https://elinux.org).
20 The information on this page describes setup and build procedures for both of these
21 Renesas development kits.
22
23 Additionally, the AGL Reference Hardware platform is based on the same Renesas
24 H3 processor used on the Renesas R-Car Starter Kit Premier and Salvator-X boards,
25 so support for it leverages the Starter Kit Premier (also known as "h3ulcb")
26 build.
27 For more information on the AGL reference hardware platform, please refer to its
28 [manual](https://wiki.automotivelinux.org/_media/eg-rhsa/rh_manual_ver.1.0.pdf),
29 or the Reference Hardware System Architecture Expert Group
30 [wiki page](https://wiki.automotivelinux.org/eg-rhsa).
31
32 ## 1. Prepare your build
33
34 ### 1.1 Downloading Proprietary Drivers
35
36 Before setting up the build environment, you need to download proprietary drivers from the
37 [R-Car H3/M3 Software library and Technical document](https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-documents-software)
38 site.
39
40 Follow these steps to download the drivers you need:
41
42 1. **Determine the Files You Need:**
43
44     Run the ``setup_mm_packages.sh`` script as follows to
45     display the list of ZIP files containing the drivers you need.
46     Following is an example:
47
48     ```sh
49     grep -rn ZIP_.= $AGL_TOP/meta-agl/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh
50     ```
51
52     The script's output identifies the files you need to download from the page.
53
54 2. **Get Your Board Support Package (BSP) Version:**
55
56     Be sure to have the correct BSP version of the R-Car Starter Kit
57     based on the version of the AGL software you are using.
58     Find the appropriate download links on the
59     [R-Car H3/M3 Software library and Technical document](https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-documents-software)
60     site.
61     The file pairs are grouped according to the Yocto Project version you are
62     using with the AGL software.
63
64     Use the following table to map the Renesas version to your AGL software:
65
66     | AGL Version | Renesas version |
67     |:-:|:-:|
68     | AGL master | 5.9.0 |
69
70 3. **Download the Files:**
71
72     Start the download process by clicking the download link.
73     If you do not have an account with Renesas, you will be asked to register a free account.
74     You must register and follow the "Click Through" licensing process
75     in order to download these proprietary files.
76
77     If needed, follow the instructions to create the free account by providing the required
78     account information.
79     Once the account is registered and you are logged in, you can download the files.
80
81     **NOTE:** You might have to re-access the
82     [original page](https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-documents-software)
83     that contains the download links you need after creating the account and logging in.
84
85 4. **Create an Environment Variable to Point to Your Download Area:**
86
87     Create and export an environment variable named `XDG_DOWNLOAD_DIR` that points to
88     your download directory.
89     Here is an example:
90
91     ```sh
92     export XDG_DOWNLOAD_DIR=$HOME/Downloads
93     ```
94
95 5. **Be Sure the Files Have Rights:**
96
97     Be sure you have the necessary rights for the files you downloaded.
98     You can use the following command:
99
100     ```sh
101     chmod a+rw $XDG_DOWNLOAD_DIR/*.zip
102     ```
103
104 6. **Check to be Sure the Files are Downloaded and Have the Correct Rights:**
105
106     Do a quick listing of the files to ensure they are in the download directory and
107     they have the correct access rights.
108     Here is an example:
109
110     ```sh
111     $ ls -l $XDG_DOWNLOAD_DIR/*.zip
112     -rw-rw-r-- 1 scottrif scottrif 4662080 Nov 19 14:48 /home/scottrif/Downloads/R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston8-20200923.zip
113     -rw-rw-r-- 1 scottrif scottrif 3137626 Nov 19 14:49 /home/scottrif/Downloads/R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston8-20200923.zip
114     ```
115
116 ### 1.2. Getting More Software
117
118 1. **Get the `bmaptool`:**
119
120     Download this tool from the
121     [bmap-tools](https://build.opensuse.org/package/show/isv:LinuxAutomotive:AGL_Master/bmap-tools)
122     repository.
123     The site has pre-built packages (DEB or RPM) for the supported host
124     operating systems.
125
126 ### 1.3. Getting Your Hardware Together
127
128 Gather together this list of hardware items, which is not exhaustive.
129 Having these items ahead of time saves you from having to try and
130 collect hardware during development:
131
132 * Supported Starter Kit Gen3 board with its 5V power supply.
133 * Micro USB-A cable for serial console.
134     This cable is optional if you are using Ethernet and an SSH connection.
135 * USB 2.0 Hub.  The hub is optional but makes it easy to connect multiple USB devices.
136 * Ethernet cable.  The cable is optional if you are using a serial console.
137 * HDMI type D (Micro connector) cable and an associated display.
138 * 4 Gbyte minimum MicroSD Card.  It is recommended that you use a class 10 type.
139 * USB touch screen device such as the GeChic 1502i/1503i.  A touch screen device is optional.
140
141 **NOTE:** The Salvator-X Board has NDA restrictions.
142 Consequently, less documentation is available for this board both here and across the
143 Internet.
144
145 ### 1.4. Making Sure Your Build Environment is Correct
146
147 The
148 "[Initializing Your Build Environment](./04_Initializing_Your_Build_Environment.md)"
149 section presented generic information for setting up your build environment
150 using the `aglsetup.sh` script.
151 If you are building an image for a supported Renesas board,
152 you need to take steps to make sure your build host is set up correctly.
153
154 1. **Define Your Board:**
155
156     Depending on your Renesas board, define and export a `MACHINE` variable as follows:
157
158     | Board | `MACHINE` Setting |
159     |:-:|:-:|
160     | Starter Kit Pro/M3  | `MACHINE`=m3ulcb |
161     | Starter Kit Pro/M3 + kingfisher support | `MACHINE`=m3ulcb-kf |
162     | Starter Kit Pro/M3 without graphic driver (using pixman)  | `MACHINE`=m3ulcb-nogfx |
163     | Starter Kit Premier/H3  | `MACHINE`=h3ulcb |
164     | Starter Kit Premier/H3  + kingfisher support  | `MACHINE`=h3ulcb-kf |
165     | Starter Kit Premier/H3  without graphic driver (using pixman)  | `MACHINE`=h3ulcb-nogfx |
166     | Salvator-X  | `MACHINE`=h3-salvator-x |
167     | AGL Reference Hardware | `MACHINE`=h3ulcb |
168     | AGL Reference Hardware  without graphic driver (using pixman)  | `MACHINE`=h3ulcb-nogfx |
169
170     For example, the following command defines and exports the `MACHINE` variable
171     for the Starter Kit Premier/H3 Board:
172
173     ```sh
174     export MACHINE=h3ulcb
175     ```
176
177 ### 1.5. **Run the `aglsetup.sh` Script:**
178
179 Use the following commands to run the AGL Setup script:
180
181 ```sh
182 cd $AGL_TOP
183 source meta-agl/scripts/aglsetup.sh -m $MACHINE -b build agl-devel agl-demo
184 ```
185
186 **NOTE:**
187 To avoid useless download and rebuild, it's important to set the variable DL_DIR and SSTATE_DIR in your configuration.
188
189 ```sh
190 echo "# reuse download directories" >> $AGL_TOP/site.conf
191 echo "DL_DIR = \"$HOME/downloads/\"" >> $AGL_TOP/site.conf
192 echo "SSTATE_DIR = \"$AGL_TOP/sstate-cache/\"" >> $AGL_TOP/site.conf
193 ln -sf $AGL_TOP/site.conf conf/
194 ```
195
196 **Reference Hardware :**
197
198 If building for the AGL Reference Hardware (with `MACHINE` set to "h3ulcb" or
199 "h3ulcb-nogfx"), add `agl-refhw-h3`, for example:
200
201 ```sh
202 cd $AGL_TOP
203 source meta-agl/scripts/aglsetup.sh -m $MACHINE -b build agl-devel agl-demo agl-refhw-h3
204 ```
205
206 **HTML5 based IVI demo :**
207
208 For HTML5 based IVI demo the feature "agl-profile-graphical-html5" is needed.
209
210 ```sh
211 $ source meta-agl/scripts/aglsetup.sh -f -m $MACHINE -b $MACHINE agl-demo agl-devel agl-profile-graphical-html5
212 ```
213
214 **Instrument Cluster with Container isolation demo :**
215
216 ```sh
217 $ source meta-agl/scripts/aglsetup.sh -f -m $MACHINE -b $MACHINE agl-lxc
218 ```
219
220 **NOTE:**
221 You can check if your logs match what is expected in the [troubleshooting section](#4-troubleshooting).
222
223 Running the `aglsetup.sh` script automatically places you in the
224 working directory (i.e. `$AGL_TOP/build`).
225 You can change this default behavior by adding the "-f" option to the
226 script's command line.
227
228 In the previous command, the "-m" option sets your machine to the previously
229 defined `MACHINE` variable.
230 The "-b" option defines your Build Directory, which is the
231 default `$AGL_TOP/build`.
232 Finally, the AGL features are provided to support building the AGL Demo image
233 for the Renesas board.
234
235 You can learn more about the AGL Features in the
236 "[Initializing Your Build Environment](./04_Initializing_Your_Build_Environment.md)"
237 section.
238
239 ## 2. Using BitBake
240
241 This section shows the `bitbake` command used to build the AGL image.
242 Before running BitBake to start your build, it is good to be reminded that AGL
243 does provide pre-built images for developers that work with supported hardware.
244 You can find these pre-built images on the
245 [AGL Download web site](https://download.automotivelinux.org/AGL/release).
246
247 Start the build using the `bitbake` command.
248
249 **NOTE:** An initial build can take many hours depending on your
250 CPU and and Internet connection speeds.
251 The build also takes approximately 100G-bytes of free disk space.
252
253 **Qt based IVI demo :**
254 For this example, the target is "agl-demo-platform":
255
256 ```sh
257 bitbake agl-demo-platform
258 ```
259
260 **HTML5 based IVI demo :**
261 The target is `agl-demo-platform-html5`.
262
263 ```sh
264 $ time bitbake agl-demo-platform-html5
265 ```
266
267 **Instrument Cluster with Container isolation demo :**
268 The target is `lxc-host-image-demo`.
269
270 ```sh
271 $ time bitbake lxc-host-image-demo
272 ```
273
274 The build process puts the resulting image in the Build Directory:
275
276 ```sh
277 <build_directory>/tmp/deploy/images/$MACHINE
278 ```
279
280 ## 3. Deploying the AGL Demo Image
281
282 To boot your image on the Renesas board, you need to do three things:
283
284 1. [Update all firmware on the board.](#4-troubleshooting)
285 2. Prepare the MicroSD card to you can boot from it.
286 3. Boot the board.
287
288 **NOTE:** For subsequent builds, you only have to re-write the MicroSD
289 card with a new image.
290
291 ### 3.1. Booting the Image Using a MicroSD Card
292
293 1. Preparing the MicroSD Card
294
295     Plug the MicroSD card into your Build Host.
296     After plugging in the device, use the `dmesg` command as follows to
297     discover the device name:
298
299     ```sh
300     $ dmesg | tail -4
301     [ 1971.462160] sd 6:0:0:0: [sdc] Mode Sense: 03 00 00 00
302     [ 1971.462277] sd 6:0:0:0: [sdc] No Caching mode page found
303     [ 1971.462278] sd 6:0:0:0: [sdc] Assuming drive cache: write through
304     [ 1971.463870]  sdc: sdc1 sdc2
305     ```
306
307     In the previous example, the MicroSD card is attached to the device `/dev/sdc`.
308     You can also use the `lsblk` command to show all your devices.
309     Here is an example that shows the MicroSD card as `/dev/sdc`:
310
311     ```sh
312     $ lsblk
313     NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
314     sda      8:0    0 167,7G  0 disk
315     ├─sda1   8:1    0   512M  0 part /boot/efi
316     ├─sda2   8:2    0 159,3G  0 part /
317     └─sda3   8:3    0   7,9G  0 part [SWAP]
318     sdb      8:16   0 931,5G  0 disk
319     └─sdb1   8:17   0 931,5G  0 part /media/storage
320     sdc      8:32   1  14,9G  0 disk
321     ├─sdc1   8:33   1    40M  0 part
322     └─sdc2   8:34   1   788M  0 part
323     ```
324
325     **IMPORTANT NOTE:** Before re-writing any device on your Build Host, you need to
326     be sure you are actually writing to the removable MicroSD card and not some other
327     device.
328     Each computer is different and removable devices can change from time to time.
329     Consequently, you should repeat the previous operation with the MicroSD card to
330     confirm the device name every time you write to the card.
331
332     To summarize this example so far, we have the following:
333
334     * The first SATA drive is `/dev/sda`.
335
336     * `/dev/sdc` corresponds to the MicroSD card, and is also marked as a removable device.
337     You can see this in the output of the `lsblk` command where "1" appears in the "RM" column
338     for that device.
339
340     Now that you have identified the device you are going to be writing the image on,
341     you can use the `bmaptool` to copy the image to the MicroSD card.
342
343     Your desktop system might offer a choice to mount the MicroSD automatically
344     in some directory.
345     For this example, assume that the MicroSD card mount directory is stored in the
346     `$SDCARD` variable.
347
348     Following are example commands that write the image to the MicroSD card:
349
350     ```sh
351     cd $AGL_TOP/build/tmp/deploy/images/$MACHINE
352     bmaptool copy ./agl-demo-platform-$MACHINE.wic.xz <boot_device_name>
353     ```
354
355     Alternatively, you can leave the image in an uncompressed state and write it
356     to the MicroSD card:
357
358     ```sh
359     sudo umount <boot_device_name>
360     xzcat ./agl-demo-platform-$MACHINE.wic.xz | sudo dd of=<boot_device_name> bs=4M
361     sync
362     ```
363
364 2. Booting the Board
365
366     Follow these steps to boot the board:
367
368     1. Use the board's power switch to turn off the board.
369
370     2. Insert the MicroSD card into the board.
371
372     3. Verify that you have plugged in the following:
373
374         * An external monitor into the board's HDMI port
375
376         * An input device (e.g. keyboard, mouse, touchscreen, and so forth) into the board's USB ports.
377
378     4. Use the board's power switch to turn on the board.
379
380     After a few seconds, you will see the AGL splash screen on the display and you
381     will be able to log in at the console's terminal or using the graphic screen.
382
383 ### 3.2. Setting Up the Serial Console
384
385 Setting up the Serial Console involves the following:
386
387 * Installing a serial client on your build host
388 * Connecting your build host to your Renesas board's serial port
389 * Powering on the board to get a shell at the console
390 * Configuring U-Boot parameters
391 * Logging into the console
392 * Determining the board's IP address
393
394 1. Installing a Serial Client on Your Build Host
395
396     You need to install a serial client on your build host.
397     Some examples are:
398
399     * [GNU Screen](https://en.wikipedia.org/wiki/GNU_Screen)
400     * [picocom](https://linux.die.net/man/8/picocom)
401     * [Minicom](https://en.wikipedia.org/wiki/Minicom)
402
403     Of these three, "picocom" has the least dependencies and is therefore
404     considered the "lightest" solution.
405
406 2. Connecting Your Build Host to Your Renesas Board's Serial Port
407
408     You need to physically connect your build host to the Renesas board using
409     a USB cable from the host to the serial CP2102 USP port (i.e. Micro USB-A port)
410     on the Renesas board.
411
412     Once you connect the board, determine the device created for the serial link.
413     Use the ``dmesg`` command on your build host.
414     Here is an example:
415
416     ```sh
417     dmesg | tail 9
418     [2097783.287091] usb 2-1.5.3: new full-speed USB device number 24 using ehci-pci
419     [2097783.385857] usb 2-1.5.3: New USB device found, idVendor=0403, idProduct=6001
420     [2097783.385862] usb 2-1.5.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
421     [2097783.385864] usb 2-1.5.3: Product: FT232R USB UART
422     [2097783.385866] usb 2-1.5.3: Manufacturer: FTDI
423     [2097783.385867] usb 2-1.5.3: SerialNumber: AK04WWCE
424     [2097783.388288] ftdi_sio 2-1.5.3:1.0: FTDI USB Serial Device converter detected
425     [2097783.388330] usb 2-1.5.3: Detected FT232RL
426     [2097783.388658] usb 2-1.5.3: FTDI USB Serial Device converter now attached to ttyUSB0
427     ```
428
429     The device created is usually "/dev/ttyUSB0".
430     However, the number might vary depending on other USB serial ports connected to the host.
431
432     To use the link, you need to launch the client.
433     Here are three commands, which vary based on the serial client, that show
434     how to launch the client:
435
436     ```sh
437     picocom -b 115200 /dev/ttyUSB0
438     ```
439
440     or
441
442     ```sh
443     minicom -b 115200 -D /dev/ttyUSB0
444     ```
445
446     or
447
448     ```sh
449     screen /dev/ttyUSB0 115200
450     ```
451
452 3. Powering on the Board to Get a Shell at the Console
453
454     Both the Pro and Premier kits (e.g.
455     [m3ulcb](https://elinux.org/R-Car/Boards/M3SK) and
456     [h3ulcb](https://elinux.org/R-Car/Boards/H3SK#Hardware)) have nine
457     switches (SW1 through SW9).
458     To power on the board, "short-press" SW8, which is the power switch.
459
460     Following, is console output for the power on process for each kit:
461
462     **h3ulcb**:
463
464     ```text
465     NOTICE:  BL2: R-Car Gen3 Initial Program Loader(CA57) Rev.1.0.7
466     NOTICE:  BL2: PRR is R-Car H3 ES1.1
467     NOTICE:  BL2: LCM state is CM
468     NOTICE:  BL2: DDR1600(rev.0.15)
469     NOTICE:  BL2: DRAM Split is 4ch
470     NOTICE:  BL2: QoS is Gfx Oriented(rev.0.30)
471     NOTICE:  BL2: AVS setting succeeded. DVFS_SetVID=0x52
472     NOTICE:  BL2: Lossy Decomp areas
473     NOTICE:       Entry 0: DCMPAREACRAx:0x80000540 DCMPAREACRBx:0x570
474     NOTICE:       Entry 1: DCMPAREACRAx:0x40000000 DCMPAREACRBx:0x0
475     NOTICE:       Entry 2: DCMPAREACRAx:0x20000000 DCMPAREACRBx:0x0
476     NOTICE:  BL2: v1.1(release):41099f4
477     NOTICE:  BL2: Built : 19:20:52, Jun  9 2016
478     NOTICE:  BL2: Normal boot
479     NOTICE:  BL2: dst=0xe63150c8 src=0x8180000 len=36(0x24)
480     NOTICE:  BL2: dst=0x43f00000 src=0x8180400 len=3072(0xc00)
481     NOTICE:  BL2: dst=0x44000000 src=0x81c0000 len=65536(0x10000)
482     NOTICE:  BL2: dst=0x44100000 src=0x8200000 len=524288(0x80000)
483     NOTICE:  BL2: dst=0x49000000 src=0x8640000 len=1048576(0x100000)
484
485
486     U-Boot 2015.04 (Jun 09 2016 - 19:21:52)
487
488     CPU: Renesas Electronics R8A7795 rev 1.1
489     Board: H3ULCB
490     I2C:   ready
491     DRAM:  3.9 GiB
492     MMC:   sh-sdhi: 0, sh-sdhi: 1
493     In:    serial
494     Out:   serial
495     Err:   serial
496     Net:   Board Net Initialization Failed
497     No ethernet found.
498     Hit any key to stop autoboot:  0
499     =>
500     ```
501
502 ### 3.3. Setting-up U-boot
503
504 Configuring U-Boot Parameters
505
506 Follow these steps to configure the board to use the MicroSD card as the
507 boot device and also to set the screen resolution:
508
509 1. As the board is powering up, press any key to stop the autoboot process.
510 You need to press a key quickly as you have just a few seconds in which to
511 press a key.
512
513 2. Once the autoboot process is interrupted, use the board's serial console to
514 enter `printenv` to check if you have correct parameters for booting your board:
515
516     Here is an example using the **h3ulcb** board:
517
518     ```sh
519     => printenv
520     baudrate=115200
521     bootargs=console=ttySC0,115200 root=/dev/mmcblk1p1 rootwait ro rootfstype=ext4
522     bootcmd=run load_ker; run load_dtb; booti 0x48080000 - 0x48000000
523     bootdelay=3
524     fdt_high=0xffffffffffffffff
525     initrd_high=0xffffffffffffffff
526     load_dtb=ext4load mmc 0:1 0x48000000 /boot/r8a7795-h3ulcb.dtb
527     load_ker=ext4load mmc 0:1 0x48080000 /boot/Image
528     stderr=serial
529     stdin=serial
530     stdout=serial
531     ver=U-Boot 2015.04 (Jun 09 2016 - 19:21:52)
532
533     Environment size: 648/131068 bytes
534     ```
535
536 3. To boot your board using the MicroSD card, be sure your environment is set up
537 as follows:
538
539     ```sh
540     setenv bootargs console=ttySC0,115200 ignore_loglevel vmalloc=384M video=HDMI-A-1:1920x1080-32@60 root=/dev/mmcblk1p1 rw rootfstype=ext4 rootwait rootdelay=2
541     setenv bootcmd run load_ker\; run load_dtb\; booti 0x48080000 - 0x48000000
542     setenv load_ker ext4load mmc 0:1 0x48080000 /boot/Image
543     ```
544
545 4. Loading dtb :
546
547     **NOTE** : Refer [here](https://elinux.org/R-Car/Boards/Yocto-Gen3-CommonFAQ/Which_dtb_file_is_required_to_boot_linux_on_the_R-Car_Starter_Kit_board_%3F) for more information.
548
549     Make sure your ``load_dtb`` is set as follows :
550
551     | Renesas Boards | DTB Name |
552     |:-:|:-:|
553     | **H3SK v2.0(DDR 4GB)** | r8a7795-h3ulcb.dtb |
554     | **H3SK v2.0(DDR 8GB)/v3.0(DDR 8GB)** | r8a7795-h3ulcb-4x2g.dtb |
555     | **M3SK v1.0** | r8a7796-m3ulcb.dtb |
556     | **M3SK v3.0** | r8a7796-m3ulcb-2x4g.dtb |
557     | **H3SK with a Kingfisher board** | r8a7795-h3ulcb-kf.dtb |
558     | **M3SK with a Kingfisher board** | r8a7796-m3ulcb-kf.dtb |
559     | **AGL Reference Hardware board** | r8a7795-agl-refhw.dtb |
560
561     ```sh
562     setenv load_dtb ext4load mmc 0:1 0x48000000 /boot/r8a7795-h3ulcb-kf.dtb
563     ```
564
565 5. Save the boot environment:
566
567     ```sh
568     saveenv
569     ```
570
571 6. Boot the board:
572
573     ```sh
574     run bootcmd
575     ```
576
577 ## 4. Troubleshooting
578
579 ### 4.1. Checking Your Configuration
580
581 Aside from environment variables and parameters you establish through
582 running the `aglsetup.sh` script, you can ensure your build's configuration
583 is just how you want it by examining the `local.conf` configuration file.
584
585 You can find this configuration file in the Build Directory (e.g.
586 `$TOP_DIR/build/conf/local.conf`).
587
588 In general, the defaults along with the configuration fragments the
589 `aglsetup.sh` script applies in the `local.conf` file are good enough.
590 However, you can customize aspects by editing the `local.conf` file.
591 See the
592 "[Customizing Your Build](05_Customizing_Your_Build.md)"
593 section for common configurations you might want to consider.
594
595 **NOTE:** For detailed explanations of the configurations you can make
596 in the ``local.conf`` file, consult the
597 [Yocto Project Documentation](https://www.yoctoproject.org/docs/).
598
599 A quick way to see if you have the `$MACHINE` variable set correctly
600 is to use the following command:
601
602 ```sh
603 grep -w -e "^MACHINE =" $AGL_TOP/build/conf/local.conf
604 ```
605
606 Depending on the Renesas board you are using, you should see output
607 as follows:
608
609 ```sh
610 MACHINE = "h3ulcb"
611 ```
612
613 or
614
615 ```sh
616 MACHINE = "m3ulcb"
617 ```
618
619 or
620
621 ```sh
622 MACHINE = "h3-salvator-x"
623 ```
624
625 If you ran the `aglsetup.sh` script as described in the
626 "[Making Sure Your Build Environment is Correct](#14-making-sure-your-build-environment-is-correct)"
627 section earlier, the "agl-devel", "agl-demo", "agl-netboot", "agl-appfw-smack", and
628 "agl-localdev" AGL features will be in effect.
629 These features provide the following:
630
631 * A debugger (gdb)
632 * Some tweaks, including a disabled root password
633 * A SFTP server
634 * The TCF Agent for easier application deployment and remote debugging
635 * Some extra system tools such as USB and bluetooth
636 * Support for the AGL demo platform
637 * Network boot support through TFTP and NBD protocols
638 * [IoT.bzh](https://iot.bzh/en/) Application Framework plus
639 [SMACK](https://en.wikipedia.org/wiki/Smack_(software)) and
640 [Cynara](https://wiki.tizen.org/Security:Cynara)
641 * Support for local development including `localdev.inc` when present
642
643 ### 4.2. Check the Script's Log:
644
645 Running the `aglsetup.sh` script creates the `setup.log` file, which is in
646 the `build/conf` folder.
647 You can examine this log to see the results of the script.
648 For example, suppose the graphics drivers were missing or could not be extracted
649 when you ran the script.
650 In case of missing graphics drivers, you could notice an error message
651 similar to the following:
652
653 ```text
654 [snip]
655 --- fragment /home/working/workspace_agl_master/meta-agl/templates/machine/h3ulcb/50_setup.sh
656 /home/working/workspace_agl_master /home/working/workspace_agl_master/build_gen3
657 The graphics and multimedia acceleration packages for
658 the R-Car Gen3 board can be downloaded from:
659 https://www.renesas.com/en-us/solutions/automotive/rcar-demoboard-2.html
660
661 These 2 files from there should be store in your'/home/devel/Downloads' directory.
662     R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston8-20200923.zip
663     R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston8-20200923.zip
664 /home/working/workspace_agl_master/build_gen3
665 --- fragment /home/working/workspace_agl_master/meta-agl/templates/base/99_setup_EULAconf.sh
666 --- end of setup script
667 OK
668 Generating setup file: /home/working/workspace_agl_master/build_gen3/agl-init-build-env ... OK
669 ------------ aglsetup.sh: Done
670 [snip]
671 ```
672
673 If you encounter this issue, or any other unwanted behavior, you can fix the error
674 mentioned, remove the `$AGL_TOP/build` directory, and then re-launch the
675 `aglsetup.sh` again.
676
677 Here is another example that indicates the driver files could not be extracted from the downloads directory:
678
679 ```text
680 ~/workspace_agl/build/conf $ cat setup.log
681 --- beginning of setup script
682 --- fragment /home/working/workspace_agl/meta-agl/templates/base/01_setup_EULAfunc.sh
683 --- fragment /home/working/workspace_agl/meta-agl/templates/machine/h3ulcb/50_setup.sh
684 ~/workspace_agl ~/workspace_agl/build
685 ERROR: FILES "+/home/working/Downloads/R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston8-20200923.zip+" NOT EXTRACTING CORRECTLY
686 ERROR: FILES "+/home/working/Downloads/R-car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston8-20200923.zip+" NOT EXTRACTING CORRECTLY
687 The graphics and multimedia acceleration packages for
688 the R-Car Gen3 board BSP can be downloaded from:
689 <https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-documents-software>
690
691 These 2 files from there should be stored in your
692 '/home/working/Downloads' directory.
693     R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston8-20200923.zip
694     R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston8-20200923.zip
695 ERROR: Script /home/working/workspace_agl/build/conf/setup.sh failed
696 [snip]
697 ```
698
699 ### 4.3. Updating the Board's Firmware
700
701 Follow these steps to update the firmware:
702
703 1. **Update the Sample Loader and MiniMonitor:**
704
705     You only need to make these updates one time per device.
706
707     Follow the procedure found on the
708     eLinux.org wiki to update to at least version 3.02,
709     which is mandatory to run the AGL image
710     ([R-car loader update](https://elinux.org/R-Car/Boards/Kingfisher#How_to_update_of_Sample_Loader_and_MiniMonitor)).
711
712 2. **Update the Firmware Stack:**
713
714     You only need to update the firmware stack if you are
715     using the Eel or later (5.0) version of AGL software.
716
717     M3 and H3 Renesas board are AArch64 platforms.
718     As such, they have a firmware stack that is divided across: **ARM Trusted Firmware**, **OP-Tee** and **U-Boot**.
719
720     If you are using the Eel (5.0) version or later of the AGL software, you must update
721     the firmware using the **[h3ulcb] [R-car h3ulcb firmware update](http://elinux.org/R-Car/Boards/H3SK#Flashing_firmware)**
722     or **[m3ulcb] [R-car m3ulcb firmware update](https://elinux.org/R-Car/Boards/M3SK#Flashing_firmware)** links from the
723     [Embedded Linux Wiki](https://www.elinux.org/Main_Page) (i.e. `elinux.org`).
724
725     The table in the wiki lists the files you need to flash the firmware.
726     You can find these files in the following directory:
727
728     ```sh
729     $AGL_TOP/build/tmp/deploy/images/$MACHINE
730     ```
731
732     **NOTE:** The Salvator-X firmware update process is not documented on eLinux.
733     **NOTE:** The AGL Reference Hardware board generally should not require a
734     firmware update to be usable, and has a slightly different update procedure.
735     If you do need to update the firmware, the procedure is documented
736     [here](https://git.automotivelinux.org/AGL/meta-agl-refhw/tree/meta-agl-refhw-gen3/docs/ReferenceHW_Rcar_gen3.md).
737
738 ### 4.4. Logging Into the Console
739
740 Once the board boots, you should see the
741 [Wayland display](https://en.wikipedia.org/wiki/Wayland_(display_server_protocol))
742 on the external monitor.
743 A login prompt should appear as follows depending on your board:
744
745 **h3ulcb** or **AGL Reference Hardware**:
746
747 ```text
748 Automotive Grade Linux ${AGL_VERSION} h3ulcb ttySC0
749
750 h3ulcb login: root
751 ```
752
753 At the prompt, login by using `root` as the login.
754 The password is "empty" so you should not be prompted for the password.
755
756 ### 4.5. Determining the Board's IP Address
757
758 If your board is connected to a local network using Ethernet and
759 if a DHCP server is able to distribute IP addresses,
760 you can determine the board's IP address and log in using `ssh`.
761
762 Here is an example for the **h3ulcb** board:
763
764 ```sh
765 h3ulcb login: root
766 Last login: Tue Dec  6 09:55:15 UTC 2016 on tty2
767 root@h3ulcb:~# ip -4 a
768 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
769     inet 127.0.0.1/8 scope host lo
770     valid_lft forever preferred_lft forever
771 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
772     inet 10.0.0.27/24 brd 10.0.0.255 scope global eth0
773     valid_lft forever preferred_lft forever
774 root@h3ulcb:~#
775 ```
776
777 In the previous example, IP address is 10.0.0.27.
778 Once you know the address, you can use `ssh` to login.
779 Following is an example that shows logging into SSH and then
780 displaying the contents of the `/etc/os-release` file:
781
782 ```sh
783 $ ssh root@10.0.0.27
784 Last login: Tue Dec  6 10:01:11 2016 from 10.0.0.13
785 root@h3ulcb:~# cat /etc/os-release
786 ID="poky-agl"
787 NAME="Automotive Grade Linux"
788 VERSION="11.0.0+snapshot-20210128 (koi)"
789 VERSION_ID="11.0.0-snapshot-20210128"
790 PRETTY_NAME="Automotive Grade Linux 11.0.0+snapshot-20210128 (koi)"
791 ```
792
793 ## 5. Supplementary Information
794
795 ### 5.1. R-Car Generation 3 Information
796
797 Refer to the [R-Car](https://elinux.org/R-Car) page on the
798 [elinux.org](https://elinux.org) website for more information.
799
800 ### 5.2. Proprietary libraries for meta-rcar-gen3
801
802 The meta-rcar-gen3 layer of meta-renesas supports Graphic GLES(GSX)
803 libraries, proprietary multimedia libraries, and ICCOM software.
804
805 ### 5.3. Build with Renesas multimedia libraries
806
807 Multimedia portions depend on GLES portions.
808
809 * A. Configuration for Multimedia features
810
811     * Please copy proprietary libraries to the directory of recipes.
812
813     * Please set local.conf the following.
814
815         **Enable multimedia features. This provides package group of plug-ins of the GStreamer, multimedia libraries and kernel drivers.**
816
817         ```sh
818         MACHINE_FEATURES:append = " multimedia"
819         ```
820
821 * B. Configuration for optional codecs and middleware
822
823     * Please copy proprietary libraries to the directory of recipes.
824
825     * Add features to `DISTRO_FEATURES:append` to local.conf
826
827         **Additional configuration in OMX module**:
828
829         ```text
830         " h263dec_lib"       - for OMX Media Component H263 Decoder Library
831         " h264dec_lib"       - for OMX Media Component H264 Decoder Library
832         " h264enc_lib"       - for OMX Media Component H.264 Encoder Library
833         " h265dec_lib"       - for OMX Media Component H265 Decoder Library
834         " mpeg2dec_lib"      - for OMX Media Component MPEG2 Decoder Library
835         " mpeg4dec_lib"      - for OMX Media Component MPEG4 Decoder Library
836         " vc1dec_lib"        - for OMX Media Component VC-1 Decoder Library
837         " divxdec_lib"       - for OMX Media Component DivX Decoder Library
838         " rvdec_lib"         - for OMX Media Component RealVideo Decoder Library
839         " alacdec_lib"       - for OMX Media Component ALAC Decoder Library
840         " flacdec_lib"       - for OMX Media Component FLAC Decoder Library
841         " aaclcdec_lib"      - for OMX Media Component AAC-LC Decoder Library
842         " aaclcdec_mdw"      - for AAC-LC 2ch Decoder Middleware for Linux
843         " aacpv2dec_lib"     - for OMX Media Component aacPlus V2 Decoder Library
844         " aacpv2dec_mdw"     - for aacPlus V2 Decoder Middleware for Linux
845         " mp3dec_lib"        - for OMX Media Component MP3 Decoder Library
846         " mp3dec_mdw"        - for MP3 Decoder Middleware for Linux
847         " wmadec_lib"        - for OMX Media Component WMA Standard Decoder Library
848         " wmadec_mdw"        - for WMA Standard Decoder Middleware for Linux
849         " dddec_lib"         - for OMX Media Component Dolby(R) Digital Decoder Library
850         " dddec_mdw"         - for Dolby(R) Digital Decoder Middleware for Linux
851         " aaclcenc_lib"      - for OMX Media Component AAC-LC Encoder Library
852         " vp8dec_lib"        - for OMX Media Component VP8 Decoder Library for Linux
853         " vp8enc_lib"        - for OMX Media Component VP8 Encoder Library for Linux
854         " vp9dec_lib"        - for OMX Media Component VP9 Decoder Library for Linux
855         " aaclcenc_mdw"      - for AAC-LC Encoder Middleware for Linux
856         " cmsbcm"            - for CMS Basic Color Management Middleware for Linux
857         " cmsblc"            - for CMS CMM3 Backlight Control Middleware for Linux
858         " cmsdgc"            - for CMS VSP2 Dynamic Gamma Correction Middleware for Linux
859         " dtv"               - for ISDB-T DTV Software Package for Linux
860         " dvd"               - for DVD Core-Middleware for Linux
861         " adsp"              - for ADSP driver, ADSP interface and ADSP framework for Linux
862         " avb"               - for AVB Software Package for Linux
863         ```
864
865         Example:
866
867         ```sh
868         DISTRO_FEATURES:append = " h264dec_lib h265dec_lib mpeg2dec_lib aaclcdec_lib aaclcdec_mdw"
869         ```
870
871 * C. Configuration for test packages
872
873     Must ensure that Multimedia features have been enabled.
874     (Please refer to III/A to enable Multimedia.)
875
876     * Please add feature to `DISTRO_FEATURES:append` to local.conf.
877
878         **Configuration for multimedia test package**
879
880         ```sh
881         DISTRO_FEATURES:append = " mm-test"
882         ```
883
884 ### 5.4. Enable Linux ICCOM driver and Linux ICCOM library
885
886 For Linux ICCOM driver and Linux ICCOM library
887
888 * Please copy proprietary libraries to the directory of recipes.
889
890 * Please set the following in local.conf:
891
892     ```sh
893     DISTRO_FEATURES:append = "iccom"
894     ```