part 1: running xv6
step 1: Fetch and un-tar the xv6 source:
step 2: Build xv6:
step 3: install qemu
$sudo apt-get install qemu
$qemu-system-i386 // run qemu for testing
step 4: Test Your Compiler Toolchain
Modern Linux and BSD UNIX distributions already provide a toolchain suitable for 6.828. To test your distribution, try the following commands:
% objdump -i
The second line should say elf32-i386.
% gcc -m32 -print-libgcc-file-name
The command should print something like /usr/lib/gcc/i486-linux-gnu/version/libgcc.a or/usr/lib/gcc/x86_64-linux-gnu/version/32/libgcc.a
If both these commands succeed, you're all set, and don't need to compile your own toolchain.
Part 2: debugging
step 1:
cd to xv6 folder
$ make qemu-gdb
step 2:
1. open anther terminal
2. cd to xv6 folder
3.
$ gdb kernel note: if it has warning of : File "**/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load" solution: 1. $ source .gdbinit. or 2. add add-auto-load-safe-path **/.gdbinit line to your configuration file "**/.gdbinit"
at this point ,you can begin debugging xv6
reference:
1. http://zoo.cs.yale.edu/classes/cs422/2011/lec/l2-hw
2. https://pdos.csail.mit.edu/6.828/2016/tools.html
3. https://pdos.csail.mit.edu/6.828/2016/homework/xv6-boot.html