R-Car/Ubuntu

From eLinux.org
Jump to: navigation, search

Run Ubuntu 18 on the R-Car Starter Kit

This describe the manual to run Ubuntu 18 on the R-Car Starter Kit.

What to prepare

  • HW
    • R-Car Starter Kit Pro/Premiere
      Don't care capacity and M3/H3. In this verification, H3 WS3.0 8GB is used.
    • microSD card
      Verified with 16GB/32GB.
  • Artifacts built with Yocto 3.21
    • Image
    • Image-r8a7795-h3ulcb-4x2g.dtb
    • core-image-minimal-h3ulcb.tar.bz2/core-image-weston-h3ulcb.tar.bz2
    • modules-h3ulcb.tgz
  • base image of the Ubuntu 18
  • Linux PC
    Those with a microSD card slot

Hereafter, these files will be explained on the assumption that they are stored under the ~/ubu directory.

$ ls ~/ubu
Image
Image-r8a7795-h3ulcb-4x2g.dtb
core-image-minimal-h3ulcb.tar.bz2/core-image-weston-h3ulcb-4x2g.dtb
ubuntu-base-18.04.4-base-arm64.tar.gz
modules-h3ulcb.tgz

Setup

Work on the Linux PC

  • construction of microSD card image
  • The inserted microSD card is explained below as /dev/sdb.
    • If something is on the microSD card, delete all partitions before working.
      WARNING! These steps may erase the SD card completely. All files my be lost.

1.Create partition
Create two partitions. The first is 2GB and the second is the remaining capacity.

$ sudo fdisk /dev/sdb

Command (m for help):n
Partition type
	p	primary (0 primary, 0 extended, 4 free)
	e	extended (container for logical partitions)
Select (default p):p
Partition number (1-4, default 1):[press Enter key]
First sector (2048-30375935, default 2048):[press Enter key]
Last sector, +sectors or +size{K,M,G,T,P} (2048-30375935, default 30375935): +2G

Command (m for help):n
Partition type
	p	primary (1 primary, 0 extended, 3 free)
	e	extended (container for logical partitions)
Select (default p):p
Partition number (2-4, default 2):[press Enter key]
First sector (4196352-62333951, default 4196352):[press Enter key]
Last sector, +sectors or +size{K,M,G,T,P} (4196352-62333951, default 62333951):[press Enter key]
*When using a 16GB microSD card, press the Enter key at the time of (*).

Command (m for help):w

2.Creating file systems

$ sudo mkfs.ext4 /dev/sdb1
$ sudo mkfs.ext4 /dev/sdb2

3.Extract files to microSD card
In the first partition, extract core-image-minimal-h3ulcb.tar.bz2/core-image-weston-h3ulcb.tar.bz2 and modules-h3ulcb.tgz.
In the second partition, extract ubuntu-base-18.04.4-base-arm64.tar.gz and modules-h3ulcb.tgz.

$ sudo mount /dev/sdb1 /mnt
$ cd /mnt
$ sudo tar -xvf ~/ubu/core-image-minimal-h3ulcb.tar.bz2(core-image-weston-h3ulcb.tar.bz2)
$ sudo tar -xvf ~/ubu/modules-h3ulcb.tgz
$ cd boot
$ sudo rm *
$ cp ~/ubu/Image ~/ubu/Image-r8a7795-h3ulcb-4x2g.dtb .
$ cd ../..
$ sudo umount /mnt
$ sudo mount /dev/sdb2 /mnt
$ cd /mnt
$ sudo tar -xvf ~/ubu/ubuntu-base-18.04.4-base-arm64.tar.gz
$ sudo tar -xvf ~/ubu/modules-h3ulcb.tgz
$ cd /
$ sudo umount /mnt
$ sync
  • The work on the Linux PC is over. remove the microSD card.

Work on the Starter Kit

  • Assuming network configuration as shown

R-Car-Ubuntu-Network.jpg

  • Insert the microSD card created in the previous chapter into the Starter Kit and turn on the Starter Kit.
U-Boot 2018.09 (May 26 2020 - 10:27:40 +0000)

CPU:Renesas Electronics R8A7795 rev 3.0
Model:Renesas H3ULCB board based on r8a7795 ES2.0+ with 8GiB (4 x 2 GiB)
DRAM: 7.9 GiB
 ・・・
Hit any key to stop autoboot: 0
=> setenv bootargs 'root=/dev/mmcblk1p1 rootwait rw ip=192.168.0.111::192.168.0.1:255.255.255.0::eth0:off'
=> setenv bootcmd 'ext4load mmc 0:1 0x48000000 /boot/Image-r8a7795-h3ulcb-4x2g.dtb; ext4load mmc 0:1 0x48080000 /boot/Image; booti 0x48080000 - 0x48000000'
=> saveenv
Saving Environment to MMC... Writeng to MMC(1)... OK
=> run bootcmd
74202 bytes read in 3 ms (23.6 MiB/s)
18993664 bytes read in 208 ms (87.1 MiB/s)
## Flattened Device Tree blob at 48000000
 ・・・
Starting kernel ...
 ・・・
h3ulcb login: root
root@h3ulcb:~# cd /lib/modules/4.14.75-ltsi-yocto-standard/
root@h3ulcb:/lib/modules/4.14.75-ltsi-yocto-standard# depmod -a
root@h3ulcb:/lib/modules/4.14.75-ltsi-yocto-standard# cd /
root@h3ulcb:/# export TZ=JST-9
root@h3ulcb:/# date 0604011920     <- MMDDHHMMYY format
Thu Jun 4 01:19:00 JST 2020
root@h3ulcb:/# mount /dev/mmcblk1p2 /mnt
root@h3ulcb:/# mount -t proc none /mnt/proc
root@h3ulcb:/# mount -t sysfs none /mnt/sys
root@h3ulcb:/# mount -t devtmpfs none /mnt/dev
root@h3ulcb:/# chroot /mnt /bin/bash
root@h3ulcb:/# echo nameserver 192.168.0.1 >/etc/resolv.conf
root@h3ulcb:/# apt-get update
root@h3ulcb:/# apt-get install -y apt-utils perl-modules
root@h3ulcb:/# apt-get install -y ubuntu-standard
root@h3ulcb:/# apt-get install -y vim net-tools ssh sudo tzdata rsyslog udev iputils-ping
 ・・・
Preconfiguring packages ...

Package configuration
Configuring tzdata
Please select the geographic area in which you live. Subsequent configuration questions will narrow
this down x x by presenting a list of cities, representing thee time zones in which they are located.
     「When the TimeZone setting window opens, select Asia/Tokyo」
root@h3ulcb:/# apt-get upgrade
root@h3ulcb:/# cd /etc/systemd/network
root@h3ulcb:/etc/systemd/network# ls
root@h3ulcb:/etc/systemd/network# cat >01-eth0.network
[Match]
Name=eth0

[Network]
DHCP=ipv4
     「Ctrl+D after writing」
root@h3ulcb:/etc/systemd/network# cd /etc
root@h3ulcb:/etc# vi shadow
     「Rewrite root line -> no PW」
root::18295:0:99999:7:::
root@h3ulcb:/etc# vi /etc/ssh/sshd_config
     「Rewrite as yes」
permitRootlogin yes
root@h3ulcb:/etc# systemctl enable systemd-networkd
root@h3ulcb:/etc# cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
root@h3ulcb:/etc# systemctl enable tmp.mount
root@h3ulcb:/etc# systemctl enable systemd-resolved
root@h3ulcb:/etc# rm /etc/resolv.conf
root@h3ulcb:/etc# ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
root@h3ulcb:/etc# exit
root@h3ulcb:/# umount /mnt/proc
root@h3ulcb:/# umount /mnt/sys
root@h3ulcb:/# umount /mnt/dev
root@h3ulcb:/# umount /mnt
root@h3ulcb:/# reboot
U-Boot 2018.09 (May 26 2020 - 10:27:40 +0000)
 ・・・
Hit any key to stop autoboot: 0
=> setenv bootargs 'root=/dev/mmcblk1p2 rootwait rw'
=> saveenv
=> run bootcmd
Ubuntu 18.04.4 LTS localhost.localdomain ttySC0
localhost login: root
root@localhost:~# passwd root     <- PW setting
Enter new UNIX password : h3ulcb
Retry new UNIX password : h3ulcb
root@localhost:~# dpkg-reconfigure tzdata
     「When the TimeZone setting window opens, select Asia/Tokyo」
root@localhost:~# apt-get install -y language-pack-ja
root@localhost:~# update-locale LANG=ja_JP.UTF-8
root@localhost:~# poweroff

After this, pressing the power bottom will boot Ubuntu 18.