build.sh 870 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. echo "Creating disk image..."
  3. bximage -q -func=create -hd=30M hd30M.img
  4. echo "Compiling..."
  5. nasm -I boot/include/ -o boot/mbr.bin boot/mbr.S
  6. nasm -I boot/include/ -o boot/loader.bin boot/loader.S
  7. 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
  8. echo "Installing to disk image..."
  9. echo " 0. Writing mbr to disk..."
  10. dd if=boot/mbr.bin of=hd30M.img bs=512 count=1 conv=notrunc
  11. echo " 1. Writing loader to disk..."
  12. dd if=boot/loader.bin of=hd30M.img bs=512 count=4 seek=2 conv=notrunc
  13. echo " 2. Writing kernel to disk..."
  14. dd if=kernel/kernel.bin of=hd30M.img bs=512 count=2000 seek=9 conv=notrunc
  15. # echo " 2. Writing kernel to disk..."
  16. # TODO: Add code to write the kernel to the disk image
  17. echo "Disk image created successfully."
  18. # echo "Now starting bochs ..."
  19. # bochs -f bochsrc.txt