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