From ca0fe761fa01f87d5bba7c85d365651fa0d6ca12 Mon Sep 17 00:00:00 2001
From: Esben Haabendal <esben.haabendal@huawei.com>
Date: Tue, 12 Apr 2022 14:20:39 +0200
Subject: [PATCH] qemuarma7: Machine configuration for QEMU Cortex-A7 machine

This machine configuration is ABI compatible with the Cortex-A7 builds made with
OpenHarmony build system.

Signed-off-by: Esben Haabendal <esben.haabendal@huawei.com>
---
 conf/machine/qemuarma7.conf | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 conf/machine/qemuarma7.conf

diff --git a/conf/machine/qemuarma7.conf b/conf/machine/qemuarma7.conf
new file mode 100644
index 00000000..3f215e43
--- /dev/null
+++ b/conf/machine/qemuarma7.conf
@@ -0,0 +1,38 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+#@TYPE: Machine
+#@NAME: QEMU Arm Cortex-A7 machine
+#@DESCRIPTION: Machine configuration for running an ARM Cortex-A7 system on QEMU
+
+require conf/machine/include/arm/armv7a/tune-cortexa7.inc
+DEFAULTTUNE = "cortexa7-neon-vfpv4"
+require conf/machine/include/qemu.inc
+
+KERNEL_IMAGETYPE = "zImage"
+
+UBOOT_MACHINE ?= "qemu_arm_defconfig"
+
+SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;hvc0"
+SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"
+
+# For runqemu
+QB_SYSTEM_NAME = "qemu-system-arm"
+QB_MACHINE = "-machine virt,highmem=off,gic-version=2,secure=on"
+QB_CPU = "-cpu cortex-a7"
+QB_MEM = "-m 1G"
+QB_SMP = "-smp 1"
+# Standard Serial console
+QB_KERNEL_CMDLINE_APPEND = "vmalloc=256"
+# For graphics to work we need to define the VGA device as well as the necessary USB devices
+QB_GRAPHICS = "-device virtio-gpu-pci"
+QB_OPT_APPEND = "-device qemu-xhci -device usb-tablet -device usb-kbd"
+# Virtio Networking support
+QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
+QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@"
+# Virtio block device
+QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0"
+# Virtio serial console
+QB_SERIAL_OPT = "-device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
+QB_TCPSERIAL_OPT = "-device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
-- 
GitLab