2020 MIT6.S081 Lab环境搭建

本文记录了在Ubuntu系统中搭建MIT6.S081实验环境的过程,包括使用QEMU和RISC-V交叉编译工具链。在安装过程中遇到了因镜像源问题导致的错误,通过切换到阿里云镜像源解决了问题,并成功安装了所需软件。最后验证了riscv64-unknown-elf-gcc和qemu-system-riscv64的安装,完成环境配置。
摘要由CSDN通过智能技术生成

友情链接:全部实验哟

最新对底层比较感兴趣,在网上搜索,网友推荐了MIT的两门课程MIT6.S081 Operating System EngineeringMIT6.S808。准备利用闲暇的时间,系统学习一下。本篇文章主要记录MIT 6.S081实验环境的搭建。

环境搭建

官方搭建步骤
本地环境为ubuntu,安装步骤为:

sudo apt-get install qemu-system-misc=1:4.2-3ubuntu6
sudo apt-get install git build-essential gdb-multiarch gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu 

出错如下:

Fetched 62.6 MB in 4min 36s (227 kB/s)
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-common_2.40.0+dfsg-3ubuntu0.1_all.deb  404  Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-0_2.40.0+dfsg-3ubuntu0.1_amd64.deb  404  Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/gdk-pixbuf/libgdk-pixbuf2.0-bin_2.40.0+dfsg-3ubuntu0.1_amd64.deb  404  Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-block-extra_4.2-3ubuntu6.12_amd64.deb  404  Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-system-common_4.2-3ubuntu6.12_amd64.deb  404  Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-system-data_4.2-3ubuntu6.12_all.deb  404  Not Found [IP: 91.189.88.142 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-utils_4.2-3ubuntu6.12_amd64.deb  404  Not Found [IP: 91.189.88.142 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

该问题是镜像源的问题,更新镜像源:

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
vim /etc/apt/sources.list

将镜像替换为aliyun镜像

:%s/archive.ubuntu.com/mirrors.aliyun.com/g

更新源之后再次安装即可。

sudo apt update
sudo apt upgrade

测试是否安装成功

测试riscv64-unknown-elf-gcc是否安装成功。

$ riscv64-unknown-elf-gcc --version
$ sudo apt install gcc-riscv64-unknown-elf
riscv64-unknown-elf-gcc () 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

测试qemu-system-risv64是否安装成功。

$ qemu-system-risv64 --version
QEMU emulator version 4.2.0 (Debian 1:4.2-3ubuntu6)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers

编译qemu

git clone git://g.csail.mit.edu/xv6-labs-2020
cd xv6-labs-2020
git checkout util

出现如下界面说明编译成功:
在这里插入图片描述
至此,环境编译成功,可以跟着课程做实验了。
退出系统 Ctrl-a x.

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值