target remote localhost:1234
+file KERNEL.BIN
-qemu-system-i386 -s -S -drive file=HD.IMG,format=raw,index=0,media=disk -drive file=kernel.iso,index=1,media=cdrom &
+qemu-system-i386 \
+ -boot d \
+ -drive file=HD.IMG,format=raw,index=0,media=disk \
+ -drive file=kernel.iso,index=1,media=cdrom \
+ -s -S \
+ &
+
+#qemu-system-x86_64 -boot d -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
+echo "kill pid ${pid}"
+
+#x86_64-elf-gdb -x gdbscript; kill -9 $pid
+
# qemu-system-i386 -drive file=HD.IMG,format=raw,index=0,media=disk -cdrom kernel.iso
set default="0"
set timeout=1
-menuentry 'Kernel' --class os {
+menuentry 'Kernel.ISO' --class os {
#insmod ext2
set root='(hd0,1)'
multiboot2 /boot/Kernel root=hda0 delay=2
sleep 1
# 创建主分区并设置为活动分区
-parted ${lodev} mklabel msdos
-parted ${lodev} mkpart primary ext2 200k 100% -a minimal
+parted -s ${lodev} mklabel msdos
+parted -s ${lodev} mkpart primary ext2 200k 100% -a minimal
parted ${lodev} set 1 boot on
sleep 1
dnf install grub2
+dnf install grub2-tools-extra
dnf install xorriso
grub2-mkrescue -o grub.iso iso
+
+
+# mkefs
+dnf install e2fsprogs
+dnf install parted
+
+dnf install gcc-x86_64-linux-gnu
+
+# 如果在docker的linux中提示losetup: cannot find an unused loop device
+# 则需要用docker run --privileged来启动
+#
+# 如果是在M1的Mac上要使用x86 linux的docker镜像
+# 则应该使用docker pull --platform=linux/amd64
# 在父目录运行
+# 这个代码必需要在x86的linux机器上运行
+# 因为如果在其它机器上运行,其grub就不是x86版本
mkdir -p /tmp/iso/boot/grub/
-cp iso.grub.cfg /tmp/iso/boot/grub/
+cp scripts/iso.grub.cfg /tmp/iso/boot/grub/grub.cfg
cp KERNEL.BIN /tmp/iso/boot/Kernel
-grub2-mkrescue -o kernel.iso /tmp/iso
+grub2-mkrescue -o kernel.iso /tmp/iso/