Git repo on learning to make a toy OS.
sudo apt-get install vgabios bochs bochs-x bximage
- Download Bochs from http://bochs.sourceforge.net/
- In terminal, run below:
tar -vxzf bochs-2.6.9.tar.gz
cd bochs-2.6.9
./configure --enable-debugger --enable-disasm
make
sudo make install
- In terminal, run:
bximage
. - Follow the instruction and select the option fd, then select a name for the floppy
- To compile:
nasm boot.asm -o boot.bin
- Create floppy image a.img by
bximage
- To write into floppy
dd if=boot.bin of=a.img bs=512 count=1 conv=notrunc
- To run in Bochs with debugger:
bochs
. Then type enter, type c
For ch3/ and ch4/, FreeDos is used as the boot image
- Create floppy image pm.img by
bximage
- To compile and write into floppy:
make all
(make clean
also available) - To start the FreeDos image:
bochs
. - To start the OS image:
- in Bochs terminal, clean up floppy b by
format B:
(for the first time only) - type
B:\[image_name].com
- in Bochs terminal, clean up floppy b by
- Create floppy image a.img by
bximage
- To compile and write into floppy, please review the Makefile, or simply:
make image
- To run in Bochs with debugger:
bochs
. Then type enter, type c
- Additionally, create a hard disk image 80m.img by
bximage
:Type: hd, Kind: flat, Size: 80, Name: 80m.img
- And add these 2 lines in .bochsrc file:
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=disk, path="80m.img", mode=flat
- To partition the HD:
/sbin/fdisk -c=dos -u=cylinders 80m.img
- Then partition the HD in fdisk command line, refer to https://www.geeksforgeeks.org/fdisk-command-in-linux-with-examples/
- On Mac's virtual machine, use fn + control + (F1 or F2 or F3) to shift among different consoles.