Git Product home page Git Product logo

Comments (11)

dbeckwith avatar dbeckwith commented on July 17, 2024

After doing a little more research it seems like the right approach is to try to create a bootable ISO file from the bin file, but there seem to be many ways to do that and I'm not sure what I should try. Many of them seem to involve a separate bootloader, but as I understand it bootimage appends the bootloader already?

from bootimage.

dbeckwith avatar dbeckwith commented on July 17, 2024

Some progress on the VDI approach.

After manually padding the .bin file to 4MiB and converting to VDI with this command:

$ VBoxManage convertdd target/x86_64-blog_os/debug/bootimage-blog_os.bin /tmp/blog_os.vdi --format VDI

I was able to get the VM to start up by mounting that VDI under the IDE Hard Disk. But it crashes immediately. All I see on screen is Booting (first stage)... and the VirtualBox logs show this error:

ERROR [COM]: aRC=VBOX_E_INVALID_VM_STATE (0x80bb0002) aIID={872da645-4a9b-1727-bee2-5585105b9eed} aComponent={ConsoleWrap} aText={Invalid machine state GuruMeditation when checking if the guest entered the ACPI mode)}, preserve=false aResultDetail=0

Tried searching for that error but just got a bunch of generic problems.

from bootimage.

dbeckwith avatar dbeckwith commented on July 17, 2024

Looking through the logs more I think it may be a triple fault that's the root error.

from bootimage.

phil-opp avatar phil-opp commented on July 17, 2024

Sorry for replying so late!

It sounds like we do something in the bootloader that VirtualBox doesn't like. Maybe it's our use of unreal mode, but I'm not sure about that. Unfortunately, I don't have time to help debugging this at the moment. We're currently planning a rewrite of the bootloader which might solve these issues, but it still in an early stage so it won't be ready anytime soon.

from bootimage.

dbeckwith avatar dbeckwith commented on July 17, 2024

No problem, this was mostly just an experiment for me to see if I could get my OS running in a different environment. I'll just try again later with the new bootloader.

from bootimage.

phil-opp avatar phil-opp commented on July 17, 2024

This might be fixed by rust-osdev/bootloader#123. Could someone test this?

from bootimage.

dbeckwith avatar dbeckwith commented on July 17, 2024

I tried this again, manually padding the .bin to 4MiB and converting to VDI. Got the same result (see "Booting (first stage)..." then a crash), but potentially a different error in the logs. Here's part of the logs that might be relevant:

