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