Difference between revisions of "R-Car/Ubuntu(J)"
< R-Car
(Update for Yocto 4.7.0) |
|||
(8 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
**R-Car Starter Kit Pro/Premiere<br>容量とM3/H3は問わない。今回の検証では、H3 WS3.0 8GB を使用。 | **R-Car Starter Kit Pro/Premiere<br>容量とM3/H3は問わない。今回の検証では、H3 WS3.0 8GB を使用。 | ||
**microSDカード<br>16GB/32GB で検証済み。 | **microSDカード<br>16GB/32GB で検証済み。 | ||
− | * | + | *Yocto 4.7.0でビルドしてできた成果物 |
**Image | **Image | ||
**Image-r8a7795-h3ulcb-4x2g.dtb | **Image-r8a7795-h3ulcb-4x2g.dtb | ||
Line 13: | Line 13: | ||
**modules-h3ulcb.tgz | **modules-h3ulcb.tgz | ||
*Ubuntu18のベースイメージ | *Ubuntu18のベースイメージ | ||
− | **ubuntu-base-18.04. | + | **ubuntu-base-18.04.5-base-arm64.tar.gz<br>http://cdimage.ubuntu.com/ubuntu-base/releases/18.04/release/ からダウンロード |
− | + | *Linux PC<br>microSDカードのスロットがあるもの | |
以降、これらのファイルは ~/ubu ディレクトリ下に保存されている前提で説明を行う。 | 以降、これらのファイルは ~/ubu ディレクトリ下に保存されている前提で説明を行う。 | ||
Line 21: | Line 21: | ||
Image-r8a7795-h3ulcb-4x2g.dtb | Image-r8a7795-h3ulcb-4x2g.dtb | ||
core-image-minimal-h3ulcb.tar.bz2 ( or core-image-weston-h3ulcb.tar.bz2) | core-image-minimal-h3ulcb.tar.bz2 ( or core-image-weston-h3ulcb.tar.bz2) | ||
− | ubuntu-base-18.04. | + | ubuntu-base-18.04.5-base-arm64.tar.gz |
modules-h3ulcb.tgz | modules-h3ulcb.tgz | ||
Line 28: | Line 28: | ||
*microSDカードイメージの構築 | *microSDカードイメージの構築 | ||
*挿されたmicroSDカードは、/dev/sdbとして以降説明 | *挿されたmicroSDカードは、/dev/sdbとして以降説明 | ||
− | ** | + | **microSDカードに何か入っている場合は、すべてのパーティションを削除してから作業<br><span style="color:#ff0000">'''注意!''' これらの手順によってmicroSDカードの中身が完全に消去される場合があり、すべてのファイルが失われる可能性がある。</span> |
1.パーティションの作成<br>2つのパーティションを作成<br>1つ目は2GB、2つ目は残りの容量を割り当て | 1.パーティションの作成<br>2つのパーティションを作成<br>1つ目は2GB、2つ目は残りの容量を割り当て | ||
Line 47: | Line 47: | ||
e extended (container for logical partitions) | e extended (container for logical partitions) | ||
Select (default p):p | Select (default p):p | ||
− | パーティション番号 (2-4, default | + | パーティション番号 (2-4, default 2):Enter keyを押す |
− | First sector ( | + | First sector (4196352-62333951, default 4196352):Enter keyを押す |
− | Last sector, +sectors or +size{K,M,G,T,P} ( | + | Last sector, +sectors or +size{K,M,G,T,P} (4196352-62333951, default 62333951):Enter keyを押す(*) |
− | * | + | *16GBのmicroSDカード使用時も(*)のときにEnter keyを押す |
コマンド (mでヘルプ):w | コマンド (mでヘルプ):w | ||
Line 58: | Line 58: | ||
$ sudo mkfs.ext4 /dev/sdb2 | $ sudo mkfs.ext4 /dev/sdb2 | ||
− | 3.microSDカードにファイルを展開<br>1つ目のパーティションにcore-image-minimal-h3ulcb.tar.bz2/core-image-weston-h3ulcb.tar.bz2、modules-h3ulcb.tgzを展開<br>2つ目のパーティションにubuntu- | + | 3.microSDカードにファイルを展開<br>1つ目のパーティションにcore-image-minimal-h3ulcb.tar.bz2/core-image-weston-h3ulcb.tar.bz2、modules-h3ulcb.tgzを展開<br>2つ目のパーティションにubuntu-base-18.04.5-base-arm64.tar.gz、modules-h3ulcb.tgzを展開 |
$ sudo mount /dev/sdb1 /mnt | $ sudo mount /dev/sdb1 /mnt | ||
$ cd /mnt | $ cd /mnt | ||
Line 70: | Line 70: | ||
$ sudo mount /dev/sdb2 /mnt | $ sudo mount /dev/sdb2 /mnt | ||
$ cd /mnt | $ cd /mnt | ||
− | $ sudo tar -xvf ~/ubu/ubuntu-base-18.04. | + | $ sudo tar -xvf ~/ubu/ubuntu-base-18.04.5-base-arm64.tar.gz |
$ sudo tar -xvf ~/ubu/modules-h3ulcb.tgz | $ sudo tar -xvf ~/ubu/modules-h3ulcb.tgz | ||
$ cd / | $ cd / | ||
$ sudo umount /mnt | $ sudo umount /mnt | ||
+ | $ sync | ||
− | * | + | *PC側の作業は終了。microSDカードを抜く。 |
=== Starter Kit側の作業 === | === Starter Kit側の作業 === | ||
+ | *下図のようなネットワーク構成を前提とする。 | ||
+ | [[File:R-Car-Ubuntu-Network.jpg]] | ||
*前章で作成したmicroSDカードをStarter Kitに挿して、Starter Kitの電源を入れる。 | *前章で作成したmicroSDカードをStarter Kitに挿して、Starter Kitの電源を入れる。 | ||
− | U-Boot | + | U-Boot 2020.01 (Mar 18 2021 - 06:36:02 +0000) |
CPU:Renesas Electronics R8A7795 rev 3.0 | CPU:Renesas Electronics R8A7795 rev 3.0 | ||
Line 86: | Line 89: | ||
DRAM: 7.9 GiB | DRAM: 7.9 GiB | ||
・・・ | ・・・ | ||
− | Hit any key to stop autoboot: | + | 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 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' | => setenv bootcmd 'ext4load mmc 0:1 0x48000000 /boot/Image-r8a7795-h3ulcb-4x2g.dtb; ext4load mmc 0:1 0x48080000 /boot/Image; booti 0x48080000 - 0x48000000' | ||
Line 95: | Line 98: | ||
18993664 bytes read in 208 ms (87.1 MiB/s) | 18993664 bytes read in 208 ms (87.1 MiB/s) | ||
## Flattened Device Tree blob at 48000000 | ## Flattened Device Tree blob at 48000000 | ||
− | + | ・・・ | |
Starting kernel ... | Starting kernel ... | ||
− | + | ・・・ | |
h3ulcb login: root | h3ulcb login: root | ||
root@h3ulcb:~# cd /lib/modules/4.14.75-ltsi-yocto-standard/ | root@h3ulcb:~# cd /lib/modules/4.14.75-ltsi-yocto-standard/ | ||
Line 115: | Line 118: | ||
root@h3ulcb:/# apt-get install -y ubuntu-standard | root@h3ulcb:/# apt-get install -y ubuntu-standard | ||
root@h3ulcb:/# apt-get install -y vim net-tools ssh sudo tzdata rsyslog udev iputils-ping | root@h3ulcb:/# apt-get install -y vim net-tools ssh sudo tzdata rsyslog udev iputils-ping | ||
− | + | ・・・ | |
Preconfiguring packages ... | Preconfiguring packages ... | ||
Line 152: | Line 155: | ||
root@h3ulcb:/# umount /mnt | root@h3ulcb:/# umount /mnt | ||
root@h3ulcb:/# reboot | root@h3ulcb:/# reboot | ||
− | U-Boot | + | U-Boot 2020.01 (Mar 18 2021 - 06:36:02 +0000) |
− | + | ・・・ | |
− | Hit any key to stop autoboot: | + | Hit any key to stop autoboot: 0 |
=> setenv bootargs 'root=/dev/mmcblk1p2 rootwait rw' | => setenv bootargs 'root=/dev/mmcblk1p2 rootwait rw' | ||
=> saveenv | => saveenv |
Latest revision as of 18:45, 26 April 2021
R-Car Starter KitでUbuntu18を動かす
R-Car Starter Kit上で、Ubuntu18を動かすための手順を記載する。
用意するもの
- HW
- R-Car Starter Kit Pro/Premiere
容量とM3/H3は問わない。今回の検証では、H3 WS3.0 8GB を使用。 - microSDカード
16GB/32GB で検証済み。
- R-Car Starter Kit Pro/Premiere
- Yocto 4.7.0でビルドしてできた成果物
- Image
- Image-r8a7795-h3ulcb-4x2g.dtb
- core-image-minimal-h3ulcb.tar.bz2/core-image-weston-h3ulcb.tar.bz2
- modules-h3ulcb.tgz
- Ubuntu18のベースイメージ
- ubuntu-base-18.04.5-base-arm64.tar.gz
http://cdimage.ubuntu.com/ubuntu-base/releases/18.04/release/ からダウンロード
- ubuntu-base-18.04.5-base-arm64.tar.gz
- Linux PC
microSDカードのスロットがあるもの
以降、これらのファイルは ~/ubu ディレクトリ下に保存されている前提で説明を行う。
$ ls ~/ubu Image Image-r8a7795-h3ulcb-4x2g.dtb core-image-minimal-h3ulcb.tar.bz2 ( or core-image-weston-h3ulcb.tar.bz2) ubuntu-base-18.04.5-base-arm64.tar.gz modules-h3ulcb.tgz
セットアップ
LinuxPC側の作業
- microSDカードイメージの構築
- 挿されたmicroSDカードは、/dev/sdbとして以降説明
- microSDカードに何か入っている場合は、すべてのパーティションを削除してから作業
注意! これらの手順によってmicroSDカードの中身が完全に消去される場合があり、すべてのファイルが失われる可能性がある。
- microSDカードに何か入っている場合は、すべてのパーティションを削除してから作業
1.パーティションの作成
2つのパーティションを作成
1つ目は2GB、2つ目は残りの容量を割り当て
$ sudo fdisk /dev/sdb コマンド (mでヘルプ):n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p):p パーティション番号 (1-4, default 1):Enter keyを押す First sector (2048-30375935, default 2048):Enter keyを押す Last sector, +sectors or +size{K,M,G,T,P} (2048-30375935, default 30375935): +2G コマンド (mでヘルプ):n Partition type p primary (1 primary, 0 extended, 3 free) e extended (container for logical partitions) Select (default p):p パーティション番号 (2-4, default 2):Enter keyを押す First sector (4196352-62333951, default 4196352):Enter keyを押す Last sector, +sectors or +size{K,M,G,T,P} (4196352-62333951, default 62333951):Enter keyを押す(*) *16GBのmicroSDカード使用時も(*)のときにEnter keyを押す コマンド (mでヘルプ):w
2.ファイルシステムの作成
$ sudo mkfs.ext4 /dev/sdb1 $ sudo mkfs.ext4 /dev/sdb2
3.microSDカードにファイルを展開
1つ目のパーティションにcore-image-minimal-h3ulcb.tar.bz2/core-image-weston-h3ulcb.tar.bz2、modules-h3ulcb.tgzを展開
2つ目のパーティションにubuntu-base-18.04.5-base-arm64.tar.gz、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.5-base-arm64.tar.gz $ sudo tar -xvf ~/ubu/modules-h3ulcb.tgz $ cd / $ sudo umount /mnt $ sync
- PC側の作業は終了。microSDカードを抜く。
Starter Kit側の作業
- 下図のようなネットワーク構成を前提とする。
- 前章で作成したmicroSDカードをStarter Kitに挿して、Starter Kitの電源を入れる。
U-Boot 2020.01 (Mar 18 2021 - 06:36:02 +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のフォーマット 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. 「TimeZoneの設定用ウィンドウが開いたら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」 root@h3ulcb:/etc/systemd/network# cd /etc root@h3ulcb:/etc# vi shadow 「root行を書き換え->PWなし」 root::18295:0:99999:7::: root@h3ulcb:/etc# vi /etc/ssh/sshd_config 「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 2020.01 (Mar 18 2021 - 06:36:02 +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設定 Enter new UNIX password : h3ulcb Retry new UNIX password : h3ulcb root@localhost:~# dpkg-reconfigure tzdata 「TimeZoneの設定用ウィンドウが開いたらAsia/Tokyoを選択」 root@localhost:~# apt-get install -y language-pack-ja root@localhost:~# update-locale LANG=ja_JP.UTF-8 root@localhost:~# poweroff
この後、電源ボタンを押すことで、Ubuntu18が起動する。