DistroKit Mailinglist
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: distrokit@pengutronix.de
Subject: Re: [DistroKit] [PATCH v1] platform-mipsel: add basic qemu malta support
Date: Thu, 15 Jul 2021 16:47:11 +0200	[thread overview]
Message-ID: <20210715144711.p36hgbrm74spxkcn@pengutronix.de> (raw)
In-Reply-To: <20210708041628.17608-1-o.rempel@pengutronix.de>

Ooof, long patch, I'll snip it for my comments…

On Thu, Jul 08, 2021 at 06:16:28AM +0200, Oleksij Rempel wrote:
> Add MIPSEL (MIPS little-endian 32bit) platform.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  configs/platform-mipsel/barebox-malta.config  |  748 ++++
>  .../platform-mipsel/barebox-malta.config.diff |  153 +
>  configs/platform-mipsel/barebox.config        |  712 ++++
>  .../config/images/malta.config                |   28 +
>  configs/platform-mipsel/kernelconfig          | 3301 +++++++++++++++
>  configs/platform-mipsel/kernelconfig-malta    | 3723 +++++++++++++++++
>  .../platform-mipsel/kernelconfig-malta.diff   | 1677 ++++++++
>  configs/platform-mipsel/platformconfig        |  207 +
>  .../platforms/barebox-0-common.in             |   33 +
>  .../platforms/barebox-malta.in                |    8 +
>  .../platform-mipsel/platforms/blspec-malta.in |    5 +
>  .../platform-mipsel/platforms/image-kernel.in |    4 +
>  .../platform-mipsel/platforms/image-malta.in  |   10 +
>  .../platform-mipsel/platforms/kernel-malta.in |    9 +
>  configs/platform-mipsel/platforms/kernel.in   |   26 +
>  .../projectroot/loader/entries/malta.conf     |    6 +
>  configs/platform-mipsel/qemu-common           |   92 +
>  .../platform-mipsel/rules/barebox-common.make |   84 +
>  .../platform-mipsel/rules/barebox-malta.make  |  112 +
>  .../platform-mipsel/rules/blspec-malta.make   |   37 +
>  configs/platform-mipsel/rules/host-qemu.make  |  233 ++
>  .../platform-mipsel/rules/image-malta.make    |   32 +
>  .../platform-mipsel/rules/kernel-malta.make   |  115 +
>  configs/platform-mipsel/rules/kernel.make     |   82 +
>  configs/platform-mipsel/run                   |  121 +
>  configs/ptxconfig                             |    6 +-
>  doc/hardware.rst                              |   15 +
>  doc/hardware_mipsel_qemu.rst                  |   13 +
>  28 files changed, 11587 insertions(+), 5 deletions(-)
>  create mode 100644 configs/platform-mipsel/barebox-malta.config
>  create mode 100644 configs/platform-mipsel/barebox-malta.config.diff
>  create mode 100644 configs/platform-mipsel/barebox.config
>  create mode 100644 configs/platform-mipsel/config/images/malta.config
>  create mode 100644 configs/platform-mipsel/kernelconfig
>  create mode 100644 configs/platform-mipsel/kernelconfig-malta
>  create mode 100644 configs/platform-mipsel/kernelconfig-malta.diff
>  create mode 100644 configs/platform-mipsel/platformconfig
>  create mode 100644 configs/platform-mipsel/platforms/barebox-0-common.in
>  create mode 100644 configs/platform-mipsel/platforms/barebox-malta.in
>  create mode 100644 configs/platform-mipsel/platforms/blspec-malta.in
>  create mode 100644 configs/platform-mipsel/platforms/image-kernel.in
>  create mode 100644 configs/platform-mipsel/platforms/image-malta.in
>  create mode 100644 configs/platform-mipsel/platforms/kernel-malta.in
>  create mode 100644 configs/platform-mipsel/platforms/kernel.in
>  create mode 100644 configs/platform-mipsel/projectroot/loader/entries/malta.conf
>  create mode 100755 configs/platform-mipsel/qemu-common
>  create mode 100644 configs/platform-mipsel/rules/barebox-common.make
>  create mode 100644 configs/platform-mipsel/rules/barebox-malta.make
>  create mode 100644 configs/platform-mipsel/rules/blspec-malta.make
>  create mode 100644 configs/platform-mipsel/rules/host-qemu.make
>  create mode 100644 configs/platform-mipsel/rules/image-malta.make
>  create mode 100644 configs/platform-mipsel/rules/kernel-malta.make
>  create mode 100644 configs/platform-mipsel/rules/kernel.make
>  create mode 100755 configs/platform-mipsel/run
>  create mode 100644 doc/hardware_mipsel_qemu.rst
> 

