All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@buildroot.org
Cc: Gerome Burlats <gerome.burlats@smile.fr>,
	romain.naour@gmail.com,
	Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Subject: [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib'
Date: Sat, 15 Jan 2022 21:03:04 +0100	[thread overview]
Message-ID: <20220115200306.14037-7-patrickdepinguin@gmail.com> (raw)
In-Reply-To: <20220115200306.14037-1-patrickdepinguin@gmail.com>

From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

Add a new qemu defconfig for an x86_64 target that will run an x86_64 kernel
but userspace in 32-bit (x86) mode, using BR2_KERNEL_ARCH_OVERRIDE.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---

Note that the defconfig refers to a toolchain at
autobuild.buildroot.org, but is not yet present at that location.
I uploaded the toolchain temporarily to:
http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11.tar.xz
md5sum:b085c0d8f137c078f8f09d116d8364f8
sha256sum 2a5241d9274239532e44d37c65509931fbc120db5991412f946eb38176db4dc2



 board/qemu/x86_multilib/linux.config  | 57 +++++++++++++++++++++++++++
 board/qemu/x86_multilib/post-build.sh | 11 ++++++
 board/qemu/x86_multilib/readme.txt    |  7 ++++
 configs/qemu_x86_multilib_defconfig   | 26 ++++++++++++
 4 files changed, 101 insertions(+)
 create mode 100644 board/qemu/x86_multilib/linux.config
 create mode 100755 board/qemu/x86_multilib/post-build.sh
 create mode 100644 board/qemu/x86_multilib/readme.txt
 create mode 100644 configs/qemu_x86_multilib_defconfig

diff --git a/board/qemu/x86_multilib/linux.config b/board/qemu/x86_multilib/linux.config
new file mode 100644
index 0000000000..0ea9e53a06
--- /dev/null
+++ b/board/qemu/x86_multilib/linux.config
@@ -0,0 +1,57 @@
+CONFIG_SYSVIPC=y
+# CONFIG_USELIB is not set
+CONFIG_CGROUPS=y
+CONFIG_SMP=y
+CONFIG_HYPERVISOR_GUEST=y
+CONFIG_PARAVIRT=y
+CONFIG_IA32_EMULATION=y
+# CONFIG_COMPAT_32BIT_TIME is not set
+# CONFIG_GCC_PLUGINS is not set
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+# CONFIG_WIRELESS is not set
+CONFIG_PCI=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_VIRTIO_BLK=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_SCSI_VIRTIO=y
+CONFIG_ATA=y
+CONFIG_ATA_PIIX=y
+CONFIG_NETDEVICES=y
+CONFIG_VIRTIO_NET=y
+CONFIG_NE2K_PCI=y
+CONFIG_8139CP=y
+# CONFIG_WLAN is not set
+CONFIG_INPUT_EVDEV=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_VIRTIO_CONSOLE=y
+CONFIG_HW_RANDOM_VIRTIO=m
+CONFIG_DRM=y
+CONFIG_DRM_QXL=y
+CONFIG_DRM_VIRTIO_GPU=y
+CONFIG_DRM_BOCHS=y
+CONFIG_SOUND=y
+CONFIG_SND=y
+CONFIG_SND_HDA_INTEL=y
+CONFIG_SND_HDA_GENERIC=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_UHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_VIRTIO_PCI=y
+CONFIG_VIRTIO_BALLOON=y
+CONFIG_VIRTIO_INPUT=y
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
+CONFIG_EXT4_FS=y
+CONFIG_AUTOFS4_FS=y
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_UNWINDER_FRAME_POINTER=y
diff --git a/board/qemu/x86_multilib/post-build.sh b/board/qemu/x86_multilib/post-build.sh
new file mode 100755
index 0000000000..bf83a002c2
--- /dev/null
+++ b/board/qemu/x86_multilib/post-build.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -u
+set -e
+
+# Add a console on tty1
+if [ -e ${TARGET_DIR}/etc/inittab ]; then
+    grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
+	sed -i '/GENERIC_SERIAL/a\
+tty1::respawn:/sbin/getty -L  tty1 0 vt100 # QEMU graphical window' ${TARGET_DIR}/etc/inittab
+fi
diff --git a/board/qemu/x86_multilib/readme.txt b/board/qemu/x86_multilib/readme.txt
new file mode 100644
index 0000000000..fbc8ae9a6a
--- /dev/null
+++ b/board/qemu/x86_multilib/readme.txt
@@ -0,0 +1,7 @@
+Run the emulation with:
+
+  qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user # qemu_x86_multilib_defconfig
+
+Optionally add -smp N to emulate a SMP system with N CPUs.
+
+The login prompt will appear in the graphical window.
diff --git a/configs/qemu_x86_multilib_defconfig b/configs/qemu_x86_multilib_defconfig
new file mode 100644
index 0000000000..1c3a8179c1
--- /dev/null
+++ b/configs/qemu_x86_multilib_defconfig
@@ -0,0 +1,26 @@
+BR2_KERNEL_ARCH_OVERRIDE="x86_64"
+BR2_x86_core2=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
+BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11.tar.xz"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="x86_64-multilib-linux-gnu"
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_15=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
+# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
+BR2_TARGET_OPTIMIZATION="-m32"
+BR2_SYSTEM_DHCP="eth0"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_multilib/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_multilib/linux.config"
+BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
+BR2_TARGET_ROOTFS_EXT2=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_PACKAGE_HOST_QEMU=y
+BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
-- 
2.32.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2022-01-15 20:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-15 20:02 [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Thomas De Schampheleire
2022-01-15 20:02 ` [Buildroot] [PATCHv2 1/7] arch: move definition of KERNEL_ARCH to Config.in.<arch> files Thomas De Schampheleire
2022-02-08 20:25   ` Arnout Vandecappelle
2022-01-15 20:03 ` [Buildroot] [PATCHv2 2/7] core: introduce NORMALIZED_ARCH as non-kernel replacement for KERNEL_ARCH Thomas De Schampheleire
2022-02-08 20:26   ` Arnout Vandecappelle
2022-01-15 20:03 ` [Buildroot] [PATCHv2 3/7] core: introduce BR2_KERNEL_ARCH_OVERRIDE Thomas De Schampheleire
2022-01-15 20:03 ` [Buildroot] [PATCHv2 4/7] perf: fix compilation in case of i386 userspace with x86_64 kernel Thomas De Schampheleire
2022-01-15 20:03 ` [Buildroot] [PATCHv2 5/7] package/qemu: add support for overridden KERNEL_ARCH=x86_64 Thomas De Schampheleire
2022-01-15 20:03 ` Thomas De Schampheleire [this message]
2022-01-18 11:19   ` [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib' Thomas De Schampheleire
2022-01-18 11:51     ` Romain Naour
2022-01-18 12:02       ` Thomas De Schampheleire
2022-01-19 20:54         ` Romain Naour
2022-01-15 20:03 ` [Buildroot] [PATCHv2 7/7] linux/linux.mk: correct LINUX_ARCH_PATH for sparc64 Thomas De Schampheleire
2022-02-08 20:28   ` Arnout Vandecappelle
2022-02-08 20:49 ` [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Arnout Vandecappelle
2022-02-09 11:55   ` Thomas De Schampheleire
2022-07-30 19:43 ` Yann E. MORIN

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=20220115200306.14037-7-patrickdepinguin@gmail.com \
    --to=patrickdepinguin@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=gerome.burlats@smile.fr \
    --cc=romain.naour@gmail.com \
    --cc=thomas.de_schampheleire@nokia.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.