Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d60dc6f)
raw | patch | inline | side by side (parent: d60dc6f)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Sun, 14 May 2023 15:04:08 +0000 (23:04 +0800) | ||
| committer | zhaoyanbai <zhaoyanbai@126.com> | |
| Sun, 14 May 2023 15:04:08 +0000 (23:04 +0800) |
| .clang-format | patch | blob | history | |
| .gitignore | patch | blob | history | |
| gdbscript | [new file with mode: 0644] | patch | blob |
| qemu.sh | [new file with mode: 0755] | patch | blob |
| scripts/debug | [new file with mode: 0644] | patch | blob |
| scripts/iso | [new file with mode: 0644] | patch | blob |
| scripts/iso.grub.cfg | [new file with mode: 0644] | patch | blob |
| scripts/mkiso.sh | [new file with mode: 0755] | patch | blob |
diff --git a/.clang-format b/.clang-format
--- a/.clang-format
+++ b/.clang-format
IndentCaseLabels: false
+# 行注释 "//" 前增加两个空格
+SpacesBeforeTrailingComments: 2
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
*.lock
*.DS_Store
.vscode
+*.iso
diff --git a/gdbscript b/gdbscript
--- /dev/null
+++ b/gdbscript
@@ -0,0 +1 @@
+target remote localhost:1234
diff --git a/qemu.sh b/qemu.sh
--- /dev/null
+++ b/qemu.sh
@@ -0,0 +1,25 @@
+qemu-system-i386 -s -S -drive file=HD.IMG,format=raw,index=0,media=disk -drive file=kernel.iso,index=1,media=cdrom &
+pid=$!
+echo "pid is ${pid}"
+
+i386-elf-gdb -x gdbscript; kill -9 $pid
+
+
+# qemu-system-i386 -drive file=HD.IMG,format=raw,index=0,media=disk -cdrom kernel.iso
+
+
+# -cdrom kernel.iso
+# -drive file=kernel.iso,index=2,media=cdrom
+
+# connect a CDROM to the slave of ide0
+# -drive if=ide,index=1,media=cdrom
+
+# -hda,-hdb,-hdc,-hdd
+# -drive file=file,index=0,media=disk
+# -drive file=file,index=1,media=disk
+# -drive file=file,index=2,media=disk
+# -drive file=file,index=3,media=disk
+
+
+# -s shorthand for -gdb tcp::1234
+# -S freeze CPU at startup (use 'c' to start execution)
diff --git a/scripts/debug b/scripts/debug
--- /dev/null
+++ b/scripts/debug
@@ -0,0 +1 @@
+i386-elf-gdb
diff --git a/scripts/iso b/scripts/iso
--- /dev/null
+++ b/scripts/iso
@@ -0,0 +1,3 @@
+dnf install grub2
+dnf install xorriso
+grub2-mkrescue -o grub.iso iso
diff --git a/scripts/iso.grub.cfg b/scripts/iso.grub.cfg
--- /dev/null
+++ b/scripts/iso.grub.cfg
@@ -0,0 +1,8 @@
+set default="0"
+
+set timeout=1
+menuentry 'Kernel' --class os {
+ #insmod ext2
+ multiboot2 /boot/Kernel root=hda0 delay=2
+ boot
+}
diff --git a/scripts/mkiso.sh b/scripts/mkiso.sh
--- /dev/null
+++ b/scripts/mkiso.sh
@@ -0,0 +1,5 @@
+# 在父目录运行
+mkdir -p /tmp/iso/boot/grub/
+cp iso.grub.cfg /tmp/iso/boot/grub/
+cp KERNEL.BIN /tmp/iso/boot/Kernel
+grub2-mkrescue -o kernel.iso /tmp/iso