[...]

> diff --git a/configs/platform-mipsel/rules/host-qemu.make b/configs/platform-mipsel/rules/host-qemu.make
> new file mode 100644
> index 0000000..a841f4c
> --- /dev/null
> +++ b/configs/platform-mipsel/rules/host-qemu.make
> @@ -0,0 +1,233 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2012 by Bernhard Walle <bernhard@bwalle.de>
> +#           (C) 2013 by Michael Olbrich <m.olbrich@pengutronix.de>
> +#           (C) 2013 by Jan Luebbe <j.luebbe@pengutronix.de>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +HOST_PACKAGES-$(PTXCONF_HOST_QEMU) += host-qemu
> +
> +#
> +# Paths and names
> +#
> +HOST_QEMU_VERSION	:= 5.2.0
> +HOST_QEMU_MD5		:= 179f86928835da857c237b42f4b2df73
> +HOST_QEMU		:= qemu-$(HOST_QEMU_VERSION)
> +HOST_QEMU_SUFFIX	:= tar.xz
> +HOST_QEMU_URL		:= https://download.qemu.org/$(HOST_QEMU).$(HOST_QEMU_SUFFIX)
> +HOST_QEMU_SOURCE	:= $(SRCDIR)/$(HOST_QEMU).$(HOST_QEMU_SUFFIX)
> +HOST_QEMU_DIR		:= $(HOST_BUILDDIR)/$(HOST_QEMU)
> +HOST_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
> +HOST_QEMU_BUILD_OOT	:= YES
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +#
> +# autoconf
> +#
> +
> +HOST_QEMU_BROKEN_ICECC	:= \
> +	$(call ptx/sh, gcc -dumpversion | awk -F . '{ if ($$1*100 + $$2 < 409) print "y" }')
> +
> +ifeq ($(HOST_QEMU_BROKEN_ICECC),y)
> +HOST_QEMU_MAKE_ENV	:= PTXDIST_ICECC=$(PTXDIST_ICERUN)
> +endif
> +HOST_QEMU_MAKE_OPT	:= V=$(filter 1,$(PTXDIST_VERBOSE))
> +
> +HOST_QEMU_TARGETS	:= $(PTXCONF_ARCH_STRING)
> +ifndef PTXCONF_ARCH_X86_64
> +ifdef PTXCONF_ARCH_X86
> +HOST_QEMU_TARGETS	:= i386
> +endif
> +endif
> +ifdef PTXCONF_ARCH_ARM64
> +HOST_QEMU_TARGETS	:= aarch64
> +endif
> +ifdef PTXCONF_ARCH_MIPS
> +ifdef PTXCONF_ENDIAN_LITTLE
> +HOST_QEMU_TARGETS	:= mipsel
> +endif
> +endif
> +HOST_QEMU_SYS_TARGETS	:= $(patsubst %,%-softmmu,$(HOST_QEMU_TARGETS))
> +HOST_QEMU_USR_TARGETS	:= $(patsubst %,%-linux-user,$(HOST_QEMU_TARGETS))
> +
> +HOST_QEMU_CONF_TOOL	:= autoconf
> +# Note: not realy autoconf:
> +# e.g. there is --enable-debug but not --disable-debug
> +HOST_QEMU_CONF_OPT	:= \
> +	--prefix=/. \
> +	--target-list=" \
> +		$(call ptx/ifdef, PTXCONF_HOST_QEMU_SYS,$(HOST_QEMU_SYS_TARGETS),) \
> +		$(call ptx/ifdef, PTXCONF_HOST_QEMU_USR,$(HOST_QEMU_USR_TARGETS),) \
> +	" \
> +	--meson=meson \
> +	--ninja=ninja \
> +	--disable-sanitizers \
> +	--disable-tsan \
> +	--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_HOST_QEMU_SYS)-system \
> +	--disable-user \
> +	--$(call ptx/endis, PTXCONF_HOST_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-sparse \
> +	--disable-safe-stack \
> +	--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 \
> +	--enable-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_HOST_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 \
> +	--disable-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-fuzzing \
> +	--disable-keyring
> +
> +# Use '=' to delay $(shell ...) calls until this is needed
> +QEMU_CROSS_QEMU = $(call ptx/get-alternative, config/qemu, qemu-cross)
> +QEMU_CROSS_DL = $(shell ptxd_cross_cc_v | sed -n -e 's/.* -dynamic-linker \([^ ]*\).*/\1/p')
> +QEMU_CROSS_TOOLEXECLIBDIR = $(shell dirname $$(realpath $$(ptxd_cross_cc -print-file-name=libatomic.so 2> /dev/null)))
> +QEMU_CROSS_LD_LIBRARY_PATH = $(PTXDIST_SYSROOT_TOOLCHAIN)/lib:$(QEMU_CROSS_TOOLEXECLIBDIR):$(SYSROOT)/$(CROSS_LIB_DIR):$(SYSROOT)/usr/$(CROSS_LIB_DIR)
> +
> +QEMU_CROSS_QEMU_ENV = \
> +	QEMU="$(PTXDIST_SYSROOT_HOST)/bin/qemu-$(HOST_QEMU_TARGETS)" \
> +	KERNEL_VERSION="$(KERNEL_VERSION)" \
> +	QEMU_LD_PREFIX="$(PTXDIST_SYSROOT_TOOLCHAIN)" \
> +	QEMU_LD_LIBRARY_PATH="$(QEMU_CROSS_LD_LIBRARY_PATH)" \
> +	LINKER="$(shell readlink -f "$$(ptxd_cross_cc -print-file-name=$$(ptxd_get_dl))")"
> +
> +$(STATEDIR)/host-qemu.install:
> +	@$(call targetinfo)
> +	@$(call world/install, HOST_QEMU)
> +ifdef PTXCONF_HOST_QEMU_SYS
> +#	# necessary for qemu to find its ROM files
> +	@ln -vsf share/qemu $(HOST_QEMU_PKGDIR)/pc-bios
> +endif
> +	@$(call touch)
> +
> +$(STATEDIR)/host-qemu.install.post:
> +	@$(call targetinfo)
> +	@$(call world/install.post, HOST_QEMU)
> +ifdef PTXCONF_HOST_QEMU_USR
> +	@$(QEMU_CROSS_QEMU_ENV) ptxd_replace_magic $(QEMU_CROSS_QEMU) > $(PTXDIST_SYSROOT_CROSS)/bin/qemu-cross
> +	@chmod +x $(PTXDIST_SYSROOT_CROSS)/bin/qemu-cross
> +	@install -d -m 755 $(PTXDIST_SYSROOT_CROSS)/bin/qemu/
> +	@sed \
> +		-e 's|RTLDLIST=.*|RTLDLIST="$(PTXDIST_SYSROOT_TOOLCHAIN)$(QEMU_CROSS_DL)"|' \
> +		-e 's|eval $$add_env|eval $(PTXDIST_SYSROOT_CROSS)/bin/qemu-cross -E "$${add_env// /,}"|' \
> +		-e 's|verify_out=`|verify_out=`$(PTXDIST_SYSROOT_CROSS)/bin/qemu-cross |' \
> +		-e 's|#! */.*$$|#!$(shell readlink $(PTXDIST_TOPDIR)/bin/bash)|' \
> +		$(PTXDIST_SYSROOT_TOOLCHAIN)/usr/bin/ldd > $(PTXDIST_SYSROOT_CROSS)/bin/qemu/ldd
> +	@chmod +x $(PTXDIST_SYSROOT_CROSS)/bin/qemu/ldd
> +endif
> +	@$(call touch)
> +
> +# vim: syntax=make

PTXdist upstream meanwhile has host-qemu 6.0.0, but you probably forked
it for this hunk of the diff:?

--- /ptx/work/WORK_BEEMI/rhi/ptxdist/rules/host-qemu.make       2021-07-08 22:18:54.757818032 +0200
+++ configs/platform-mipsel/rules/host-qemu.make        2021-07-14 11:16:02.145438261 +0200
@@ -51,11 +51,6 @@
 ifdef PTXCONF_ARCH_ARM64
 HOST_QEMU_TARGETS      := aarch64
 endif
+ifdef PTXCONF_ARCH_MIPS
+ifdef PTXCONF_ENDIAN_LITTLE
+HOST_QEMU_TARGETS      := mipsel
+endif
+endif
 HOST_QEMU_SYS_TARGETS  := $(patsubst %,%-softmmu,$(HOST_QEMU_TARGETS))
 HOST_QEMU_USR_TARGETS  := $(patsubst %,%-linux-user,$(HOST_QEMU_TARGETS))
 

…and I cannot find a patch with that hunk on the PTXdist mailing list,
so please send it upstream too so that we don't have to keep that rule
in the BSP forever :-)

