Attention is currently required from: Martin Roth, Igor Bagnucki, Stefan Reinauer, Krystian Hebel, Timothy Pearson. Hello Igor Bagnucki, Krystian Hebel, Timothy Pearson,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/58656
to review the following change.
Change subject: payloads/external: add skiboot (for QEMU/Power9) ......................................................................
payloads/external: add skiboot (for QEMU/Power9)
Add an option to build skiboot as a payload. This makes QEMU Power9 board simpler to use as skiboot is necessary anyway.
Change-Id: I0b49ea7464c97cc2ff0d5030629deed549851372 Signed-off-by: Igor Bagnucki igor.bagnucki@3mdeb.com Signed-off-by: Krystian Hebel krystian.hebel@3mdeb.com Signed-off-by: Sergii Dmytruk sergii.dmytruk@3mdeb.com --- M Documentation/mainboard/emulation/qemu-power9.md M payloads/Makefile.inc M payloads/external/.gitignore M payloads/external/Makefile.inc A payloads/external/skiboot/Kconfig A payloads/external/skiboot/Kconfig.name A payloads/external/skiboot/Makefile M src/mainboard/emulation/qemu-power9/Kconfig 8 files changed, 105 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/56/58656/1
diff --git a/Documentation/mainboard/emulation/qemu-power9.md b/Documentation/mainboard/emulation/qemu-power9.md index d9841d8..807db47 100644 --- a/Documentation/mainboard/emulation/qemu-power9.md +++ b/Documentation/mainboard/emulation/qemu-power9.md @@ -1,7 +1,19 @@ # QEMU PPC64 emulator -This page discribes how to build and run coreboot for QEMU/PPC64. -You can configure ELF payload via `make menuconfig` (make sure "ROM chip size" -is large enough). +This page describes how to build and run coreboot for QEMU/PPC64. + +## Building coreboot +```bash +make defconfig KBUILD_DEFCONFIG=configs/config.emulation_qemu_power9 +make +``` + +This builds coreboot with no payload. + +## Payloads +You can configure ELF or `skiboot` payload via `make menuconfig`. In either case +you might need to adjust "ROM chip size" and make it large enough to accommodate +the payload (see how much space it needs in the error you get if it doesn't +fit).
## Running coreboot in QEMU ```bash @@ -14,13 +26,22 @@
- The default CPU in QEMU for AArch64 is a 604. You specify a suitable PowerPC CPU via `-cpu power9`. -- By default Hostboot mode is off and it needs to be turned on to run coreboot +- By default Hostboot mode is off and needs to be turned on to run coreboot as a firmware rather than like an OS.
-## Building coreboot +## Running with a kernel +Loading `skiboot` (built automatically by coreboot or otherwise) allows +specifying kernel and root file system to be run. + ```bash -make defconfig KBUILD_DEFCONFIG=configs/config.emulation_qemu_power9 -make +qemu-system-ppc64 -M powernv,hb-mode=on \ + -cpu power9 \ + -bios build/coreboot.rom \ + -serial stdio \ + -display none \ + -kernel zImage \ + -initrd initrd.cpio.xz ```
-This builds coreboot with no payload. +- Specify path to your kernel via `-kernel`. +- Specify path to your rootfs via `-initrd`. diff --git a/payloads/Makefile.inc b/payloads/Makefile.inc index d89b5ba..f4462c8 100644 --- a/payloads/Makefile.inc +++ b/payloads/Makefile.inc @@ -28,6 +28,7 @@ payloads/external/GRUB2 \ payloads/external/LinuxBoot \ payloads/external/Yabits \ +payloads/external/skiboot \
force-payload:
diff --git a/payloads/external/.gitignore b/payloads/external/.gitignore index ebca429..9aaa95c 100644 --- a/payloads/external/.gitignore +++ b/payloads/external/.gitignore @@ -8,3 +8,5 @@ U-Boot/u-boot/ Memtest86Plus/memtest86plus/ iPXE/ipxe/ +skiboot/skiboot +skiboot/build diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc index 113dfbe..9c45bd7 100644 --- a/payloads/external/Makefile.inc +++ b/payloads/external/Makefile.inc @@ -329,3 +329,10 @@
payloads/external/BOOTBOOT/bootboot/dist/bootbootcb.elf: $(MAKE) -C payloads/external/BOOTBOOT all + +# skiboot + +payloads/external/skiboot/build/skiboot.elf: + $(MAKE) -C payloads/external/skiboot all \ + CONFIG_SKIBOOT_GIT_REPO=$(CONFIG_SKIBOOT_GIT_REPO) \ + CONFIG_SKIBOOT_REVISION=$(CONFIG_SKIBOOT_REVISION) diff --git a/payloads/external/skiboot/Kconfig b/payloads/external/skiboot/Kconfig new file mode 100644 index 0000000..03ddc94 --- /dev/null +++ b/payloads/external/skiboot/Kconfig @@ -0,0 +1,21 @@ +## SPDX-License-Identifier: GPL-2.0-only + +if PAYLOAD_SKIBOOT + +config PAYLOAD_FILE + default "payloads/external/skiboot/build/skiboot.elf" + +config SKIBOOT_GIT_REPO + string "Git repository of skiboot payload" + default "https://gitlab.com/qemu-project/skiboot.git" if BOARD_EMULATION_QEMU_POWER9 + help + Git repository which will be used to clone skiboot. + +config SKIBOOT_REVISION + string "Revision of skiboot payload" + default "d93ddbd39b4eeac0bc11dacbdadea76df2996c13" if BOARD_EMULATION_QEMU_POWER9 + help + Revision, that skiboot repository will be checked out to, before building + an image. + +endif # PAYLOAD_SKIBOOT diff --git a/payloads/external/skiboot/Kconfig.name b/payloads/external/skiboot/Kconfig.name new file mode 100644 index 0000000..92d47e1 --- /dev/null +++ b/payloads/external/skiboot/Kconfig.name @@ -0,0 +1,8 @@ +## SPDX-License-Identifier: GPL-2.0-only + +config PAYLOAD_SKIBOOT + bool "skiboot" + depends on ARCH_PPC64 + help + Select this option if you want to build a coreboot image + with a skiboot payload. diff --git a/payloads/external/skiboot/Makefile b/payloads/external/skiboot/Makefile new file mode 100644 index 0000000..4a49e47 --- /dev/null +++ b/payloads/external/skiboot/Makefile @@ -0,0 +1,36 @@ +## SPDX-License-Identifier: GPL-2.0-only + +build_dir=$(CURDIR)/build +skiboot_dir=$(CURDIR)/skiboot +skiboot_git_repo=$(CONFIG_SKIBOOT_GIT_REPO) +skiboot_revision=$(CONFIG_SKIBOOT_REVISION) +skiboot_elf=$(build_dir)/skiboot.elf +skiboot_cross=$(or $(CROSS),powerpc64-linux-gnu-) + +unexport $(COREBOOT_EXPORTS) + +.PHONY: all clean distclean + +all: $(skiboot_elf) + +$(skiboot_elf): | $(skiboot_dir) $(build_dir) + +$(MAKE) -C $(skiboot_dir) CROSS="$(skiboot_cross)" + cp $(skiboot_dir)/skiboot.elf $@ + # skiboot is always built with debug information due to unconditional -ggdb + $(skiboot_cross)strip $@ + +$(skiboot_dir): + git clone $(skiboot_git_repo) $(skiboot_dir) + git -C $(skiboot_dir) checkout $(skiboot_revision) + +$(build_dir): + mkdir -p $(build_dir) + +distclean: + rm -rf $(skiboot_dir) $(build_dir) + +clean: + # Redefine RM because it's used like `$(RM) non-existent-file` + # Also ignore useless messages about removing test files + [ ! -d $(skiboot_dir) ] || $(MAKE) -C $(skiboot_dir) RM="rm -rf" clean > /dev/null + rm -rf $(build_dir) diff --git a/src/mainboard/emulation/qemu-power9/Kconfig b/src/mainboard/emulation/qemu-power9/Kconfig index 67ca4e0..cb45cf7 100644 --- a/src/mainboard/emulation/qemu-power9/Kconfig +++ b/src/mainboard/emulation/qemu-power9/Kconfig @@ -8,7 +8,7 @@ config BOARD_SPECIFIC_OPTIONS def_bool y select CPU_POWER9 - select BOARD_ROMSIZE_KB_512 + select BOARD_ROMSIZE_KB_1024 select ARCH_BOOTBLOCK_PPC64 select ARCH_VERSTAGE_PPC64 select ARCH_ROMSTAGE_PPC64