参考这篇文章https://developer.aliyun.com/article/1323996,其中在wsl下面安装可能会报错环境变量中有空格。
# clean_path.sh#!/bin/bash# 备份旧 PATH
OLD_PATH="$PATH"# 过滤掉包含空格、制表符、换行的路径
CLEAN_PATH=""
IFS=':' read -ra PATH_ENTRIES <<< "$OLD_PATH"
for entry in "${PATH_ENTRIES[@]}"; doif [[ "$entry" != *" "* && "$entry" != *$'\t'* && "$entry" != *$'\n'* ]]; thenCLEAN_PATH+="$entry:"fi
done# 去掉末尾的冒号
CLEAN_PATH="${CLEAN_PATH%:}"# 输出清洗结果
echo "Old PATH: $OLD_PATH"
echo "Clean PATH: $CLEAN_PATH"# 导出新 PATH
export PATH="$CLEAN_PATH"
上述程序加到clean_path.sh
chmod +x clean_path.sh
source ./clean_path.sh
然后安装过程中最后一步会报错,qemu-system-riscv64: Some ROM regions are overlapping
These ROM regions might have been loaded by direct user request or by default.
They could be BIOS/firmware images, a guest kernel, initrd or some other file loaded into guest memory.
Check whether you intended to load all this guest code, and whether it has been built to load to the correct addresses.
The following two regions overlap (in the memory address space):
fw_jump.elf ELF program header segment 1 (addresses 0x0000000000000000 - 0x0000000000027f28)
mrom.reset (addresses 0x0000000000001000 - 0x0000000000001028)
此时把命令中的.elf换成.bin,同时要替换对应的文件。