xref: /aosp_15_r20/external/coreboot/Documentation/mainboard/emulation/qemu-power9.md (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1# QEMU PPC64 emulator
2This page describes how to build and run coreboot for QEMU/PPC64.
3
4## Building coreboot
5```bash
6make defconfig KBUILD_DEFCONFIG=configs/config.emulation_qemu_power9
7make
8```
9
10This builds coreboot with no payload.
11
12## Payloads
13You can configure ELF or `skiboot` payload via `make menuconfig`. In either case
14you might need to adjust "ROM chip size" and make it large enough to accommodate
15the payload (see how much space it needs in the error you get if it doesn't
16fit).
17
18## Running coreboot in QEMU
19```bash
20qemu-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
29PowerPC CPU via `-cpu power9`.
30- By default Hostboot mode is off and needs to be turned on to run coreboot
31as a firmware rather than like an OS.
32- `-bios` specifies initial program (bootloader should suffice, but whole image
33works fine too).
34- `-drive` specifies image for emulated flash device.
35
36## Running with a kernel
37Loading `skiboot` (built automatically by coreboot or otherwise) allows
38specifying kernel and root file system to be run.
39
40```bash
41qemu-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`.
53