在 VisionFive 内运行 openEuler RISC-V 移植版

在 VisionFive 内运行 openEuler RISC-V 移植版

:!: 该页面所写的内容不具有时效性,以最新的为准。

首先,去这里下载最新的开发版镜像。

其中,openeuler-visionfive.img.tar.zst 是纯命令行版(但不是最小化镜像),openeuler-visionfive-xfce.img.tar.zst 是带 xfce 界面的版本。

安装

准备一张 TF 卡,写入推荐使用 Etcher

写入之后,将 TF 卡插入开发板。在开机之前,需要准备串口连接。串口连接的更多信息请查看官方文档的附录 B → 硬件连接的步骤二。

如果一切配置正确,开机之后应该就会出现 bootloader version 之类的字样。

进入系统

由于还没有搞 EFI 分区启动,所以目前要手动通过命令行启动。按顺序输入以下指令:

setenv kernel_comp_addr_r 0x90000000;setenv kernel_comp_size 0x10000000;setenv kernel_addr_r 0x84000000;setenv fdt_addr_r 0x88000000
setenv bootargs console=ttyS0,115200 earlycon=sbi root=/dev/mmcblk0p1 rw stmmaceth=chain_mode:1 loglevel=8
fatls mmc 0:1
load mmc 0:1 ${kernel_addr_r} /boot/Image
load mmc 0:1 ${fdt_addr_r} /boot/jh7100-starfive-visionfive-v1.dtb
booti ${kernel_addr_r} - ${fdt_addr_r}

增加分区大小

默认的 img 只有 2 GB。我们要对其扩容。

默认的设备名应该为 /dev/mmcblk0,在这里我们使用 fdisk 进行操作,首先使用 fdisk -l 列出分区表:

GPT PMBR size mismatch (4194303 != 124735487) will be corrected by write.
The backup GPT table is not on the end of the device.
Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 96F9C2E5-E969-4D86-941B-CEFBA947BA1E

Device         Start     End Sectors Size Type
/dev/mmcblk0p1   256 4194270 4194015   2G unknown

可以看到,我们的起始为 256,这个值一定要记住。然后使用 fdisk /dev/mmcblk0 来开始更改分区表。

思路很简单:删除分区然后再创建新分区,但 Start 相同,然后不移除 signature。

Command (m for help): d

Selected partition 1
Partition 1 has been deleted.

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (34-124735454, default 2048): 256
Last sector, +/-sectors or +/-size{K,M,G,T,P} (256-124735454, default 124735454): 

Created a new partition 1 of type 'Linux filesystem' and of size 59.5 GiB.
Partition #1 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): w

The partition table has been altered.
Syncing disks.

退出之后,我们再来用 fdisk -l 列出分区表看一下:

Disk /dev/mmcblk0: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 96F9C2E5-E969-4D86-941B-CEFBA947BA1E

Device         Start       End   Sectors  Size Type
/dev/mmcblk0p1   256 124735454 124735199 59.5G Linux filesystem

看上去很棒,最后使用 resize2fs /dev/mmcblk0p1 获取空间就可以了。