ci-start-riscv64.sh 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. LOG_FILE="../serial_opt.txt"
  2. # uboot版本
  3. UBOOT_VERSION="v2023.10"
  4. RISCV64_UBOOT_PATH="../tools/arch/riscv64/u-boot-${UBOOT_VERSION}-riscv64"
  5. if [ ! -d ${RISCV64_UBOOT_PATH} ]; then
  6. echo "正在下载u-boot..."
  7. uboot_tar_name="u-boot-${UBOOT_VERSION}-riscv64.tar.xz"
  8. uboot_parent_path=$(dirname ${RISCV64_UBOOT_PATH}) || (echo "获取riscv u-boot 版本 ${UBOOT_VERSION} 的父目录失败" && exit 1)
  9. if [ ! -f ${uboot_tar_name} ]; then
  10. wget https://mirrors.dragonos.org.cn/pub/third_party/u-boot/${uboot_tar_name} || (echo "下载riscv u-boot 版本 ${UBOOT_VERSION} 失败" && exit 1)
  11. fi
  12. echo "下载完成"
  13. echo "正在解压u-boot到 '$uboot_parent_path'..."
  14. mkdir -p $uboot_parent_path
  15. tar xvf u-boot-${UBOOT_VERSION}-riscv64.tar.xz -C ${uboot_parent_path} || (echo "解压riscv u-boot 版本 ${UBOOT_VERSION} 失败" && exit 1)
  16. echo "解压完成"
  17. rm -rf u-boot-${UBOOT_VERSION}-riscv64.tar.xz
  18. fi
  19. echo "riscv u-boot 版本 ${UBOOT_VERSION} 已经安装"
  20. qemu-system-riscv64 -machine virt -kernel ../tools/arch/riscv64/u-boot-v2023.10-riscv64/u-boot.bin \
  21. -m 512M -nographic -smp 2,cores=2,threads=1,sockets=1 -bios default \
  22. -no-reboot -device virtio-net-device,netdev=net -netdev user,id=net \
  23. -rtc base=utc \
  24. -drive file=../bin/riscv64/disk.img,if=none,format=raw,id=x1 \
  25. -device virtio-blk-device,drive=x1,bus=virtio-mmio-bus.1 -s \
  26. -serial chardev:mux -monitor chardev:mux \
  27. -chardev stdio,id=mux,mux=on,signal=off,logfile=${LOG_FILE}