00:00:02.949857 VMMDev: Guest Log: BIOS: Boot : bseqnr=1, bootseq=0231
00:00:02.949926 VMMDev: Guest Log: BIOS: Boot from Floppy 0 failed
00:00:02.950002 VMMDev: Guest Log: BIOS: Boot : bseqnr=2, bootseq=0023
00:00:02.950197 VMMDev: Guest Log: BIOS: CDROM boot failure code : 0003
00:00:02.950257 VMMDev: Guest Log: BIOS: Boot from CD-ROM failed
00:00:02.950333 VMMDev: Guest Log: BIOS: Boot : bseqnr=3, bootseq=0002
00:00:02.950474 VMMDev: Guest Log: BIOS: Booting from Hard Disk...
00:00:02.999931 
00:00:02.999932 Trying to execute code with memory type addr_code=00000000000d8020 addend=00007fb7d249b000 at 00000000000d8280! (iHandlerMemType=0x38 iMMIOMemType=0x30 IOTLB=0000000000000030)
00:00:02.999935 *** handlers
00:00:02.999947 Physical handlers: (PhysHandlers=16840 (0x41c8))
00:00:02.999948 From             - To (incl)         HandlerHC         UserHC            HandlerGC UserGC    Type     Description
00:00:02.999951 00000000000a0000 - 00000000000bffff  00007fb80fc60750  00007fb7d3bfeb50  00000000  ff82db50  MMIO     VGA - VGA Video Buffer
00:00:02.999963 00000000000c0000 - 00000000000c8fff  00007fb80fc7e1b0  00007fb7d3bfed30  00000000  ff82dd30  Write    VGA BIOS
00:00:02.999965 00000000000c9000 - 00000000000dffff  00007fb80fc60750  00007fb7d3c19850  00000000  ff848850  MMIO     PC Arch Reserved #0
00:00:02.999968 00000000000e0000 - 00000000000e0fff  00007fb80fc7e1b0  00007fb7d3c18f40  00000000  ff847f40  Write    ACPI RSDP
00:00:02.999970 00000000000e1000 - 00000000000e1fff  00007fb80fc7e1b0  00007fb7d3c03af0  00000000  ff832af0  Write    DMI tables
00:00:02.999972 00000000000e2000 - 00000000000effff  00007fb80fc7e1b0  00007fb7d3c043f0  00000000  ff8333f0  Write    Net Boot ROM
00:00:02.999975 00000000000f0000 - 00000000000fffff  00007fb80fc7e1b0  00007fb7d3c03be0  00000000  ff832be0  Write    PC BIOS - 0xfffff
00:00:02.999977 00000000e0000000 - 00000000e0ffffff  00007fb804d81130  00007fb80400b100  00000000  ff98b100  Write    VGA LFB
00:00:02.999979 00000000f0000000 - 00000000f0000fff  00007fb80fc60750  00007fb7d3c19cd0  00000000  ff848cd0  MMIO     PCNet
00:00:02.999982 00000000f0804000 - 00000000f0804fff  00007fb80fc60750  00007fb7d3c1a070  00000000  ff849070  MMIO     USB OHCI
00:00:02.999984 00000000fec00000 - 00000000fec00fff  00007fb80fc60750  00007fb7d3bfa360  00000000  ff829360  MMIO     I/O APIC
00:00:02.999987 00000000fee00000 - 00000000fee00fff  00007fb80fc60750  00007fb7d3bf99e0  00000000  ff8289e0  MMIO     APIC
00:00:02.999989 00000000ffff0000 - 00000000ffffffff  00007fb80fc7e1b0  00007fb7d3c03f20  00000000  ff832f20  Write    PC BIOS - 0xffffffff
00:00:02.999991 Virtual handlers:
00:00:02.999991 From             - To (excl)         HandlerHC         HandlerGC Type       Description
00:00:02.999993 Hypervisor Virtual handlers:
00:00:02.999993 From             - To (excl)         HandlerHC         HandlerGC Type       Description
00:00:02.999995 *** mmio
00:00:02.999997 MMIO ranges (pVM=00007fb83000a000)
00:00:02.999998 GC Phys Range                     pDevIns          Read             Write            Fill             pvUser           Description
00:00:03.000000 00000000000a0000-00000000000bffff 00007fb80400b000 00007fb804d80e20 00007fb804d7f630 00007fb804d80170 0000000000000000 VGA - VGA Video Buffer
00:00:03.000003                                R0 00007fb80400b000 ffffffffc011ecd0 ffffffffc011eea0 ffffffffc011e630 0000000000000000
00:00:03.000006                                RC 00000000 00000000 00000000 00000000 00000000
00:00:03.000009 00000000000c9000-00000000000dffff 00007fb7dc25a990 00007fb804da57c0 00007fb804da5630 0000000000000000 0000000000000000 PC Arch Reserved #0
00:00:03.000011                                R0 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000
00:00:03.000013                                RC 00000000 00000000 00000000 00000000 00000000
00:00:03.000015 00000000f0000000-00000000f0000fff 00007fb7d3c11cf0 00007fb804db74d0 00007fb804db8130 0000000000000000 00007fb7d3c11df0 PCNet
00:00:03.000018                                R0 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000
00:00:03.000020                                RC 00000000 00000000 00000000 00000000 00000000
00:00:03.000022 00000000f0804000-00000000f0804fff 00007fb7d3c15f30 00007fb804df17a0 00007fb804df1820 0000000000000000 0000000000000000 USB OHCI
00:00:03.000024                                R0 00007fb7d3c15f30 ffffffffc0130da0 ffffffffc0130e20 0000000000000000 0000000000000000
00:00:03.000027                                RC 00000000 00000000 00000000 00000000 00000000
00:00:03.000029 00000000fec00000-00000000fec00fff 00007fb7d3bfa0f0 00007fb804dbb8d0 00007fb804dbbf00 0000000000000000 00007fb7d3bfa1f0 I/O APIC
00:00:03.000031                                R0 00007fb7d3bfa0f0 ffffffffc01209c0 ffffffffc0120a60 0000000000000000 0000000000000000
00:00:03.000034                                RC 00000000 00000000 00000000 00000000 00000000
00:00:03.000036 00000000fee00000-00000000fee00fff 00007fb7d3c061c0 00007fb80fbf29b0 00007fb80fbf3b10 0000000000000000 0000000000000000 APIC
00:00:03.000041                                R0 00007fb7d3c061c0 ffffffffc002b480 ffffffffc002c470 0000000000000000 0000000000000000
00:00:03.000044                                RC 00000000 00000000 00000000 00000000 00000000
00:00:03.000046 *** phys
00:00:03.000048 RAM ranges (pVM=00007fb83000a000)
00:00:03.000049 GC Phys Range                     pvHC            
00:00:03.000050 0000000000000000-0000000003ffffff 0000000000000000 Base RAM
00:00:03.000052 00000000e0000000-00000000e0ffffff 00007fb7d0ec4000 VRam
00:00:03.000053 00000000f0000000-00000000f0000fff 0000000000000000 PCNet
00:00:03.000055 00000000f0400000-00000000f07fffff 00007fb7d20ce000 VMMDev
00:00:03.000057 00000000f0800000-00000000f0803fff 00007fb830002000 VMMDev Heap
00:00:03.000058 00000000f0804000-00000000f0804fff 0000000000000000 USB OHCI
00:00:03.000060 00000000fec00000-00000000fec00fff 0000000000000000 I/O APIC
00:00:03.000061 00000000fee00000-00000000fee00fff 0000000000000000 APIC
00:00:03.000063 00000000ffff0000-00000000ffffffff 0000000000000000 PC BIOS - 0xffffffff
00:00:03.000370 fatal error in recompiler cpu: Trying to execute code with memory type addr_code=00000000000d8020 addend=00007fb7d249b000 at 00000000000d8280. (iHandlerMemType=0x38 iMMIOMemType=0x30)
00:00:03.000370 
00:00:03.000384 Changing the VM state from 'RUNNING' to 'GURU_MEDITATION'
00:00:03.000389 Console: Machine state changed to 'GuruMeditation'

