大环境: Ubuntu
下载:
从https://github.com/panks/Xv6上下载的源代码可以直接编译通过,而且在qemu上能顺利运行!<2017/07/20>最近又把这个远程库里边的clone了一份到我的库,发现编译过程出现了两个错
1.
gcc -Werror -Wall -o mkfs mkfs.c
mkfs.c:14:0: error: "static_assert" redefined [-Werror]
#define static_assert(a, b) do { switch (0) case 0: case (a): ; } while (0)
^
In file included from mkfs.c:6:0:
/usr/include/assert.h:120:0: note: this is the location of the previous definition
# define static_assert _Static_assert
^
cc1: all warnings being treated as errors
Makefile:149: recipe for target 'mkfs' failed
make: *** [mkfs] Error 1
原因就是static_assert这个宏重复定义了
2.
*** Error: Couldn't find a working QEMU executable.
*** Is the directory containing the qemu binary in your PATH
*** or have you tried setting the QEMU variable in Makefile?
***
没有找到qemu
在这里,我克隆了一份代码到我的github,可参考我的修改(修改方法很多)git@github.com:wangrongwei/Xv6.git
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
我从其他的源代码网站上git的Xv6源代码,编译中出现error,手动修改后,虽然编译通过了,但是无法在qemu或bochs上正常运行。
运行环境:
选择bochs、qemu等虚拟机,可以使用ubuntu在线安装(apt-get install qemu)等,然后进入Xv6-master目录下进行make qemu(当然虚拟机选择的是qemu)
运行:
qemu-system-i386-serial mon:stdio-hdb fs.img xv6.img-smp1-m512
或者qemu-system-x86_64-smp1-parallel stdio -hdb fs.img xv6.img-m512
此处使用make qemu-nox,则不会跳出QEMU 窗口,只在你的终端里显示。