Fix documentation for Renesas (AGL vs. BSP version)
[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 on [elinux.org](https://elinux.org).
18 The information on this page describes setup and build procedures for both of these
19 Renesas development kits.
20
21 Additionally, the AGL Reference Hardware platform is based on the same Renesas
22 H3 processor used on the Renesas R-Car Starter Kit Premier and Salvator-X boards,
23 so support for it leverages the Starter Kit Premier (also known as "h3ulcb")
24 build.
25 For more information on the AGL reference hardware platform, please refer to its
26 [manual](https://wiki.automotivelinux.org/_media/eg-rhsa/rh_manual_ver.1.0.pdf),
27 or the Reference Hardware System Architecture Expert Group
28 [wiki page](https://wiki.automotivelinux.org/eg-rhsa).
29
30 ## 1. Downloading Proprietary Drivers
31
32 Before setting up the build environment, you need to download proprietary drivers from the
33 [R-Car H3/M3 Software library and Technical document](https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-documents-software)
34 site.
35
36 Follow these steps to download the drivers you need:
37
38 1. **Determine the Files You Need:**
39
40      Run the ``setup_mm_packages.sh`` script as follows to
41      display the list of ZIP files containing the drivers you need.
42      Following is an example:
43
44      ```sh
45      grep -rn ZIP_.= $AGL_TOP/meta-agl/meta-agl-bsp/meta-rcar-gen3/scripts/setup_mm_packages.sh
46      ```
47
48      The script's output identifies the files you need to download from the page.
49
50 2. **Get Your Board Support Package (BSP) Version:**
51
52     Be sure to have the correct BSP version of the R-Car Starter Kit
53     based on the version of the AGL software you are using.
54     Find the appropriate download links on the
55     [R-Car H3/M3 Software library and Technical document](https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-documents-software)
56     site.
57     The file pairs are grouped according to the Yocto Project version you are
58     using with the AGL software.
59
60     Use the following table to map the Renesas version to your AGL software:
61
62     | AGL Version | Renesas version |
63     |:-:|:-:|
64     | AGL Koi 11.0.0 | 4.7.0 |
65     | AGL Koi 11.0.1 | 4.7.0 |
66     | AGL Koi 11.0.2 | 4.7.0 |
67
68 3. **Download the Files:**
69
70     Start the download process by clicking the download link.
71     If you do not have an account with Renesas, you will be asked to register a free account.
72     You must register and follow the "Click Through" licensing process
73     in order to download these proprietary files.
74
75     If needed, follow the instructions to create the free account by providing the required
76     account information.
77     Once the account is registered and you are logged in, you can download the files.
78
79     **NOTE:** You might have to re-access the
80     [original page](https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-documents-software)
81     that contains the download links you need after creating the account and logging in.
82
83 4. **Create an Environment Variable to Point to Your Download Area:**
84
85     Create and export an environment variable named `XDG_DOWNLOAD_DIR` that points to
86     your download directory.
87     Here is an example:
88
89     ```sh
90     $ export XDG_DOWNLOAD_DIR=$HOME/Downloads
91     ```
92
93 5. **Be Sure the Files Have Rights:**
94
95     Be sure you have the necessary rights for the files you downloaded.
96     You can use the following command:
97
98     ```sh
99     chmod a+rw $XDG_DOWNLOAD_DIR/*.zip
100     ```
101
102 6. **Check to be Sure the Files are Downloaded and Have the Correct Rights:**
103
104     Do a quick listing of the files to ensure they are in the download directory and
105     they have the correct access rights.
106     Here is an example:
107
108     ```sh
109     $ ls -l $XDG_DOWNLOAD_DIR/*.zip
110     -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
111     -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
112     ```
113
114 ## 2. Getting More Software
115
116 1. **Get the `bmaptool`:**
117
118     Download this tool from the
119     [bmap-tools](https://build.opensuse.org/package/show/isv:LinuxAutomotive:AGL_Master/bmap-tools)
120     repository.
121     The site has pre-built packages (DEB or RPM) for the supported host
122     operating systems.
123
124 ## 3. Getting Your Hardware Together
125
126 Gather together this list of hardware items, which is not exhaustive.
127 Having these items ahead of time saves you from having to try and
128 collect hardware during development:
129
130    * Supported Starter Kit Gen3 board with its 5V power supply.
131    * Micro USB-A cable for serial console.
132      This cable is optional if you are using Ethernet and an SSH connection.
133    * USB 2.0 Hub.  The hub is optional but makes it easy to connect multiple USB devices.
134    * Ethernet cable.  The cable is optional if you are using a serial console.
135    * HDMI type D (Micro connector) cable and an associated display.
136    * 4 Gbyte minimum MicroSD Card.  It is recommended that you use a class 10 type.
137    * USB touch screen device such as the GeChic 1502i/1503i.  A touch screen device is optional.
138
139    **NOTE:** The Salvator-X Board has NDA restrictions.
140    Consequently, less documentation is available for this board both here and across the
141    Internet.
142
143
144 ## 4. Making Sure Your Build Environment is Correct
145
146 The
147 "[Initializing Your Build Environment](./3_Initializing_Your_Build_Environment.md)"
148 section presented generic information for setting up your build environment
149 using the `aglsetup.sh` script.
150 If you are building an image for a supported Renesas board,
151 you need to take steps to make sure your build host is set up correctly.
152
153 1. **Define Your Board:**
154
155     Depending on your Renesas board, define and export a `MACHINE` variable as follows:
156
157     | Board | `MACHINE` Setting |
158     |:-:|:-:|
159     | Starter Kit Pro/M3  | `MACHINE`=m3ulcb |
160     | Starter Kit Pro/M3 + kingfisher support | `MACHINE`=m3ulcb-kf |
161     | Starter Kit Pro/M3 without graphic driver (using pixman)  | `MACHINE`=m3ulcb-nogfx |
162     | Starter Kit Premier/H3  | `MACHINE`=h3ulcb |
163     | Starter Kit Premier/H3  + kingfisher support  | `MACHINE`=h3ulcb-kf |
164     | Starter Kit Premier/H3  without graphic driver (using pixman)  | `MACHINE`=h3ulcb-nogfx |
165     | Salvator-X  | `MACHINE`=h3-salvator-x |
166     | AGL Reference Hardware | `MACHINE`=h3ulcb |
167     | AGL Reference Hardware  without graphic driver (using pixman)  | `MACHINE`=h3ulcb-nogfx |
168
169     For example, the following command defines and exports the `MACHINE` variable
170     for the Starter Kit Premier/H3 Board:
171
172     ```sh
173     $ export MACHINE=h3ulcb
174     ```
175
176 2. **Run the `aglsetup.sh` Script:**
177
178     Use the following commands to run the AGL Setup script:
179
180     ```sh
181     $ cd $AGL_TOP
182     $ source meta-agl/scripts/aglsetup.sh -m $MACHINE -b build agl-devel agl-demo
183     ```
184
185     If building for the AGL Reference Hardware (with `MACHINE` set to "h3ulcb" or
186     "h3ulcb-nogfx"), add `agl-refhw-h3`, for example:
187
188     ```sh
189     $ cd $AGL_TOP
190     $ source meta-agl/scripts/aglsetup.sh -m $MACHINE -b build agl-devel agl-demo agl-refhw-h3
191     ```
192
193     **NOTE:**
194     Running the `aglsetup.sh` script automatically places you in the
195     working directory (i.e. `$AGL_TOP/build`).
196     You can change this default behavior by adding the "-f" option to the
197     script's command line.
198
199     In the previous command, the "-m" option sets your machine to the previously
200     defined `MACHINE` variable.
201     The "-b" option defines your Build Directory, which is the
202     default `$AGL_TOP/build`.
203     Finally, the AGL features are provided to support building the AGL Demo image
204     for the Renesas board.
205
206     You can learn more about the AGL Features in the
207     "[Initializing Your Build Environment](./3_Initializing_Your_Build_Environment.md)"
208     section.
209
210 3. **Examine the Script's Log:**
211
212     Running the `aglsetup.sh` script creates the `setup.log` file, which is in
213     the `build/conf` folder.
214     You can examine this log to see the results of the script.
215     For example, suppose the graphics drivers were missing or could not be extracted
216     when you ran the script.
217     In case of missing graphics drivers, you could notice an error message
218     similar to the following:
219     ```text
220     [snip]
221     --- fragment /home/working/workspace_agl_master/meta-agl/templates/machine/h3ulcb/50_setup.sh
222     /home/working/workspace_agl_master /home/working/workspace_agl_master/build_gen3
223     The graphics and multimedia acceleration packages for
224     the R-Car Gen3 board can be downloaded from:
225     https://www.renesas.com/en-us/solutions/automotive/rcar-demoboard-2.html
226
227     These 2 files from there should be store in your'/home/devel/Downloads' directory.
228       R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston8-20200923.zip
229       R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston8-20200923.zip
230     /home/working/workspace_agl_master/build_gen3
231     --- fragment /home/working/workspace_agl_master/meta-agl/templates/base/99_setup_EULAconf.sh
232     --- end of setup script
233     OK
234     Generating setup file: /home/working/workspace_agl_master/build_gen3/agl-init-build-env ... OK
235     ------------ aglsetup.sh: Done
236     [snip]
237     ```
238
239     If you encounter this issue, or any other unwanted behavior, you can fix the error
240     mentioned, remove the `$AGL_TOP/build` directory, and then re-launch the
241     `aglsetup.sh` again.
242
243     Here is another example that indicates the driver files could not be extracted from the downloads directory:
244     ```
245     ~/workspace_agl/build/conf $ cat setup.log
246     --- beginning of setup script
247     --- fragment /home/working/workspace_agl/meta-agl/templates/base/01_setup_EULAfunc.sh
248     --- fragment /home/working/workspace_agl/meta-agl/templates/machine/h3ulcb/50_setup.sh
249     ~/workspace_agl ~/workspace_agl/build
250     ERROR: FILES "+/home/working/Downloads/R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston8-20200923.zip+" NOT EXTRACTING CORRECTLY
251     ERROR: FILES "+/home/working/Downloads/R-car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston8-20200923.zip+" NOT EXTRACTING CORRECTLY
252     The graphics and multimedia acceleration packages for
253     the R-Car Gen3 board BSP can be downloaded from:
254     <https://www.renesas.com/us/en/application/automotive/r-car-h3-m3-documents-software>
255
256     These 2 files from there should be stored in your
257     '/home/working/Downloads' directory.
258       R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-weston8-20200923.zip
259       R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-weston8-20200923.zip
260     ERROR: Script /home/working/workspace_agl/build/conf/setup.sh failed
261     [snip]
262     ```
263
264 ## 5. Checking Your Configuration
265
266 Aside from environment variables and parameters you establish through
267 running the `aglsetup.sh` script, you can ensure your build's configuration
268 is just how you want it by examining the `local.conf` configuration file.
269
270 You can find this configuration file in the Build Directory (e.g.
271 `$TOP_DIR/build/conf/local.conf`).
272
273 In general, the defaults along with the configuration fragments the
274 `aglsetup.sh` script applies in the `local.conf` file are good enough.
275 However, you can customize aspects by editing the `local.conf` file.
276 See the
277 "[Customizing Your Build](4_Customizing_Your_Build.md)"
278 section for common configurations you might want to consider.
279
280 **NOTE:** For detailed explanations of the configurations you can make
281 in the ``local.conf`` file, consult the
282 [Yocto Project Documentation](https://www.yoctoproject.org/docs/).
283
284 A quick way to see if you have the `$MACHINE` variable set correctly
285 is to use the following command:
286
287 ```sh
288 grep -w -e "^MACHINE =" $AGL_TOP/build/conf/local.conf
289 ```
290
291 Depending on the Renesas board you are using, you should see output
292 as follows:
293
294 ```sh
295 MACHINE = "h3ulcb"
296 ```
297 or
298 ```sh
299 MACHINE = "m3ulcb"
300 ```
301 or
302 ```sh
303 MACHINE = "h3-salvator-x"
304 ```
305
306 If you ran the `aglsetup.sh` script as described in the
307 "[Making Sure Your Build Environment is Correct](./5_3_RCar_Gen_3.md#4-making-sure-your-build-environment-is-correct)"
308 section earlier, the "agl-devel", "agl-demo", "agl-netboot", "agl-appfw-smack", and
309 "agl-localdev" AGL features will be in effect.
310 These features provide the following:
311
312 * A debugger (gdb)
313 * Some tweaks, including a disabled root password
314 * A SFTP server
315 * The TCF Agent for easier application deployment and remote debugging
316 * Some extra system tools such as USB and bluetooth
317 * Support for the AGL demo platform
318 * Network boot support through TFTP and NBD protocols
319 * [IoT.bzh](https://iot.bzh/en/) Application Framework plus
320   [SMACK](https://en.wikipedia.org/wiki/Smack_(software)) and
321   [Cynara](https://wiki.tizen.org/Security:Cynara)
322 * Support for local development including `localdev.inc` when present
323
324 ## 6. Using BitBake
325
326 This section shows the `bitbake` command used to build the AGL image.
327 Before running BitBake to start your build, it is good to be reminded that AGL
328 does provide pre-built images for developers that work with supported hardware.
329 You can find these pre-built images on the
330 [AGL Download web site](https://download.automotivelinux.org/AGL/release).
331
332 Start the build using the `bitbake` command.
333
334 **NOTE:** An initial build can take many hours depending on your
335 CPU and and Internet connection speeds.
336 The build also takes approximately 100G-bytes of free disk space.
337
338 For this example, the target is "agl-demo-platform":
339
340 ```sh
341 bitbake agl-demo-platform
342 ```
343
344 The build process puts the resulting image in the Build Directory:
345
346 ```
347 <build_directory>/tmp/deploy/images/$MACHINE
348 ```
349
350 ## 7. Booting the Image Using a MicroSD Card
351
352 To boot your image on the Renesas board, you need to do three things:
353
354 1. Update all firmware on the board.
355 2. Prepare the MicroSD card to you can boot from it.
356 3. Boot the board.
357
358 **NOTE:** For subsequent builds, you only have to re-write the MicroSD
359 card with a new image.
360
361 ### Updating the Board's Firmware
362
363 Follow these steps to update the firmware:
364
365 1. **Update the Sample Loader and MiniMonitor:**
366
367     You only need to make these updates one time per device.
368
369     Follow the procedure found on the
370     eLinux.org wiki to update to at least version 3.02,
371     which is mandatory to run the AGL image
372     ([R-car loader update](https://elinux.org/R-Car/Boards/Kingfisher#How_to_update_of_Sample_Loader_and_MiniMonitor)).
373
374 2. **Update the Firmware Stack:**
375
376     You only need to update the firmware stack if you are
377     using the Eel or later (5.0) version of AGL software.
378
379     M3 and H3 Renesas board are AArch64 platforms.
380     As such, they have a firmware stack that is divided across: **ARM Trusted Firmware**, **OP-Tee** and **U-Boot**.
381
382     If you are using the Eel (5.0) version or later of the AGL software, you must update
383     the firmware using the **[h3ulcb] [R-car h3ulcb firmware update](http://elinux.org/R-Car/Boards/H3SK#Flashing_firmware)**
384     or **[m3ulcb] [R-car m3ulcb firmware update](https://elinux.org/R-Car/Boards/M3SK#Flashing_firmware)** links from the
385     [Embedded Linux Wiki](https://www.elinux.org/Main_Page) (i.e. `elinux.org`).
386
387     The table in the wiki lists the files you need to flash the firmware.
388     You can find these files in the following directory:
389
390     ```sh
391     $AGL_TOP/build/tmp/deploy/images/$MACHINE
392     ```
393
394     **NOTE:** The Salvator-X firmware update process is not documented on eLinux.
395     **NOTE:** The AGL Reference Hardware board generally should not require a
396     firmware update to be usable, and has a slightly different update procedure.
397     If you do need to update the firmware, the procedure is documented
398     [here](https://git.automotivelinux.org/AGL/meta-agl-refhw/tree/meta-agl-refhw-gen3/docs/ReferenceHW_Rcar_gen3.md).
399
400 ### Preparing the MicroSD Card
401
402 Plug the MicroSD card into your Build Host.
403 After plugging in the device, use the `dmesg` command as follows to
404 discover the device name:
405 ```sh
406 $ dmesg | tail -4
407 [ 1971.462160] sd 6:0:0:0: [sdc] Mode Sense: 03 00 00 00
408 [ 1971.462277] sd 6:0:0:0: [sdc] No Caching mode page found
409 [ 1971.462278] sd 6:0:0:0: [sdc] Assuming drive cache: write through
410 [ 1971.463870]  sdc: sdc1 sdc2
411 ```
412 In the previous example, the MicroSD card is attached to the device `/dev/sdc`.
413 You can also use the `lsblk` command to show all your devices.
414 Here is an example that shows the MicroSD card as `/dev/sdc`:
415 ```sh
416 $ lsblk
417   NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
418   sda      8:0    0 167,7G  0 disk
419   ├─sda1   8:1    0   512M  0 part /boot/efi
420   ├─sda2   8:2    0 159,3G  0 part /
421   └─sda3   8:3    0   7,9G  0 part [SWAP]
422   sdb      8:16   0 931,5G  0 disk
423   └─sdb1   8:17   0 931,5G  0 part /media/storage
424   sdc      8:32   1  14,9G  0 disk
425   ├─sdc1   8:33   1    40M  0 part
426   └─sdc2   8:34   1   788M  0 part
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
502 * [GNU Screen](https://en.wikipedia.org/wiki/GNU_Screen)
503 * [picocom](https://linux.die.net/man/8/picocom)
504 * [Minicom](https://en.wikipedia.org/wiki/Minicom)
505
506 Of these three, "picocom" has the least 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 Once you connect the board, determine the device created for the serial link.
516 Use the ``dmesg`` command on your build host.
517 Here is an example:
518 ```sh
519 dmesg | tail 9
520 [2097783.287091] usb 2-1.5.3: new full-speed USB device number 24 using ehci-pci
521 [2097783.385857] usb 2-1.5.3: New USB device found, idVendor=0403, idProduct=6001
522 [2097783.385862] usb 2-1.5.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
523 [2097783.385864] usb 2-1.5.3: Product: FT232R USB UART
524 [2097783.385866] usb 2-1.5.3: Manufacturer: FTDI
525 [2097783.385867] usb 2-1.5.3: SerialNumber: AK04WWCE
526 [2097783.388288] ftdi_sio 2-1.5.3:1.0: FTDI USB Serial Device converter detected
527 [2097783.388330] usb 2-1.5.3: Detected FT232RL
528 [2097783.388658] usb 2-1.5.3: FTDI USB Serial Device converter now attached to ttyUSB0
529 ```
530 The device created is usually "/dev/ttyUSB0".
531 However, the number might vary depending on other USB serial ports connected to the host.
532
533 To use the link, you need to launch the client.
534 Here are three commands, which vary based on the serial client, that show
535 how to launch the client:
536
537 ```sh
538 $ picocom -b 115200 /dev/ttyUSB0
539 ```
540
541 or
542
543 ```sh
544 $ minicom -b 115200 -D /dev/ttyUSB0
545 ```
546
547 or
548
549 ```sh
550 $ screen /dev/ttyUSB0 115200
551 ```
552
553 ### Powering on the Board to Get a Shell at the Console
554
555 Both the Pro and Premier kits (e.g.
556 [m3ulcb](https://elinux.org/R-Car/Boards/M3SK) and
557 [h3ulcb](https://elinux.org/R-Car/Boards/H3SK#Hardware)) have nine
558 switches (SW1 through SW9).
559 To power on the board, "short-press" SW8, which is the power switch.
560
561 Following, is console output for the power on process for each kit:
562
563 **h3ulcb**:
564 ```text
565 NOTICE:  BL2: R-Car Gen3 Initial Program Loader(CA57) Rev.1.0.7
566 NOTICE:  BL2: PRR is R-Car H3 ES1.1
567 NOTICE:  BL2: LCM state is CM
568 NOTICE:  BL2: DDR1600(rev.0.15)
569 NOTICE:  BL2: DRAM Split is 4ch
570 NOTICE:  BL2: QoS is Gfx Oriented(rev.0.30)
571 NOTICE:  BL2: AVS setting succeeded. DVFS_SetVID=0x52
572 NOTICE:  BL2: Lossy Decomp areas
573 NOTICE:       Entry 0: DCMPAREACRAx:0x80000540 DCMPAREACRBx:0x570
574 NOTICE:       Entry 1: DCMPAREACRAx:0x40000000 DCMPAREACRBx:0x0
575 NOTICE:       Entry 2: DCMPAREACRAx:0x20000000 DCMPAREACRBx:0x0
576 NOTICE:  BL2: v1.1(release):41099f4
577 NOTICE:  BL2: Built : 19:20:52, Jun  9 2016
578 NOTICE:  BL2: Normal boot
579 NOTICE:  BL2: dst=0xe63150c8 src=0x8180000 len=36(0x24)
580 NOTICE:  BL2: dst=0x43f00000 src=0x8180400 len=3072(0xc00)
581 NOTICE:  BL2: dst=0x44000000 src=0x81c0000 len=65536(0x10000)
582 NOTICE:  BL2: dst=0x44100000 src=0x8200000 len=524288(0x80000)
583 NOTICE:  BL2: dst=0x49000000 src=0x8640000 len=1048576(0x100000)
584
585
586 U-Boot 2015.04 (Jun 09 2016 - 19:21:52)
587
588 CPU: Renesas Electronics R8A7795 rev 1.1
589 Board: H3ULCB
590 I2C:   ready
591 DRAM:  3.9 GiB
592 MMC:   sh-sdhi: 0, sh-sdhi: 1
593 In:    serial
594 Out:   serial
595 Err:   serial
596 Net:   Board Net Initialization Failed
597 No ethernet found.
598 Hit any key to stop autoboot:  0
599 =>
600 ```
601
602 **m3ulcb**:
603 ```text
604 NOTICE:  BL2: R-Car Gen3 Initial Program Loader(CA57) Rev.1.0.14
605 NOTICE:  BL2: PRR is R-Car M3 Ver1.0
606 NOTICE:  BL2: Board is Starter Kit Rev1.0
607 NOTICE:  BL2: Boot device is HyperFlash(80MHz)
608 NOTICE:  BL2: LCM state is CM
609 NOTICE:  BL2: AVS setting succeeded. DVFS_SetVID=0x52
610 NOTICE:  BL2: DDR1600(rev.0.22)NOTICE:  [COLD_BOOT]NOTICE:  ..0
611 NOTICE:  BL2: DRAM Split is 2ch
612 NOTICE:  BL2: QoS is default setting(rev.0.17)
613 NOTICE:  BL2: Lossy Decomp areas
614 NOTICE:       Entry 0: DCMPAREACRAx:0x80000540 DCMPAREACRBx:0x570
615 NOTICE:       Entry 1: DCMPAREACRAx:0x40000000 DCMPAREACRBx:0x0
616 NOTICE:       Entry 2: DCMPAREACRAx:0x20000000 DCMPAREACRBx:0x0
617 NOTICE:  BL2: v1.3(release):4eef9a2
618 NOTICE:  BL2: Built : 00:25:19, Aug 25 2017
619 NOTICE:  BL2: Normal boot
620 NOTICE:  BL2: dst=0xe631e188 src=0x8180000 len=512(0x200)
621 NOTICE:  BL2: dst=0x43f00000 src=0x8180400 len=6144(0x1800)
622 NOTICE:  BL2: dst=0x44000000 src=0x81c0000 len=65536(0x10000)
623 NOTICE:  BL2: dst=0x44100000 src=0x8200000 len=524288(0x80000)
624 NOTICE:  BL2: dst=0x50000000 src=0x8640000 len=1048576(0x100000)
625
626
627 U-Boot 2015.04-dirty (Aug 25 2017 - 10:55:49)
628
629 CPU: Renesas Electronics R8A7796 rev 1.0
630 Board: M3ULCB
631 I2C:   ready
632 DRAM:  1.9 GiB
633 MMC:   sh-sdhi: 0, sh-sdhi: 1
634 In:    serial
635 Out:   serial
636 Err:   serial
637 Net:   ravb
638 Hit any key to stop autoboot:  0
639 =>
640 ```
641
642 ## 9. Setting-up U-boot
643 ### Configuring U-Boot Parameters
644
645 Follow these steps to configure the board to use the MicroSD card as the
646 boot device and also to set the screen resolution:
647
648 1. As the board is powering up, press any key to stop the autoboot process.
649    You need to press a key quickly as you have just a few seconds in which to
650    press a key.
651
652 2. Once the autoboot process is interrupted, use the board's serial console to
653    enter `printenv` to check if you have correct parameters for booting your board:
654
655     Here is an example using the **h3ulcb** board:
656     ```sh
657     => printenv
658     baudrate=115200
659     bootargs=console=ttySC0,115200 root=/dev/mmcblk1p1 rootwait ro rootfstype=ext4
660     bootcmd=run load_ker; run load_dtb; booti 0x48080000 - 0x48000000
661     bootdelay=3
662     fdt_high=0xffffffffffffffff
663     initrd_high=0xffffffffffffffff
664     load_dtb=ext4load mmc 0:1 0x48000000 /boot/r8a7795-h3ulcb.dtb
665     load_ker=ext4load mmc 0:1 0x48080000 /boot/Image
666     stderr=serial
667     stdin=serial
668     stdout=serial
669     ver=U-Boot 2015.04 (Jun 09 2016 - 19:21:52)
670
671     Environment size: 648/131068 bytes
672     ```
673
674      Here is a second example using the **m3ulcb** board:
675     ```sh
676     baudrate=115200
677     bootargs=console=ttySC0,115200 root=/dev/mmcblk1p1 rootwait ro rootfstype=ext4
678     bootcmd=run load_ker; run load_dtb; booti 0x48080000 - 0x48000000
679     bootdelay=3
680     fdt_high=0xffffffffffffffff
681     filesize=cdeb
682     initrd_high=0xffffffffffffffff
683     load_dtb=ext4load mmc 0:1 0x48000000 /boot/r8a7796-m3ulcb.dtb
684     load_ker=ext4load mmc 0:1 0x48080000 /boot/Image
685     stderr=serial
686     stdin=serial
687     stdout=serial
688     ver=U-Boot 2015.04 (Nov 30 2016 - 18:25:18)
689
690     Environment size: 557/131068 bytes
691     ```
692
693 3. To boot your board using the MicroSD card, be sure your environment is set up
694    as follows:
695     ```sh
696     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
697     setenv bootcmd run load_ker\; run load_dtb\; booti 0x48080000 - 0x48000000
698     setenv load_ker ext4load mmc 0:1 0x48080000 /boot/Image
699     ```
700
701 4. Loading dtb :
702
703     **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.
704
705     Make sure your ``load_dtb`` is set as follows :
706
707        * **H3SK v2.0(DDR 4GB)** : `$ setenv load_dtb ext4load mmc 0:1 0x48000000 /boot/r8a7795-h3ulcb.dtb`
708
709        * **H3SK v2.0(DDR 8GB)/v3.0(DDR 8GB)** : `$ setenv load_dtb ext4load mmc 0:1 0x48000000 /boot/r8a7795-h3ulcb-4x2g.dtb`
710
711        * **M3SK v1.0** : `$ setenv load_dtb ext4load mmc 0:1 0x48000000 /boot/r8a7796-m3ulcb.dtb`
712
713        * **M3SK v3.0** : `$ setenv load_dtb ext4load mmc 0:1 0x48000000 /boot/r8a7796-m3ulcb-2x4g.dtb`
714
715        * **H3SK with a Kingfisher board** : `$ setenv load_dtb ext4load mmc 0:1 0x48000000 /boot/r8a7795-h3ulcb-kf.dtb`
716
717        * **M3SK with a Kingfisher board** : `$ setenv load_dtb ext4load mmc 0:1 0x48000000 /boot/r8a7796-m3ulcb-kf.dtb`
718
719        * **AGL Reference Hardware board** : `$ setenv load_dtb ext4load mmc 0:1 0x48000000 /boot/r8a7795-agl-refhw.dtb`
720
721 5. Save the boot environment:
722     ```sh
723     saveenv
724     ```
725
726 6. Boot the board:
727    ```sh
728    run bootcmd
729    ```
730
731 ## 10. Troubleshooting
732 ### Logging Into the Console
733
734 Once the board boots, you should see the
735 [Wayland display](https://en.wikipedia.org/wiki/Wayland_(display_server_protocol))
736 on the external monitor.
737 A login prompt should appear as follows depending on your board:
738
739 **h3ulcb** or **AGL Reference Hardware**:
740
741 ```text
742 Automotive Grade Linux ${AGL_VERSION} h3ulcb ttySC0
743
744 h3ulcb login: root
745 ```
746
747 **m3ulcb**:
748
749 ```text
750 Automotive Grade Linux ${AGL_VERSION} m3ulcb ttySC0
751
752 m3ulcb login: root
753 ```
754
755 At the prompt, login by using `root` as the login.
756 The password is "empty" so you should not be prompted for the password.
757
758 ### Determining the Board's IP Address
759
760 If your board is connected to a local network using Ethernet and
761 if a DHCP server is able to distribute IP addresses,
762 you can determine the board's IP address and log in using `ssh`.
763
764 Here is an example for the **m3ulcb** board:
765 ```sh
766 m3ulcb login: root
767 Last login: Tue Dec  6 09:55:15 UTC 2016 on tty2
768 root@m3ulcb:~# ip -4 a
769 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
770     inet 127.0.0.1/8 scope host lo
771       valid_lft forever preferred_lft forever
772 3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
773     inet 10.0.0.27/24 brd 10.0.0.255 scope global eth0
774       valid_lft forever preferred_lft forever
775 root@m3ulcb:~#
776 ```
777
778 In the previous example, IP address is 10.0.0.27.
779 Once you know the address, you can use `ssh` to login.
780 Following is an example that shows logging into SSH and then
781 displaying the contents of the `/etc/os-release` file:
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@m3ulcb:~# 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 ## 11. Supplementary Information
794
795 ### 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 ### 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 #### 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         Example:
865         ```sh
866         DISTRO_FEATURES_append = " h264dec_lib h265dec_lib mpeg2dec_lib aaclcdec_lib aaclcdec_mdw"
867         ```
868
869 * C. Configuration for test packages
870
871     Must ensure that Multimedia features have been enabled.
872     (Please refer to III/A to enable Multimedia.)
873
874     * Please add feature to `DISTRO_FEATURES_append` to local.conf.
875
876         **Configuration for multimedia test package**
877         ```sh
878         DISTRO_FEATURES_append = " mm-test"
879         ```
880
881 #### Enable Linux ICCOM driver and Linux ICCOM library
882
883 For Linux ICCOM driver and Linux ICCOM library
884
885 * Please copy proprietary libraries to the directory of recipes.
886
887 * Please set the following in local.conf:
888     ```sh
889     DISTRO_FEATURES_append = "iccom"
890     ```