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