Tech Blog

VisionFive 2 で Ubuntu 23.04 を試してみる

Cover Image for VisionFive 2 で Ubuntu 23.04 を試してみる

VisionFive 2 用の Ubuntu 23.04 (Lunar Lobster) が リリース されたので riscv64 な Ubuntu を動かしてみる

今回の環境

TL;DR

1. 環境構築

picocomXZ Utils をインストールする

brew install picocom xz
==> Pouring picocom--3.1_1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/picocom/3.1_1: 7 files, 153KB
==> Pouring xz--5.4.3.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/xz/5.4.3: 162 files, 2.6MB

DIP スイッチを RGPIO_0 = 0, RGPIO_1 = 0 に設定し UART-TTL USB アダプターを PIN 8 (GPIO5 UART TX) , PIN 10 (GPIO6 - UART RX), GND に接続する

PINs

picocom を起動する

$ ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port    /dev/tty.usbmodem2102
picocom -b 115200 /dev/tty.usbmodem2102
picocom v3.1

Type [C-a] [C-h] to see available commands
Terminal ready

2.U-Boot の更新

VisionFive2 リリース から sdcard.img, u-boot-spl.bin.normal.out, visionfive2_fw_payload.img をダウンロードする
sdcard.img を SD カードに書き込み起動する

diskutil list
/dev/disk0 (internal, physical):
  #:                   TYPE NAME         SIZE       IDENTIFIER
  0:  GUID_partition_scheme             *1000.6 GB  disk0
  1:    Apple_APFS_ISC Container disk1   524.3 MB   disk0s1
  2:      Apple_APFS Container   disk2   999.8 GB   disk0s2
/dev/diskX (internal, physical):
  #:                 TYPE NAME           SIZE       IDENTIFIER
  0:  GUID_partition_scheme             *62.6 GB    diskX
diskutil unmountDisk /dev/diskX
Unmount of all volumes on disk4 was successful
sudo dd bs=1M if=sdcard.img of=/dev/rdiskX
800+1 records in
800+1 records out
838881280 bytes transferred in 53.206866 secs (15766410 bytes/sec)

u-boot-spl.bin.normal.out, visionfive2_fw_payload.img を buildroot にコピーする

scp u-boot-spl.bin.normal.out root@10.0.0.XXX:/root/
root@10.0.0.XXX's password:
u-boot-spl.bin.normal.out     100%  129KB  3.9MB/s  00:00
scp visionfive2_fw_payload.img root@10.0.0.XXX:/root/
root@10.0.0.XXX's password:
visionfive2_fw_payload.img    100% 2887KB  6.9MB/s  00:00

SPL, U-Boot を更新する

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00001000 "spl"
mtd1: 00300000 00001000 "uboot"
mtd2: 00100000 00001000 "data"
flashcp -v u-boot-spl.bin.normal.out /dev/mtd0
Erasing blocks: 33/33 (100%)
Writing data: 129k/129k (100%)
Verifying data: 129k/129k (100%)
flashcp -v visionfive2_fw_payload.img /dev/mtd1
Erasing blocks: 722/722 (100%)
Writing data: 2887k/2887k (100%)
Verifying data: 2887k/2887k (100%)
reset

バージョンを確認する

version
U-Boot 2021.10 (Jun 21 2023 - 13:42:04 +0800), Build: jenkins-github_visionfive2-15

riscv64-buildroot-linux-gnu-gcc.br_real (Buildroot VF2_v3.1.5) 12.2.0
GNU ld (GNU Binutils) 2.39

3.Ubuntu 23.04 のインストール

Ubuntu リリース から RISC-V for StarFive VisionFive 2 preinstalled server image をダウンロードする
SD カードに書き込み起動する

xzcat ubuntu-23.04-preinstalled-server-riscv64+visionfive2.img.xz | sudo dd bs=1M conv=fsync of=/dev/rdiskX
0+383385 records in
4608+0 records out
4831838208 bytes transferred in 323.323853 secs (14944268 bytes/sec)

GNU GRUB

更新する

sudo apt update
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
...
77 packages can be upgraded. Run 'apt list --upgradable' to see them.
sudo apt full-upgrade -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
77 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
52 standard LTS security updates
...
Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart systemd-logind.service
 systemctl restart unattended-upgrades.service
 systemctl restart wpa_supplicant.service

No containers need to be restarted.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
sudo shutdown -r now

4.バージョン確認

neofetch

参考にしたページ