From 8a6a92c3c4387a701807eb22659ef19b20d0d740 Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Sun, 9 Jan 2022 13:59:03 -0800 Subject: [PATCH] WIP: qemu: Add ppc64le targets and config files This gives us a target to build. It does not work yet. Note: This should use the power9 qemu target for coreboot once it's merged: https://review.coreboot.org/c/coreboot/+/57084 Signed-off-by: David Hendricks --- examples/qemu/Makefile | 17 ++++ .../qemu/configs/config-qemu-ppc64le.json | 80 +++++++++++++++++++ .../qemu/configs/coreboot.config-qemu-ppc64le | 2 + examples/qemu/configs/kernel-powerpc.config | 64 +++++++++++++++ 4 files changed, 163 insertions(+) create mode 100644 examples/qemu/configs/config-qemu-ppc64le.json create mode 100644 examples/qemu/configs/coreboot.config-qemu-ppc64le create mode 100644 examples/qemu/configs/kernel-powerpc.config diff --git a/examples/qemu/Makefile b/examples/qemu/Makefile index 90cb615..6f22a5a 100644 --- a/examples/qemu/Makefile +++ b/examples/qemu/Makefile @@ -20,6 +20,15 @@ GOARCH := arm64 PLATFORM := qemu-$(ARCH) QEMU_SYSTEM := qemu-system-$(ARCH) endif +ifeq ($(ARCH), ppc64le) +COREBOOT_TOOLCHAIN_ARCH=$(ARCH) +GOARCH := $(ARCH) +LINUX_ARCH := powerpc +LINUX_IMAGE_RELATIVE_PATH := arch/powerpc/boot/zImage +LINUX_GCC_TUPLE := powerpc64-linux-gnu- +PLATFORM := qemu-$(ARCH) +QEMU_SYSTEM := qemu-system-$(ARCH) +endif ifeq ($(ARCH), x86_64) COREBOOT_TOOLCHAIN_ARCH := i386 LINUX_ARCH := $(ARCH) @@ -52,6 +61,14 @@ ifeq ($(ARCH), aarch64) -M virt,secure=on,virtualization=on \ -cpu cortex-a53 endif +ifeq ($(ARCH), ppc64le) + $(QEMU_SYSTEM) $(QEMU_COMMON_OPTS) \ + -M powernv,hb-mode=on \ + -cpu power9 \ + -drive file=build/coreboot.rom,if=mtd \ + -serial stdio \ + -display none +endif ifeq ($(ARCH), x86_64) $(QEMU_SYSTEM) $(QEMU_COMMON_OPTS) \ -M q35 diff --git a/examples/qemu/configs/config-qemu-ppc64le.json b/examples/qemu/configs/config-qemu-ppc64le.json new file mode 100644 index 0000000..b514a3b --- /dev/null +++ b/examples/qemu/configs/config-qemu-ppc64le.json @@ -0,0 +1,80 @@ +{ + "initramfs": { + "untar": [ + { + "label": "go", + "url": "https://golang.org/dl/go1.16.6.linux-ppc64le.tar.gz", + "hash": "sha256:62b5e9bb9440b7166241e5b7d5f49c7372b36429c8308a8456ee46fc1397a0fe" + } + ], + "goget": [ + { + "label": "uroot", + "pkg": "https://github.com/u-root/u-root", + "branch": "master", + "hash": "ba3c4503673291183f54568dc0c0d0d7411302cd" + } + ] + }, + "kernel": { + "untar": [ + { + "label": "kernel", + "url": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/snapshot/linux-5.10.50.tar.gz", + "hash": "sha256:81338158ebc77b35e426e1c47826458dada4e8500030553ef911e6cf729817de", + "subdir": "linux-5.10.50" + } + ] + }, + "coreboot": { + "git": [ + { + "label": "coreboot", + "url": "https://review.coreboot.org/coreboot", + "branch": "master", + "hash": "37a977dde945de15464925d4501d4b85e01c3a16" + }, + { + "label": "vboot", + "url": "https://review.coreboot.org/vboot", + "dest": "3rdparty/vboot", + "branch": "master", + "hash": "48195e5878006ac2cf74cb7f02953ab06c68202d" + } + ], + "files": { + "label": "crossgcc_tarballs", + "dest": "util/crossgcc/tarballs", + "filelist": [ + { + "url": "https://ftpmirror.gnu.org/gmp/gmp-6.2.1.tar.xz", + "hash": "sha256:fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2" + }, + { + "url": "https://ftpmirror.gnu.org/mpfr/mpfr-4.1.0.tar.xz", + "hash": "sha256:0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f" + }, + { + "url": "https://ftpmirror.gnu.org/mpc/mpc-1.2.1.tar.gz", + "hash": "sha256:17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459" + }, + { + "url": "https://ftpmirror.gnu.org/binutils/binutils-2.37.tar.xz", + "hash": "sha256:820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c" + }, + { + "url": "https://ftpmirror.gnu.org/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz", + "hash": "sha256:d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b" + }, + { + "url": "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2", + "hash": "sha256:3c4b8339e5ab54b1bcb2316101f8985a5da50a3f9e504d43fa6f35668bee2fd0" + }, + { + "url": "https://acpica.org/sites/acpica/files/acpica-unix2-20210331.tar.gz", + "hash": "sha256:3dab326c262d4f3eaf380bbbbd7aa8c2eb5f2697f7821659222cf898d8be28c1" + } + ] + } + } +} diff --git a/examples/qemu/configs/coreboot.config-qemu-ppc64le b/examples/qemu/configs/coreboot.config-qemu-ppc64le new file mode 100644 index 0000000..5abb931 --- /dev/null +++ b/examples/qemu/configs/coreboot.config-qemu-ppc64le @@ -0,0 +1,2 @@ +CONFIG_VENDOR_EMULATION=y +CONFIG_BOARD_EMULATION_QEMU_POWER8=y diff --git a/examples/qemu/configs/kernel-powerpc.config b/examples/qemu/configs/kernel-powerpc.config new file mode 100644 index 0000000..573e98d --- /dev/null +++ b/examples/qemu/configs/kernel-powerpc.config @@ -0,0 +1,64 @@ +# Generic +CONFIG_KERNEL_XZ=y +CONFIG_DEFAULT_HOSTNAME="linuxboot" +CONFIG_HZ_PERIODIC=y +CONFIG_PREEMPT_NONE=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +CONFIG_INITRAMFS_COMPRESSION_LZMA=y +CONFIG_INITRAMFS_COMPRESSION=".lzma" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_EXPERT=y +CONFIG_EMBEDDED=y +CONFIG_SLOB=y + +# QEMU-related +CONFIG_VIRTIO_BLK=y +CONFIG_VIRTIO_NET=y +CONFIG_VIRTIO_PCI=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_VIRTIO=y +CONFIG_CRYPTO_DEV_VIRTIO=y + +CONFIG_BLOCK=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_SCSI_LOWLEVEL=y +CONFIG_SATA_AHCI_PLATFORM=y + +# Serial drivers +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_PNP=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_DMA=y +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_8250_EXAR=y +CONFIG_SERIAL_8250_NR_UARTS=32 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +CONFIG_SERIAL_8250_SHARE_IRQ=y +CONFIG_SERIAL_8250_DETECT_IRQ=y +CONFIG_SERIAL_8250_RSA=y +CONFIG_SERIAL_8250_LPSS=y +CONFIG_SERIAL_8250_MID=y +CONFIG_SERIAL_CORE=y +CONFIG_SERIAL_CORE_CONSOLE=y + +# IPMI +CONFIG_IPMI_HANDLER=y +CONFIG_IPMI_DMI_DECODE=y +CONFIG_IPMI_PLAT_DATA=y +CONFIG_IPMI_DEVICE_INTERFACE=y +CONFIG_IPMI_SI=y + +# TPM +CONFIG_TCG_TPM=y +CONFIG_HW_RANDOM_TPM=y +CONFIG_TCG_TIS_CORE=y +CONFIG_TCG_TIS=y +CONFIG_TCG_INFINEON=y +CONFIG_TCG_CRB=y