MilkV Mars
Milk-V Maars で遊んだときの記録
U-Boot + OpenSBI
基本はU-Bootのドキュメントの通りにやればよい。
export CROSS_COMPILE=riscv64-suse-linux- # Replace this with your own prefix
export U_BOOT=u-boot-2026.01
export DEVICE=/dev/mmcblk0
git clone --depth=1 https://github.com/riscv/opensbi.git
cd opensbi
make PLATFORM=generic -j$(nproc)
cd ..
curl https://ftp.denx.de/pub/u-boot/$U_BOOT.tar.bz2 | tar xjvf -
cd $U_BOOT
make starfive_visionfive2_defconfig
make OPENSBI=../opensbi/build/platform/generic/firmware/fw_dynamic.bin -j$(nproc)
echo -e "g\nn\n1\n4096\n8191\nt\n2E54B353-1271-4842-806F-E436D6AF6985\nn\n2\n8192\n16383\nt\n2\nBC13C2FF-59E6-4262-A352-B275FD6F7172\nn\n3\n16384\n\nw\n" | sudo fdisk $DEVICE
sudo dd if=spl/u-boot-spl.bin.normal.out of=${DEVICE}p1
sudo dd if=u-boot.itb of=${DEVICE}p2
# ${DEVICE}p3 can use freely
ベアメタルプログラミング注意事項
- 色々情報が錯綜しているが、どうやらRISC-V Privileged ISA version 1.10準拠らしく、
senvcfgレジスタにアクセスできないsenvcfgは拡張機能の対応状況を格納するレジスタ- アクセスすると不正命令例外が発生する
- 動的に判断するのは難しいので、ビルドタイムに決定するのが吉