1# qemu q35 mainboard 2 3## Running coreboot in qemu 4Emulators like qemu don't need a firmware to do hardware init. 5The hardware starts in the configured state already. 6 7The coreboot port allows to test non mainboard specific code. 8As you can easily attach a debugger, it's a good target for 9experimental code. 10 11## coreboot x86_64 support 12coreboot historically runs in 32-bit protected mode, even though the 13processor supports x86_64 instructions (long mode). 14 15The qemu-q35 mainboard has been ported to x86_64 and will serve as 16reference platform to enable additional platforms. 17 18To enable the support set the Kconfig option ``CONFIG_USE_EXP_X86_64_SUPPORT=y``. 19 20## Installing qemu 21 22On debian you can install qemu by running: 23```bash 24$ sudo apt-get install qemu 25``` 26 27On redhat you can install qemu by running: 28```bash 29$ sudo dnf install qemu 30``` 31 32## Running coreboot 33### To run the i386 version of coreboot (default) 34Running on qemu-system-i386 will require a 32 bit operating system. 35 36```bash 37qemu-system-i386 -bios build/coreboot.rom -serial stdio -M q35 38``` 39 40### To run the experimental x86_64 version of coreboot 41Running on `qemu-system-x86_64` allows to run a 32 bit or 64 bit operating system 42and firmware. 43 44```bash 45qemu-system-x86_64 -bios build/coreboot.rom -serial stdio -M q35 46``` 47 48## Finding bugs 49To test coreboot's x86 code it's recommended to run on a x86 host and enable KVM. 50It will not only run faster, but is closer to real hardware. If you see the 51following message: 52 53 KVM internal error. Suberror: 1 54 emulation failure 55 56something went wrong. The same bug will likely cause a FAULT on real hardware, 57too. 58 59To enable KVM run: 60 61```bash 62qemu-system-x86_64 -bios build/coreboot.rom -serial stdio -M q35 -accel kvm -cpu host 63``` 64 65