浏览代码

add: build.sh and clean.sh

runningwater 11 月之前
父节点
当前提交
5f2df661cb
共有 3 个文件被更改,包括 23 次插入0 次删除
  1. 20 0
      build.sh
  2. 3 0
      clean.sh
  3. 二进制
      hd30M.img

+ 20 - 0
build.sh

@@ -0,0 +1,20 @@
+#!/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
+
+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..."
+# TODO: Add code to write the kernel to the disk image
+echo "Disk image created successfully."
+
+# echo "Now starting bochs ..."
+# bochs -f bochsrc.txt

+ 3 - 0
clean.sh

@@ -0,0 +1,3 @@
+#!/bin/sh
+
+rm -rf bochsout.txt hd30M.img *.bin boot/*.bin

二进制
hd30M.img