Bochs is a i386 PC emulator. It's very useful for testing new kernels - you won't have to reboot your PC to test your kernel. I decided to write this document especially for Linux, because I know there's already a tutorial for Windows out there. Consider you're in Linux, developing your kernel. You made a basic change and want to test your Operating System. Now, instead of rebooting your PC (which takes you much time), you just run Bochs. Bochs is quite powerful, but not perfect. It can happen that Bochs is not able to handle your kernel. That happens if your kernel has special options, but normally, Bochs runs fine - I had problems with it, but managed to solve it (it was my fault).
Bochs is available here. Download the Linux version, and install it on your PC.
You can run Bochs by just typing 'bochs' into the terminal. Bochs needs the XServer to be run... But before running Bochs the first time, you have to edit the .bochsrc file. This file contains the definitions for Bochs. Consider our kernel is loaded by GRUB. GRUB is installed on a floppy, that's the best way to do it. So we have to tell Bochs to boot from the floppy. That's my .bochsrc file:
megs: 32 romimage: file=/usr/local/bochs/1.4.1/BIOS-bochs-latest, address=0xf0000 vgaromimage: /usr/local/bochs/1.4.1/VGABIOS-elpin-2.40 floppya: 1_44=/dev/fd0, status=inserted boot: a log: bochsout.txt mouse: enabled=0
That's it. Now let's go step by step through it:
Copy this file into your home directory. Attention, you have to be root, because a normal user is not allowed to read from /dev/fd0! So you must have the fil /root/.bochsrc.txt. Okay, now run 'bochs' at last. Insert the GRUB disk and press three times [ENTER]. A new window will appear. Bochs will now load GRUB. When he has finished it is time to load our kernel. So remove the GRUB disk and insert a new disk which contains your kernel. Now double-click on the floppy symbol (the floppy with an 'A') to load the floppy in memory. Then, proceed as usually:
kernel /myos.bin boot
You don't need the root instruction...
That's it - you managed to run Bochs with GRUB and your kernel. It's quite useful, isn't it? I didn't have problems with Bochs yet (actually I had, but it was my fault).