| 1 | # QEMU PPC64 emulator |
| 2 | This page describes how to build and run coreboot for QEMU/PPC64. |
| 3 | |
| 4 | ## Building coreboot |
| 5 | ```bash |
| 6 | make defconfig KBUILD_DEFCONFIG=configs/config.emulation_qemu_power9 |
| 7 | make |
| 8 | ``` |
| 9 | |
| 10 | This builds coreboot with no payload. |
| 11 | |
| 12 | ## Payloads |
| 13 | You can configure ELF or `skiboot` payload via `make menuconfig`. In either case |
| 14 | you might need to adjust "ROM chip size" and make it large enough to accommodate |
| 15 | the payload (see how much space it needs in the error you get if it doesn't |
| 16 | fit). |
| 17 | |
| 18 | ## Running coreboot in QEMU |
| 19 | ```bash |
| 20 | qemu-system-ppc64 -M powernv,hb-mode=on \ |
| 21 | -cpu power9 \ |
| 22 | -bios build/coreboot.rom \ |
| 23 | -drive file=build/coreboot.rom,if=mtd \ |
| 24 | -serial stdio \ |
| 25 | -display none |
| 26 | ``` |
| 27 | |
| 28 | - The default CPU in QEMU for AArch64 is a 604. You specify a suitable |
| 29 | PowerPC CPU via `-cpu power9`. |
| 30 | - By default Hostboot mode is off and needs to be turned on to run coreboot |
| 31 | as a firmware rather than like an OS. |
| 32 | - `-bios` specifies initial program (bootloader should suffice, but whole image |
| 33 | works fine too). |
| 34 | - `-drive` specifies image for emulated flash device. |
| 35 | |
| 36 | ## Running with a kernel |
| 37 | Loading `skiboot` (built automatically by coreboot or otherwise) allows |
| 38 | specifying kernel and root file system to be run. |
| 39 | |
| 40 | ```bash |
| 41 | qemu-system-ppc64 -M powernv,hb-mode=on \ |
| 42 | -cpu power9 \ |
| 43 | -bios build/coreboot.rom \ |
| 44 | -drive file=build/coreboot.rom,if=mtd \ |
| 45 | -serial stdio \ |
| 46 | -display none \ |
| 47 | -kernel zImage \ |
| 48 | -initrd initrd.cpio.xz |
| 49 | ``` |
| 50 | |
| 51 | - Specify path to your kernel via `-kernel`. |
| 52 | - Specify path to your rootfs via `-initrd`. |