ifndef TOOLPREFIX TOOLPREFIX := $(shellif i386-jos-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \ then echo 'i386-jos-elf-'; \ elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \ then echo ''; \ else echo "***" 1>&2; \ echo "*** Error: Couldn't find an i386-*-elf version of GCC/binutils." 1>&2; \ echo "*** Is the directory with i386-jos-elf-gcc in your PATH?" 1>&2; \ echo "*** If your i386-*-elf toolchain is installed with a command" 1>&2; \ echo "*** prefix other than 'i386-jos-elf-', set your TOOLPREFIX" 1>&2; \ echo "*** environment variable to that prefix and run 'make' again." 1>&2; \ echo "*** To turn off this error, run 'gmake TOOLPREFIX= ...'." 1>&2; \ echo "***" 1>&2; exit 1; fi) endif
若找不到合适的版本,输出错误信息
(3)配置模拟器qemu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
ifndef QEMU QEMU = $(shellif which qemu > /dev/null; \ then echo qemu; exit; \ elif which qemu-system-i386 > /dev/null; \ then echo qemu-system-i386; exit; \ elif which qemu-system-x86_64 > /dev/null; \ then echo qemu-system-x86_64; exit; \ else \ qemu=/Applications/Q.app/Contents/MacOS/i386-softmmu.app/Contents/MacOS/i386-softmmu; \ if test -x $$qemu; then echo $$qemu; exit; fi; fi; \ echo "***" 1>&2; \ echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \ echo "*** Is the directory containing the qemu binary in your PATH" 1>&2; \ echo "*** or have you tried setting the QEMU variable in Makefile?" 1>&2; \ echo "***" 1>&2; exit 1) endif
# 初始化调试器 .gdbinit: .gdbinit.tmpl sed "s/localhost:1234/localhost:$(GDBPORT)/" < $^ > $@
qemu-gdb: fs.img xv6.img .gdbinit @echo "*** Now run 'gdb'." 1>&2 $(QEMU) -serial mon:stdio $(QEMUOPTS) -S $(QEMUGDB)
qemu-nox-gdb: fs.img xv6.img .gdbinit @echo "*** Now run 'gdb'." 1>&2 $(QEMU) -nographic $(QEMUOPTS) -S $(QEMUGDB)
(17)文件整理打包为tar
1 2 3 4 5 6
tar: rm -rf /tmp/xv6 mkdir -p /tmp/xv6 cp dist/* dist/.gdbinit.tmpl /tmp/xv6 (cd /tmp; tar cf - xv6) | gzip >xv6-rev10.tar.gz # the next one will be 10 (9/17)