Got OVMF on bochs running, kinda

This commit is contained in:
Thomas Oltmann 2025-12-20 17:12:36 +01:00
parent 4068773b59
commit 43f8cfdd83
2 changed files with 46 additions and 37 deletions

77
bochsrc
View file

@ -1,37 +1,40 @@
# configuration file generated by Bochs cpu: model=corei5_lynnfield_750, count=1, reset_on_triple_fault=1
plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1, parallel=1, serial=1 #cpuid: x86_64=1, mmx=1, sep=1, simd=sse4_2, apic=xapic, aes=1, movbe=1, xsave=1
memory: host=64, guest=64 #cpuid: family=6, model=0x1a, stepping=5
romimage: file="/usr/share/OVMF/x64/MICROVM.fd", address=0x0, options=none
vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest-cirrus" memory: guest=1024, host=1024
boot: floppy
floppy_bootsig_check: disabled=0 #romimage: file=$BXSHARE/BIOS-bochs-latest, options=fastboot
# no floppya #romimage: file=DEBUGX64_OVMF.fd, address=0x0, options=none
# no floppyb #romimage: file=OVMF-pure-efi.fd, address=0x0, options=none
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 romimage: file=/usr/share/OVMF/x64/OVMF.fd, address=0x0, options=none
ata0-master: type=none
ata0-slave: type=none #vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest-cirrus.bin
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15 vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest.bin
ata1-master: type=none vga: extension=cirrus
ata1-slave: type=none
pci: enabled=1, chipset=i440fx, slot1=cirrus mouse: enabled=0
vga: extension=cirrus, update_freq=5, realtime=1
cpu: count=1, ips=4000000, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1, mwait_is_nop=0 pci: enabled=1, chipset=i440fx, slot1=cirrus
cpuid: level=6, stepping=3, model=3, family=6, vendor_string="GenuineIntel", brand_string=" Intel(R) Pentium(R) 4 CPU "
cpuid: mmx=1, apic=xapic, simd=sse2, sse4a=0, misaligned_sse=0, sep=1, movbe=0, adx=0 ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
cpuid: aes=0, sha=0, xsave=0, xsaveopt=0, x86_64=1, 1g_pages=0, pcid=0, fsgsbase=0 ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
#cpuid: smep=0, smap=0, mwait=1, vmx=1 ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
print_timestamps: enabled=0 ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
port_e9_hack: enabled=0
private_colormap: enabled=0 ata0-master: type=disk, mode=flat, path="disk.img", cylinders=1024, heads=1, spt=16
clock: sync=none, time0=local, rtc_sync=0 boot: disk
# no cmosimage
# no loader #ata0-master: type=cdrom, path=UefiShell.iso, status=inserted, model="UefiShell.iso"
log: - #boot: cdrom
logprefix: %t%e%d
debug: action=ignore panic: action=ask
info: action=report error: action=report
error: action=report info: action=report
panic: action=ask #debug: action=ignore, apic0=report, pic=report, ioapic=report
keyboard: type=mf, serial_delay=250, paste_delay=100000, user_shortcut=none debug: action=ignore, keyboard=report
mouse: type=ps2, enabled=0, toggle=ctrl+mbutton
com1: enabled=1, mode=null #com1: enabled=1, mode=socket-server, dev=localhost:1111
port_e9_hack: enabled=1
log: log.txt

View file

@ -39,6 +39,12 @@ vintel_has_support(char *err, size_t errmax)
return false; return false;
} }
/* Bochs does not enable VMX, relying on the BIOS instead.
* OVMF, the UEFI BIOS, only enables VMX if told so through a fw_cfg device,
* which is not emulated by Bochs. As a workaround, we try to enable VMX
* ourselves ... */
writemsr64(IA32_FEATURE_CONTROL, readmsr64(IA32_FEATURE_CONTROL) | 0x5);
if (!vintel_has_bios_support()) { if (!vintel_has_bios_support()) {
strlcpy(err, "VT-x support is not enabled in BIOS.", errmax); strlcpy(err, "VT-x support is not enabled in BIOS.", errmax);
return false; return false;