MIT6.828课程JOS在macOS下的环境配置

2018-12-30  本文已影响11人  荷茗

MIT6.828课程JOS在macOS下的环境配置

1 包管理工具工具

2 安装 QEMU 与编译器

2.1 QEMU

$ brew install qemu
ln -s  /usr/local/Cellar/qemu/3.1.0_1/bin/qemu-system-i386 /usr/local/bin/qemu

注意: 3.1.0_1 有可能是其他数字。

2.2 i386-elf-gcc

sudo port -v selfupdate
sudo port install i386-elf-gcc

3 编译内核

git clone https://pdos.csail.mit.edu/6.828/2018/jos.git lab
cd lab
vim GNUmakefile.patch

将下面的代码 copy 进去

diff --git a/GNUmakefile b/GNUmakefile
index 7bd9e14..eea6406 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -33,8 +33,8 @@ TOP = .
 
 # try to infer the correct GCCPREFIX
 ifndef GCCPREFIX
-GCCPREFIX := $(shell if i386-jos-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
-   then echo 'i386-jos-elf-'; \
+GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
+   then echo 'i386-elf-'; \
    elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
    then echo ''; \
    else echo "***" 1>&2; \

patch -p1 < GNUmakefile.patch #打上 patch
make #编译内核
make qemu # or  make qemu-nox
qemu

参考文章:

上一篇下一篇

猜你喜欢

热点阅读