[...]

> diff --git a/configs/ptxconfig b/configs/ptxconfig
> index c97e321..3312b85 100644
> --- a/configs/ptxconfig
> +++ b/configs/ptxconfig
> @@ -156,11 +156,8 @@ PTXCONF_CROSS_PKG_CONFIG_WRAPPER=y
>  #
>  # gdb                           
>  #
> -PTXCONF_GDB_TOOLCHAIN_VERSION=y
> -PTXCONF_GDB_MD5=""
>  # PTXCONF_GDB is not set
> -PTXCONF_GDBSERVER=y
> -PTXCONF_GDBSERVER_SHARED=y
> +# PTXCONF_GDBSERVER is not set

Is there any reason why you disabled GDBSERVER? It's a nice tool to have
for debugging.

 - Roland

>  # end of gdb                           
>  
>  # PTXCONF_LATRACE is not set
> @@ -344,7 +341,6 @@ PTXCONF_GLIBC_LDCONFIG_RC_ONCE=y
>  
>  PTXCONF_LIBC_C=y
>  PTXCONF_LIBC_PTHREAD=y
> -PTXCONF_LIBC_THREAD_DB=y
>  PTXCONF_LIBC_RT=y
>  PTXCONF_LIBC_DL=y
>  PTXCONF_LIBC_CRYPT=y
> diff --git a/doc/hardware.rst b/doc/hardware.rst
> index a478f5f..f13f076 100644
> --- a/doc/hardware.rst
> +++ b/doc/hardware.rst
> @@ -154,6 +154,21 @@ mips Platform
>     hardware_mips_qemu
>  
>  
> +mips Platform
> +-------------
> +
> ++-------------------------+------------------------------------------+
> +| platformconfig:         | ``configs/platform-mipsel/platformconfig`` |
> ++-------------------------+------------------------------------------+
> +| Toolchain architecture: | ``mipsel-softfloat-linux-gnu``             |
> ++-------------------------+------------------------------------------+
> +
> +.. toctree::
> +   :maxdepth: 1
> +
> +   hardware_mipsel_qemu
> +
> +
>  x86_64 Platform
>  ---------------
>  
> diff --git a/doc/hardware_mipsel_qemu.rst b/doc/hardware_mipsel_qemu.rst
> new file mode 100644
> index 0000000..0533204
> --- /dev/null
> +++ b/doc/hardware_mipsel_qemu.rst
> @@ -0,0 +1,13 @@
> +QEmu
> +====
> +
> +The mipsel platform is ready to run in qemu, using the MIPS Malta board
> +simulation.
> +There are two ways to run DistoKit inside qemu:
> +
> +* With barebox:
> +  Run ``./configs/platform-mipsel/run barebox`` to barebox. The barebox should
> +  boot the kernel if supported.
> +* Without barebox:
> +  Run ``./configs/platform-mipsel/run`` to directly start the kernel without
> +  barebox.
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> DistroKit mailing list
> DistroKit@pengutronix.de
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |

_______________________________________________
DistroKit mailing list
DistroKit@pengutronix.de

  parent reply	other threads:[~2021-07-15 14:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08  4:16 Oleksij Rempel
2021-07-08  6:21 ` Ahmad Fatoum
2021-07-15 14:47 ` Roland Hieber [this message]
2021-07-15 14:48   ` Roland Hieber
2021-07-15 15:13   ` Oleksij Rempel
2021-07-15 21:38     ` [DistroKit] [PATCH] re-enable gdbserver Roland Hieber
2021-07-16  5:29       ` Robert Schwebel
2021-07-16  7:03         ` Oleksij Rempel
2021-07-16  8:38           ` Roland Hieber

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=20210715144711.p36hgbrm74spxkcn@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=distrokit@pengutronix.de \
    --cc=o.rempel@pengutronix.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox