mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Christian Melki <christian.melki@t2data.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] rules/qemu: Add new package.
Date: Fri, 16 Jul 2021 12:27:03 +0200	[thread overview]
Message-ID: <20210716102703.28655-1-christian.melki@t2data.com> (raw)

Work-in-progress. Add target-qemu package.
Usecases are among others:
Higher isolation (security) and target emulation (software longevity).

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 rules/qemu.in   |  51 +++++++++
 rules/qemu.make | 274 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 325 insertions(+)
 create mode 100644 rules/qemu.in
 create mode 100644 rules/qemu.make

diff --git a/rules/qemu.in b/rules/qemu.in
new file mode 100644
index 000000000..d627f7a79
--- /dev/null
+++ b/rules/qemu.in
@@ -0,0 +1,51 @@
+## SECTION=emulators
+
+menuconfig QEMU
+	tristate
+	prompt "qemu                          "
+	select HOST_MESON
+	select HOST_NINJA
+	select HOST_SYSTEM_PYTHON3
+	select GLIB
+	select LIBCAP_NG
+	select ZLIB
+	select LIBUSB	if QEMU_SYS
+	select PIXMAN	if QEMU_SYS
+	help
+	  QEMU is a generic and open source machine emulator and
+	  virtualizer.  
+
+if QEMU
+
+config QEMU_TARGETS
+        string
+	prompt "QEMU targets"
+	default "i386 x86_64 arm aarch64"
+	help
+	  The list of QEMU user and system targets you want to build.
+	  Only use the prefixes.
+
+config QEMU_FDT
+       bool
+       prompt "Enable Device Tree generation."
+       default y
+       help
+         Say y to let QEMU construct FDTs and pass them
+	 to the VMs.
+
+config QEMU_TOOLS
+	bool
+	prompt "Enable tools"
+	default y
+	help
+	  Say y here to include tools.
+
+config QEMU_SYS
+	bool
+	prompt "system emulation"
+
+config QEMU_USR
+	bool
+	prompt "user-space emulation"
+
+endif
diff --git a/rules/qemu.make b/rules/qemu.make
new file mode 100644
index 000000000..0a276fbf6
--- /dev/null
+++ b/rules/qemu.make
@@ -0,0 +1,274 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2021 by Christian Melki <christian.melki@t2data.com>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_QEMU) += qemu
+
+#
+# Paths and names
+#
+QEMU_VERSION    := 6.0.0
+QEMU_MD5        := cce185dc0119546e395909e8a71a75bb
+QEMU		:= qemu-$(QEMU_VERSION)
+QEMU_SUFFIX	:= tar.xz
+QEMU_URL	:= https://download.qemu.org/$(QEMU).$(QEMU_SUFFIX)
+QEMU_SOURCE	:= $(SRCDIR)/$(QEMU).$(QEMU_SUFFIX)
+QEMU_DIR	:= $(BUILDDIR)/$(QEMU)
+QEMU_LICENSE	:= GPL-2.0-only AND GPL-2.0-or-later AND MIT AND BSD-1-Clause AND BSD-2-Clause AND BSD-3-Clause
+QEMU_BUILD_OOT	:= YES
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+ifdef PTXCONF_ARCH_X86
+QEMU_ARCH       := i386
+ifdef PTXCONF_ARCH_X86_64
+QEMU_ARCH       := x86_64
+endif
+endif
+ifdef PTXCONF_ARCH_ARM
+QEMU_ARCH       := arm
+endif
+ifdef PTXCONF_ARCH_ARM64
+QEMU_ARCH       := aarch64
+endif
+
+#
+# autoconf
+#
+
+QEMU_MAKE_OPT	:= V=$(filter 1,$(PTXDIST_VERBOSE))
+
+QEMU_SYS_TARGETS	:= $(foreach target, $(call remove_quotes,$(PTXCONF_QEMU_TARGETS)), $(patsubst %,%-softmmu,$(target)))
+QEMU_USR_TARGETS	:= $(foreach target, $(call remove_quotes,$(PTXCONF_QEMU_TARGETS)), $(patsubst %,%-linux-user,$(target)))
+
+QEMU_PATH     := PATH=$(CROSS_PATH)
+
+QEMU_CONF_TOOL	:= autoconf
+# Note: not realy autoconf:
+# e.g. there is --enable-debug but not --disable-debug
+QEMU_CONF_OPT	:= \
+	--prefix=/usr \
+	--target-list=" \
+		$(call ptx/ifdef, PTXCONF_QEMU_SYS,$(QEMU_SYS_TARGETS),) \
+		$(call ptx/ifdef, PTXCONF_QEMU_USR,$(QEMU_USR_TARGETS),) \
+	" \
+	--meson=meson \
+	--ninja=ninja \
+	--cross-prefix=$(CROSS_COMPILE) \
+	--disable-sanitizers \
+	--disable-tsan \
+	--disable-strip \
+	--disable-werror \
+	--enable-stack-protector \
+	--audio-drv-list= \
+	--block-drv-rw-whitelist= \
+	--block-drv-ro-whitelist= \
+	--enable-trace-backends=nop \
+	--disable-tcg-interpreter \
+	--enable-malloc-trim \
+	--with-coroutine= \
+	--tls-priority=NORMAL \
+	--disable-plugins \
+	--disable-containers \
+	--$(call ptx/endis, PTXCONF_QEMU_SYS)-system \
+	--disable-user \
+	--$(call ptx/endis, PTXCONF_QEMU_USR)-linux-user \
+	--disable-bsd-user \
+	--disable-docs \
+	--disable-guest-agent \
+	--disable-guest-agent-msi \
+	--enable-pie \
+	--disable-modules \
+	--disable-module-upgrades \
+	--disable-debug-tcg \
+	--disable-debug-info \
+	--disable-lto \
+	--disable-sparse \
+	--disable-safe-stack \
+	--disable-cfi \
+	--disable-gnutls \
+	--disable-nettle \
+	--disable-gcrypt \
+	--disable-auth-pam \
+	--disable-sdl \
+	--disable-sdl-image \
+	--disable-gtk \
+	--disable-vte \
+	--disable-curses \
+	--enable-iconv \
+	--disable-vnc \
+	--disable-vnc-sasl \
+	--disable-vnc-jpeg \
+	--disable-vnc-png \
+	--disable-cocoa \
+	--enable-virtfs \
+	--disable-virtiofsd \
+	--disable-libudev \
+	--disable-mpath \
+	--disable-xen \
+	--disable-xen-pci-passthrough \
+	--disable-brlapi \
+	--disable-curl \
+	--enable-membarrier \
+	--$(call ptx/endis, PTXCONF_QEMU_FDT)-fdt \
+	--enable-kvm \
+	--disable-hax \
+	--disable-hvf \
+	--disable-whpx \
+	--disable-rdma \
+	--disable-pvrdma \
+	--disable-netmap \
+	--disable-linux-aio \
+	--disable-linux-io-uring \
+	--enable-cap-ng \
+	--enable-attr \
+	--enable-vhost-net \
+	--enable-vhost-vsock \
+	--enable-vhost-scsi \
+	--disable-vhost-crypto \
+	--enable-vhost-kernel \
+	--disable-vhost-user \
+	--disable-vhost-user-blk-server \
+	--disable-vhost-vdpa \
+	--disable-spice \
+	--disable-rbd \
+	--disable-libiscsi \
+	--disable-libnfs \
+	--disable-smartcard \
+	--disable-u2f \
+	--$(call ptx/endis, PTXCONF_QEMU_SYS)-libusb \
+	--disable-live-block-migration \
+	--disable-usb-redir \
+	--disable-lzo \
+	--disable-snappy \
+	--disable-bzip2 \
+	--disable-lzfse \
+	--disable-zstd \
+	--disable-seccomp \
+	--enable-coroutine-pool \
+	--disable-glusterfs \
+	--disable-tpm \
+	--disable-libssh \
+	--disable-numa \
+	--disable-libxml2 \
+	--disable-tcmalloc \
+	--disable-jemalloc \
+	--enable-replication \
+	--disable-opengl \
+	--disable-virglrenderer \
+	--disable-xfsctl \
+	--disable-qom-cast-debug \
+	--$(call ptx/endis, PTXCONF_QEMU_TOOLS)-tools \
+	--disable-bochs \
+	--disable-cloop \
+	--disable-dmg \
+	--disable-qcow1 \
+	--disable-vdi \
+	--disable-vvfat \
+	--disable-qed \
+	--disable-parallels \
+	--disable-sheepdog \
+	--disable-crypto-afalg \
+	--disable-capstone \
+	--disable-debug-mutex \
+	--disable-libpmem \
+	--disable-xkbcommon \
+	--disable-rng-none \
+	--disable-libdaxctl \
+	--disable-fuse \
+	--enable-multiprocess \
+	--disable-gio \
+	\
+	--disable-fuzzing \
+	--disable-keyring
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/qemu.install:
+	@$(call targetinfo)
+	@$(call world/install, QEMU)
+ifdef PTXCONF_QEMU_SYS
+#	# necessary for qemu to find its ROM files
+	@ln -vsf usr/share/qemu $(QEMU_PKGDIR)/pc-bios
+endif
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/qemu.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, qemu)
+	@$(call install_fixup, qemu,PRIORITY,optional)
+	@$(call install_fixup, qemu,SECTION,base)
+	@$(call install_fixup, qemu,AUTHOR,"Christian Melki <christian.melki@t2data.com>")
+	@$(call install_fixup, qemu,DESCRIPTION,missing)
+
+	@$(call install_copy, qemu, 0, 0, 0755, -, /usr/bin/qemu-edid)
+	@$(call install_copy, qemu, 0, 0, 0755, -, /usr/bin/qemu-img)
+	@$(call install_copy, qemu, 0, 0, 0755, -, /usr/bin/qemu-io)
+	@$(call install_copy, qemu, 0, 0, 0755, -, /usr/bin/qemu-pr-helper)
+	@$(call install_copy, qemu, 0, 0, 0755, -, /usr/bin/qemu-storage-daemon)
+ifdef PTXCONF_QEMU_SYS
+	@$(foreach target, $(call remove_quotes,$(PTXCONF_QEMU_TARGETS)), \
+		@$(call install_copy, qemu, 0, 0, 0755, -, /usr/bin/qemu-system-$(target))$(ptx/nl))
+endif
+ifdef PTXCONF_QEMU_USER
+	@$(foreach target, $(call remove_quotes,$(PTXCONF_QEMU_TARGETS)), \
+		@$(call install_copy, qemu, 0, 0, 0755, -, /usr/bin/qemu-system-$(target))$(ptx/nl))
+endif
+	@$(call install_copy, qemu, 0, 0, 0755, -, /usr/libexec/qemu-bridge-helper)
+	@$(call install_copy, qemu, 0, 0, 0755, -, /usr/libexec/virtfs-proxy-helper)
+
+	@$(call install_copy, qemu, 0, 0, 0755, /usr/share/qemu)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/bios-256k.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/bios-microvm.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/bios.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/edk2-aarch64-code.fd)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/edk2-arm-code.fd)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/edk2-arm-vars.fd)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/edk2-i386-code.fd)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/edk2-i386-secure-code.fd)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/edk2-i386-vars.fd)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/edk2-x86_64-code.fd)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/edk2-x86_64-secure-code.fd)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/efi-e1000.rom)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/efi-e1000e.rom)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/efi-eepro100.rom)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/efi-virtio.rom)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/pxe-e1000.rom)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/pxe-eepro100.rom)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/pxe-virtio.rom)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/pvh.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/kvmvapic.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/vgabios-ati.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/vgabios-cirrus.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/vgabios-stdvga.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/vgabios-virtio.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/vgabios-vmware.bin)
+	@$(call install_copy, qemu, 0, 0, 0644, -, /usr/share/qemu/vgabios.bin)
+
+	@$(call install_copy, qemu, 0, 0, 0755, /usr/share/qemu/firmware)
+	@$(call install_glob, qemu, 0, 0, -, /usr/share/qemu/firmware,, *.json)
+
+	@$(call install_copy, qemu, 0, 0, 0755, /usr/share/qemu/keymaps)
+	@$(call install_copy, qemu, 0, 0, 0755, -, /usr/share/qemu/keymaps/en-us)
+
+	@$(call install_finish, qemu)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.32.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


             reply	other threads:[~2021-07-16 10:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 10:27 Christian Melki [this message]
2021-07-16 12:44 Christian Melki
2021-07-16 13:04 ` Alexander Dahl
2021-08-06  7:00 ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210716102703.28655-1-christian.melki@t2data.com \
    --to=christian.melki@t2data.com \
    --cc=ptxdist@pengutronix.de \
    --subject='Re: [ptxdist] [PATCH] rules/qemu: Add new package.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox