| 123456789101112131415161718192021222324 |
- #!/bin/sh
- echo "Creating disk image..."
- bximage -q -func=create -hd=30M hd30M.img
- echo "Compiling..."
- nasm -I boot/include/ -o boot/mbr.bin boot/mbr.S
- nasm -I boot/include/ -o boot/loader.bin boot/loader.S
- i386-elf-gcc -c -o kernel/main.o kernel/main.c && i386-elf-ld kernel/main.o -Ttext 0xc0001500 -e main -o kernel/kernel.bin
- echo "Installing to disk image..."
- echo " 0. Writing mbr to disk..."
- dd if=boot/mbr.bin of=hd30M.img bs=512 count=1 conv=notrunc
- echo " 1. Writing loader to disk..."
- dd if=boot/loader.bin of=hd30M.img bs=512 count=4 seek=2 conv=notrunc
- echo " 2. Writing kernel to disk..."
- dd if=kernel/kernel.bin of=hd30M.img bs=512 count=2000 seek=9 conv=notrunc
- # echo " 2. Writing kernel to disk..."
- # TODO: Add code to write the kernel to the disk image
- echo "Disk image created successfully."
- # echo "Now starting bochs ..."
- # bochs -f bochsrc.txt
|