在软盘映像文件中使用 grub 在 bochs 中启动您自己的内核

发布于 2024-10-18 04:50:58 字数 3138 浏览 5 评论 0原文

基本上我已经按照这里的说明 http://sig9.com/bochs-grub 创建了一个裸映像文件,它什么也不做,只是让 BIOS 启动 GRUB。

问题是:

  • 我正在编写的内核将是 32 位的,使用 http://www .jamesmolloy.co.uk/tutorial_html/index.html 作为开始,但我的主机(物理)机器是 x86_64,bochs 配置如下: <块引用>

    ./configure --prefix=/usr --enable-vbe --without-wx --enable-cpu-level=6 \ --enable-fpu \ --enable-plugins --enable-x86-64 --enable-smp \ --enable-long-phy-address --enable-debugger --enable-disasm --enable-debugger-gui \ --enable-raw-serial --enable-vmx --enable-x86-debugger --enable-iodebug

所以我不确定这是否有效,即使在解决了下一个问题之后:

  • 当我启动 bochs 时,grub shell 不会启动。

我得到的只是:

00000000000i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000
00000000000i[CPU0 ] CPU[0] is the bootstrap processor
00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00000000000i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002020 078bfbff
00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000
00000000000i[PLGIN] reset of 'unmapped' plugin device by virtual method
00000000000i[PLGIN] reset of 'biosdev' plugin device by virtual method
00000000000i[PLGIN] reset of 'speaker' plugin device by virtual method
00000000000i[PLGIN] reset of 'extfpuirq' plugin device by virtual method
00000000000i[PLGIN] reset of 'iodebug' plugin device by virtual method
00000000000i[PLGIN] reset of 'ioapic' plugin device by virtual method
00000000000i[PLGIN] reset of 'keyboard' plugin device by virtual method
00000000000i[PLGIN] reset of 'harddrv' plugin device by virtual method
00000000000i[PLGIN] reset of 'serial' plugin device by virtual method
00000000000i[PLGIN] reset of 'parallel' plugin device by virtual method
00000000000i[XGUI ] [x] Mouse off
00000000000i[     ] set SIGINT handler to bx_debug_ctrlc_handler
Next at t=0
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b         ; ea5be000f0

有人知道我可能做错了什么吗?

我怀疑按照 http://sig9.com/bochs-grub 的说明复制我的主机的 64 位 grub 二进制文件到 floppy.img 上,它应该是一个 32 位模拟系统。

Basically I've followed the instructions here http://sig9.com/bochs-grub to create a bare image file which does nothing but lets the BIOS start GRUB.

The problems are:

  • The kernel I am writing will be 32-bit, using http://www.jamesmolloy.co.uk/tutorial_html/index.html for a start, but my host (physical) machine is x86_64 with bochs configured like this:

    ./configure --prefix=/usr --enable-vbe
    --without-wx --enable-cpu-level=6 \
    --enable-fpu \ --enable-plugins --enable-x86-64
    --enable-smp \ --enable-long-phy-address
    --enable-debugger --enable-disasm --enable-debugger-gui \ --enable-raw-serial --enable-vmx
    --enable-x86-debugger --enable-iodebug

so I'm not sure this will work, even after solving the next issue:

  • The grub shell won't start when I boot up bochs.

All I get is:

00000000000i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000
00000000000i[CPU0 ] CPU[0] is the bootstrap processor
00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00000000000i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002020 078bfbff
00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000
00000000000i[PLGIN] reset of 'unmapped' plugin device by virtual method
00000000000i[PLGIN] reset of 'biosdev' plugin device by virtual method
00000000000i[PLGIN] reset of 'speaker' plugin device by virtual method
00000000000i[PLGIN] reset of 'extfpuirq' plugin device by virtual method
00000000000i[PLGIN] reset of 'iodebug' plugin device by virtual method
00000000000i[PLGIN] reset of 'ioapic' plugin device by virtual method
00000000000i[PLGIN] reset of 'keyboard' plugin device by virtual method
00000000000i[PLGIN] reset of 'harddrv' plugin device by virtual method
00000000000i[PLGIN] reset of 'serial' plugin device by virtual method
00000000000i[PLGIN] reset of 'parallel' plugin device by virtual method
00000000000i[XGUI ] [x] Mouse off
00000000000i[     ] set SIGINT handler to bx_debug_ctrlc_handler
Next at t=0
(0) [0x00000000fffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b         ; ea5be000f0

Does anyone have any idea what I could be doing wrong?

I suspect following the instructions from http://sig9.com/bochs-grub had as an effect copying my host's 64-bit grub binaries onto floppy.img which is supposed to be a 32-bit emulated system.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

燕归巢 2024-10-25 04:50:58

最后一行是调试器打印当前代码行。按“c”并按 Enter 键,它应该开始运行。至于使用 32 位,它应该可以工作,因为 x86-64 处理器将像任何其他 x86 处理器一样在保护模式下运行。

That last line is the debugger printing out the current line of code. Press 'c' and hit enter, and it should start running. As for using 32 bit, it should work as x86-64 processors will run in protected mode just like any other x86 processor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文