VirtualBox上使用qemu和busybear搭建RISCV环境
Step 1:安装一些编译riscv需要的库:
sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
但是如果遇到了install失败的时候,可以选择使用其他的镜像:
进入 https://mirrors.ustc.edu.cn/repogen/ 选择自己的linux版本,比如说Ubuntu的apt/sources.list右击Download复制连接地址;
touch sources.list-backup
rm sources.list
wget https://mirrors.ustc.edu.cn/repogen/conf/ubuntu-https-4-kinetic
apt-get update
apt-get upgrad
之后应该就可以安装成功了
Step 2:安装工具riscv-tool和riscv-gnu-tools
因为都是比较大的,所以我选择先git然后对子目录进行--recursive
git clone https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain
git clone --recursive https://github.com/riscv/riscv-qemu.git
git clone --recursive https://github.com/riscv/riscv-newlib.git
git clone --recursive https://github.com/riscv/riscv-binutils-gdb.git
git clone --recursive https://github.com/riscv/riscv-dejagnu.git
git clone --recursive https://github.com/riscv/riscv-glibc.git
git clone --recursive https://github.com/riscv/riscv-gcc.git
git clone https://github.com/riscv/riscv-tools.git
cd riscv-tool
git clone --recursive https://github.com/riscv/riscv-isa-sim.git
git clone --recursive https://github.com/riscv/riscv-opcodes.git
git clone --recursive https://github.com/riscv/riscv-pk.git
git clone --recursive https://github.com/riscv/riscv-tests.git
Step 3: 编译工具链
vi ~/.bashrc
# 添加:
exprort RISCV="~/riscv_related/riscv-gnu-toolchain"
export PATH=$PATH:$RISCV/bin
# 退出执行
source ~/.bashrc
mkdir riscv-gnu-toolchain-build
cd riscv-gnu-toolchain-build
../riscv-gnu-toolchain/configure --prefix=$RISCV
make linux
这里configure和make的选项有很多
如果希望是搭建linux上的话环境需要make linux;否则到时候会提示找不到elf文件等
过程中可能会提示已经 directory not empty:
可以进入相应的文件夹中:
rm -rf riscv-binutils
rm -rf riscv-gdb
cd riscv-binutils-gdb
cp -a * ../riscv-binutils
cp -a * ../riscv-dbd
Step 4:编译工具riscv-tool
cd riscv-tools
./build.sh
# 问题1 :undefined macro AC_DEFINED
apt-get install libsys-dev
apt-get install pkg-config
# 问题2:No rule to make target all
apt-get install fesvr
# 问题3:runtimeerror is not a member of std
vi fesvr/dtm.cd
#include<stdexcept>
Step 5:安装qemu:
# 首先git安装qemu
# 我的提示没有python
apt-get install python-is-python3
# 查看版本
whereis python
# 安装glib,gthread:
apt-get install libglib2.0-dev
apt-get install libpixman-1-dev
./configure -disable-werror
make
make install
Step 6: 安装busybear
mkdir linux
git clone https://github.com/michaeljclark/busybear-linux.git
cd busybear-linux
make
# 问题1: stime有问题 --> 好像已经被废弃了
# 暴力解决方法:更换版本:但是不能直接将新的替换
# 查勘Makefile会发现每次都是会重新下载busybox的
cd conf
vi busybear.config
BUSYBOX_VERSION = 1.34.0
# 问题2:multiple definition of yylloc
# 是gcc版本太高的原因:
cd riscv-gnu-toolchain
cd riscv-gcc
cd gcc
vi BASE-VER
# 修改为9.5.0(小于10就可以)
Step 7:下载RISCV-Linux
cd linux
git clone https://github.com/riscv/riscv-linux.git
cd riscv-linux
git checkout riscv-linux-4.14
cp ../busybear-linux/conf/linux.config .config
make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- olddefconfig
make ARCH=riscv vmlinux
Step 8:安装BBL
git clone https://github.com/riscv/riscv-pk.git
cd riscv-pk
mkdir build
cd build
../configure --enable-logo --host=riscv64-unknown-linux-gnu- --with-payload=../../riscv-linux/vmlinux
Step 9:使用二进制文件:
mkdir release
cd release
wget https://github.com/michaeljclark/busybear-linux/releases/download/v1.0/bbl.bz2
wget https://github.com/michaeljclark/busybear-linux/releases/download/v1.0/busybear.bin.bz2
bzip2 -d *.bz2
Step 9 :登录:
sudo qemu-system-riscv64 -nographic -machine virt -kernel bbl -append "root=/dev/vda ro console=ttyS0" -drive file=busybear.bin,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -device virtio-net-device,netdev=net0
登录用户名:root
登录密码:busybear
然后就可以运行啦
# 测试命令
uname -a
# 结束退出
halt
VirtualBox上使用qemu和busybear搭建RISCV环境的更多相关文章
- 搭建riscv环境
1.第一步 clone 需要的源文件(sudo apt install git 如果你没有git) 以下都是给予ubuntu18.04 $ git clone --recursive https ...
- Docker搭建disconf环境,三部曲之二:本地快速构建disconf镜像
Docker下的disconf实战全文链接 <Docker搭建disconf环境,三部曲之一:极速搭建disconf>: <Docker搭建disconf环境,三部曲之二:本地快速构 ...
- MIT6.828准备:MacOS下搭建xv6和risc-v环境
本文介绍在MacOS下搭建Mit6.828/6.S081 fall2019实验环境的详细过程,包括riscv工具链.qemu和xv6,对于Linux系统同样可以参考. 介绍 只有了解底层原理才能写好上 ...
- 史上最全Windows版本搭建安装React Native环境配置
史上最全Windows版本搭建安装React Native环境配置 配置过React Native 环境的都知道,在Windows React Native环境配置有很多坑要跳,为了帮助新手快速无误的 ...
- win7上搭建Android环境及调试
工欲善其事必先利其器,好记性不如烂笔头.要学习一门新的语言,首先必须得先搭环境,否则没法实践.如果之前按照网上的提示,搭建过环境,而且环境比较复杂的话,我相信隔很长一段时间后,就会忘记,到真正用的时候 ...
- WIN10 vagrant和virtualbox虚拟机和一键搭建lnmp环境配置thinkphp虚拟主机
版本:win10系统 virtualbox:5.1.26 vagrant :1.9.7 centos 7.0 xshell/git 首先下载好对应版本的软件 配置vagrant和virtualbox ...
- virtualBox上虚拟机和主机互联{}
VirtualBox实现内外网络互访问的配置 环境: 宿主机操作系统 Windows XP sp3 虚拟机软件 VirtualBo ...
- [dpdk] 熟悉SDK与初步使用 (一)(qemu搭建实验环境)
搭建实验环境: troubleshoot 第一步加载驱动 第二步切换驱动 使用了所有qemu支持的卡 [tong@T7:~/VM/dpdk] % cat start.sh sudo qemu-syst ...
- 在ubuntu上搭建开发环境4---ubuntu简单的搭建LAMP环境和配置
最近重新安装了Ubuntu,但是之前的LAMP环境自然也就没有了,实在是不想再去编译搭建LAMP环境(这种方法实在是太费时间,而且太容易遇到各种不知道为什么的错误),所以,就去查查有没有什么简单的搭建 ...
- 在ubuntu上搭建开发环境3---解决Y470一键系统重装之后恢复ubuntu引导启动的方法
2015/08/18 将知识.常用的操作整理出来一定要完整,注意细节. 就像下面是再2015.04.27时候整理的,当时确实实验成功了,但是可能忘记记下具体的细节,尤其是3.4.5.6步骤中的关于盘符 ...
随机推荐
- 基于AS2协议的EDI 系统
一款由JAVA语言开发的基于AS2 协议的EDI 轻量级系统 优点如下: 1.价格便宜.目前市场上一条gateway线路动辄数万,甚至数万/年. 2.功能强大.功能可以与主流EDI 软件媲美. 3.可 ...
- iterator_traits技法
问题 在 C++ 泛型编程中,如何知道"迭代器所指对象的类型",以便声明临时变量呢?我们把迭代器所指对象的类型称为value type. template <class It ...
- 【踩坑记录】@Transactional注解回滚不生效问题
@Transactional属于是Spring的常用事务处理注解了,最近在开发时偶然发现这个东西竟然不是100%生效的. 问题重现: 测试一个批处理方法,方法上加了@Transactional后执行, ...
- JAVA虚拟机02---JAVA虚拟机运行时数据区域简介
JAVA虚拟机运行时数据区域 1.程序计数器 1)它可以看做是当前线程执行的字节代码的行指示器,通过改变计数器的值来决定下一步执行的代码 2)它是线程私有的,每个线程都有自己的程序计数器(JAVA ...
- 微信小程序项目中使用icon图标
效果: 步骤: 1.先让ui负责人把你的账号加入到项目中,加入到项目中后就可以在icon图标库中看到该项目 2.在小程序中使用 新建一个view,在上面加一个class,复制icon名字上去即可,注意 ...
- 国内“谁”能实现chatgpt,短期穷出的类ChatGPT简评(算法侧角度为主),以及对MOSS、ChatYuan给出简评,一文带你深入了解宏观技术路线。
1.ChatGPT简介[核心技术.技术局限] ChatGPT(全名:Chat Generative Pre-trained Transformer),美国OpenAI 研发的聊天机器人程序 ,于202 ...
- 首个比较研究表明维持期强柱患者减量续用TNFi疗效尚佳且药费省
首个比较研究表明维持期强柱患者减量续用TNFi疗效尚佳且药费省 Zavada J, et al. Ann Rheum Dis. 2016,75: 96-102. 电邮发布日期: 2016年5月4日 关 ...
- win11 文件夹内关闭显示更多
使用命令提示符 打开cmd窗口,输入 reg add HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\Inpro ...
- Infinity 和 -Infinity
认识 Infinity 在 JavaScript 中超出 1.797693134862315E+308 的数值即为 Infinity,小于 -1.797693134862316E+308 的数值为无穷 ...
- 【javascript】slice()、substring()和substr() 三种字符串截取方法区别
slice(start, end) :slice(start, end) 方法可提取字符串的某个部分,并以新的字符串返回被提取的部分. 1.start(包含) 和 end(不包含) 参数来指定字符串 ...