The rest after that seems to be lots of VM state dump info.

from bootimage.

dbeckwith avatar dbeckwith commented on July 17, 2024

Is there any evidence that this approach of padding and converting to VDI is the right path to go down? Or could that be the real source of the issues? The fact that I see the Booting (first stage)... message on-screen made me think that the bootloader is actually running so it seemed like progress, does that seem correct?

from bootimage.

rsribeiro avatar rsribeiro commented on July 17, 2024

With bootloader 0.9.6 I was able to boot on VirtualBox using both VBoxManage and qemu-img to convert the image:

qemu-img convert -f raw -O qcow2 target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.qcow2
or
qemu-img convert -f raw -O vdi target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.vdi
or
VBoxManage convertfromraw --format VDI target/x86_64-blog_os/debug/bootimage-blog_os.bin build/image.vdi

I didn't have to do any manual padding before converting the image, but I did change some of the default settings when configuring the VM. Using the unknown 64 bit OS template I disabled I/O APIC, USB, soundcard, network card and other stuff that is unused.

from bootimage.

vinc avatar vinc commented on July 17, 2024

Thanks @rsribeiro I can confirm that it also works for me, I used the second command.

from bootimage.

dbeckwith avatar dbeckwith commented on July 17, 2024

The second command works for me now as well, I realized I just hadn't updated to the latest version of bootloader. Thanks everyone!

from bootimage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.