All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v11 0/5] package: add petitboot to use with qemu-system-m68k
@ 2023-04-21 18:49 Laurent Vivier
  2023-04-21 18:49 ` [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc Laurent Vivier
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Laurent Vivier @ 2023-04-21 18:49 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Huth, Laurent Vivier, Cédric Le Goater,
	Thomas Petazzoni, Romain Naour

qemu-system-m68k has introduced in v6.0 a new pure virtual machine
that is now supported by linux v5.19.

The goal of this series is to provide petitboot as an embedded bootloader
for it (like it is for the IBM POWER machine).

You can test it with:

  qemu-system-m68k -M virt -kernel images/vmlinux \
                   -initrd images/rootfs.cpio.xz \
                   -append "console=ttyGF0" --nographic

Signed-off-by: Laurent Vivier <laurent@vivier.eu>

v11:
 - rebase on top of petitboot merged package
 - add pb-discover daemon
 - start petitboot on all tty, disable generic getty
 - fix kexec build on m68k with uclibc
 - use poweroff in the test script (as we have init now)
 - remove Thomas' Rb, as there were some changes
 - CI: https://gitlab.com/laurent_vivier/buildroot/-/pipelines/844917368

v10:
  - set PETITBOOT_LICENSE to GPL-2.0

v9:
  - remove dependency on BR2_PACKAGE_PS3_UTILS
  - Add Thomas' Rb
  - rebase

v8:
  - use linux.fragment rather than linux.config
  - rebase

v7:
  - set BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_19=y
  - fix errors reported by check-package
  - add gitlab testing (Cédric)
  - update boot-qemu-image.py to support petitboot

v6:
  - rebase

v5:
  - remove BR2_CCACHE_DIR, BR2_PACKAGE_DTC and BR2_PACKAGE_DTC_PROGRAMS

v4:
  - address Thomas' comments
  - remove petitboot-mtd config as libflash is not available

v3: v2: v1:
  - first version, I messed up with list subscription and git-publish...

Laurent Vivier (5):
  kexec: fix sys/random.h with uclibc
  petitboot: add pb-discover daemon
  petitboot: start petitboot on all tty
  board/qemu/m68k-virt: Add virt-m68k linux config
  support/scripts/boot-qemu-image.py: manage petitboot interface

 DEVELOPERS                                    |  2 +
 board/qemu/m68k-virt/linux.fragment           | 21 ++++++++
 board/qemu/m68k-virt/readme.txt               |  5 ++
 configs/qemu_m68k_virt_petitboot_defconfig    | 29 ++++++++++
 ...1-m68k-fix-getrandom-use-with-uclibc.patch | 35 ++++++++++++
 package/petitboot/S15pb-discover              | 53 +++++++++++++++++++
 package/petitboot/petitboot-console-ui.rules  |  5 ++
 package/petitboot/petitboot.mk                |  8 +++
 package/petitboot/sysctl.conf                 |  1 +
 support/scripts/boot-qemu-image.py            |  8 ++-
 system/Config.in                              |  2 +-
 11 files changed, 166 insertions(+), 3 deletions(-)
 create mode 100644 board/qemu/m68k-virt/linux.fragment
 create mode 100644 board/qemu/m68k-virt/readme.txt
 create mode 100644 configs/qemu_m68k_virt_petitboot_defconfig
 create mode 100644 package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
 create mode 100644 package/petitboot/S15pb-discover
 create mode 100644 package/petitboot/petitboot-console-ui.rules
 create mode 100644 package/petitboot/sysctl.conf

-- 
2.40.0

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc
  2023-04-21 18:49 [Buildroot] [PATCH v11 0/5] package: add petitboot to use with qemu-system-m68k Laurent Vivier
@ 2023-04-21 18:49 ` Laurent Vivier
  2023-04-23 10:29   ` Laurent Vivier
  2023-06-03 20:49   ` Arnout Vandecappelle via buildroot
  2023-04-21 18:50 ` [Buildroot] [PATCH v11 2/5] petitboot: add pb-discover daemon Laurent Vivier
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 8+ messages in thread
From: Laurent Vivier @ 2023-04-21 18:49 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Huth, Laurent Vivier, Cédric Le Goater,
	Thomas Petazzoni, Romain Naour

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 ...1-m68k-fix-getrandom-use-with-uclibc.patch | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch

diff --git a/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch b/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
new file mode 100644
index 000000000000..d2fc3bc88641
--- /dev/null
+++ b/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
@@ -0,0 +1,35 @@
+From 491439a5c55b18dce96b522f3a603faaf1908ede Mon Sep 17 00:00:00 2001
+From: Laurent Vivier <laurent@vivier.eu>
+Date: Fri, 21 Apr 2023 18:22:07 +0200
+Subject: [PATCH] m68k: fix getrandom() use with uclibc
+
+With uclibc, getrandom() is only defined with _GNU_SOURCE, fix that:
+
+kexec/arch/m68k/bootinfo.c: In function 'bootinfo_add_rng_seed':
+kexec/arch/m68k/bootinfo.c:231:13: warning: implicit declaration of function 'getrandom'; did you mean 'srandom'? [-Wimplicit-function-declaration]
+  231 |         if (getrandom(bi->rng_seed.data, RNG_SEED_LEN, GRND_NONBLOCK) != RNG_SEED_LEN) {
+      |             ^~~~~~~~~
+      |             srandom
+kexec/arch/m68k/bootinfo.c:231:56: error: 'GRND_NONBLOCK' undeclared (first use in this function)
+  231 |         if (getrandom(bi->rng_seed.data, RNG_SEED_LEN, GRND_NONBLOCK) != RNG_SEED_LEN) {
+      |                                                        ^~~~~~~~~~~~~
+
+Fixes:  b9de05184816 ("m68k: pass rng seed via BI_RNG_SEED")
+Cc: Jason@zx2c4.com
+Signed-off-by: Laurent Vivier <laurent@vivier.eu>
+---
+ kexec/arch/m68k/bootinfo.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/kexec/arch/m68k/bootinfo.c b/kexec/arch/m68k/bootinfo.c
+index 086a34bdfdeb..5afd212d9d34 100644
+--- a/kexec/arch/m68k/bootinfo.c
++++ b/kexec/arch/m68k/bootinfo.c
+@@ -1,3 +1,4 @@
++#define _GNU_SOURCE
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+-- 
+2.40.0
+
-- 
2.40.0

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v11 2/5] petitboot: add pb-discover daemon
  2023-04-21 18:49 [Buildroot] [PATCH v11 0/5] package: add petitboot to use with qemu-system-m68k Laurent Vivier
  2023-04-21 18:49 ` [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc Laurent Vivier
@ 2023-04-21 18:50 ` Laurent Vivier
  2023-04-21 18:50 ` [Buildroot] [PATCH v11 3/5] petitboot: start petitboot on all tty Laurent Vivier
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2023-04-21 18:50 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Huth, Laurent Vivier, Cédric Le Goater,
	Thomas Petazzoni, Romain Naour

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 package/petitboot/S15pb-discover | 53 ++++++++++++++++++++++++++++++++
 package/petitboot/petitboot.mk   |  4 +++
 2 files changed, 57 insertions(+)
 create mode 100644 package/petitboot/S15pb-discover

diff --git a/package/petitboot/S15pb-discover b/package/petitboot/S15pb-discover
new file mode 100644
index 000000000000..56a22f6bdc83
--- /dev/null
+++ b/package/petitboot/S15pb-discover
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+DAEMON="pb-discover"
+PIDFILE="/var/run/$DAEMON.pid"
+LOGFILE="/var/log/$DAEMON.log"
+
+PB_DISCOVER_ARGS="-l $LOGFILE"
+
+if [ "$pb-config debug)" = "enabled" ] ; then
+	PB_DISCOVER_ARGS="$PB_DISCOVER_ARGS --verbose"
+fi
+
+start() {
+	printf 'Starting %s: ' "$DAEMON"
+	start-stop-daemon -S -q -b -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
+		-- $PB_DISCOVER_ARGS
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+stop() {
+	printf 'Stopping %s: ' "$DAEMON"
+	start-stop-daemon -K -q -p "$PIDFILE"
+	status=$?
+	if [ "$status" -eq 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+restart() {
+	stop
+	sleep 1
+	start
+}
+
+case "$1" in
+	start|stop|restart)
+		"$1";;
+	reload)
+		restart;;
+	*)
+		echo "Usage: $0 {start|stop|restart|reload}"
+		exit 1
+		;;
+esac
diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
index a798e7ca614f..4d56b73938e7 100644
--- a/package/petitboot/petitboot.mk
+++ b/package/petitboot/petitboot.mk
@@ -53,6 +53,10 @@ define PETITBOOT_POST_INSTALL
 		$(TARGET_DIR)/etc/petitboot/boot.d/01-create-default-dtb
 	$(INSTALL) -D -m 0755 $(@D)/utils/hooks/90-sort-dtb \
 		$(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
+	$(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
+		$(TARGET_DIR)/etc/init.d/S15pb-discover
+	ln -sf /usr/sbin/pb-udhcpc \
+		$(TARGET_DIR)/usr/share/udhcpc/default.script.d/
 endef
 
 PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL
-- 
2.40.0

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v11 3/5] petitboot: start petitboot on all tty
  2023-04-21 18:49 [Buildroot] [PATCH v11 0/5] package: add petitboot to use with qemu-system-m68k Laurent Vivier
  2023-04-21 18:49 ` [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc Laurent Vivier
  2023-04-21 18:50 ` [Buildroot] [PATCH v11 2/5] petitboot: add pb-discover daemon Laurent Vivier
@ 2023-04-21 18:50 ` Laurent Vivier
  2023-04-21 18:50 ` [Buildroot] [PATCH v11 4/5] board/qemu/m68k-virt: Add virt-m68k linux config Laurent Vivier
  2023-04-21 18:50 ` [Buildroot] [PATCH v11 5/5] support/scripts/boot-qemu-image.py: manage petitboot interface Laurent Vivier
  4 siblings, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2023-04-21 18:50 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Huth, Laurent Vivier, Cédric Le Goater,
	Thomas Petazzoni, Romain Naour

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 package/petitboot/petitboot-console-ui.rules | 5 +++++
 package/petitboot/petitboot.mk               | 4 ++++
 package/petitboot/sysctl.conf                | 1 +
 system/Config.in                             | 2 +-
 4 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 package/petitboot/petitboot-console-ui.rules
 create mode 100644 package/petitboot/sysctl.conf

diff --git a/package/petitboot/petitboot-console-ui.rules b/package/petitboot/petitboot-console-ui.rules
new file mode 100644
index 000000000000..ceeada256f2b
--- /dev/null
+++ b/package/petitboot/petitboot-console-ui.rules
@@ -0,0 +1,5 @@
+# spawn a petitboot UI on common user-visible interface devices
+SUBSYSTEM=="tty", KERNEL=="ttyGF*", RUN+="/usr/libexec/petitboot/pb-console --getty=/sbin/getty --detach -- -n -i $name 0 linux"
+SUBSYSTEM=="tty", KERNEL=="hvc*", RUN+="/usr/libexec/petitboot/pb-console --getty=/sbin/getty --detach -- -n -i $name 0 linux"
+SUBSYSTEM=="tty", KERNEL=="tty0", RUN+="/usr/libexec/petitboot/pb-console --getty=/sbin/getty --detach -- -n -i $name 0 linux"
+SUBSYSTEM=="tty", KERNEL=="ttyS*", RUN+="/usr/libexec/petitboot/pb-console --getty=/sbin/getty --detach -- -n -i $name 0 linux"
diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk
index 4d56b73938e7..e74a5ff623ea 100644
--- a/package/petitboot/petitboot.mk
+++ b/package/petitboot/petitboot.mk
@@ -55,6 +55,10 @@ define PETITBOOT_POST_INSTALL
 		$(TARGET_DIR)/etc/petitboot/boot.d/90-sort-dtb
 	$(INSTALL) -m 0755 -D $(PETITBOOT_PKGDIR)/S15pb-discover \
 		$(TARGET_DIR)/etc/init.d/S15pb-discover
+	$(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/petitboot-console-ui.rules \
+		$(TARGET_DIR)/etc/udev/rules.d/petitboot-console-ui.rules
+	$(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/sysctl.conf \
+		$(TARGET_DIR)/etc/sysctl.conf
 	ln -sf /usr/sbin/pb-udhcpc \
 		$(TARGET_DIR)/usr/share/udhcpc/default.script.d/
 endef
diff --git a/package/petitboot/sysctl.conf b/package/petitboot/sysctl.conf
new file mode 100644
index 000000000000..02ab8e3275b5
--- /dev/null
+++ b/package/petitboot/sysctl.conf
@@ -0,0 +1 @@
+kernel.printk = 1 1 1 1
diff --git a/system/Config.in b/system/Config.in
index 1ca7690ea3ba..786ec9a1c6b3 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -375,7 +375,7 @@ config BR2_SYSTEM_BIN_SH
 
 menuconfig BR2_TARGET_GENERIC_GETTY
 	bool "Run a getty (login prompt) after boot"
-	default y
+	default y         if !BR2_PACKAGE_PETITBOOT
 
 if BR2_TARGET_GENERIC_GETTY
 config BR2_TARGET_GENERIC_GETTY_PORT
-- 
2.40.0

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v11 4/5] board/qemu/m68k-virt: Add virt-m68k linux config
  2023-04-21 18:49 [Buildroot] [PATCH v11 0/5] package: add petitboot to use with qemu-system-m68k Laurent Vivier
                   ` (2 preceding siblings ...)
  2023-04-21 18:50 ` [Buildroot] [PATCH v11 3/5] petitboot: start petitboot on all tty Laurent Vivier
@ 2023-04-21 18:50 ` Laurent Vivier
  2023-04-21 18:50 ` [Buildroot] [PATCH v11 5/5] support/scripts/boot-qemu-image.py: manage petitboot interface Laurent Vivier
  4 siblings, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2023-04-21 18:50 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Huth, Laurent Vivier, Cédric Le Goater,
	Thomas Petazzoni, Romain Naour

Build a 5.19 (first version with the m68k virt machine) kernel
for "qemu-system-m68k -M virt" machine.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 DEVELOPERS                                 |  2 ++
 board/qemu/m68k-virt/linux.fragment        | 21 +++++++++++++++++++
 board/qemu/m68k-virt/readme.txt            |  5 +++++
 configs/qemu_m68k_virt_petitboot_defconfig | 24 ++++++++++++++++++++++
 4 files changed, 52 insertions(+)
 create mode 100644 board/qemu/m68k-virt/linux.fragment
 create mode 100644 board/qemu/m68k-virt/readme.txt
 create mode 100644 configs/qemu_m68k_virt_petitboot_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index 5cd882b5791c..2a07c464694f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1818,6 +1818,8 @@ F:	package/open-lldp/
 
 N:	Laurent Vivier <laurent@vivier.eu>
 F:	package/petitboot/
+F:	board/qemu/m68k-virt/
+F:	configs/qemu_m68k_virt_petitboot_defconfig
 
 N:	Lee Jones <lee.jones@linaro.org>
 F:	boot/afboot-stm32/
diff --git a/board/qemu/m68k-virt/linux.fragment b/board/qemu/m68k-virt/linux.fragment
new file mode 100644
index 000000000000..49416982601c
--- /dev/null
+++ b/board/qemu/m68k-virt/linux.fragment
@@ -0,0 +1,21 @@
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_KEXEC=y
+CONFIG_BOOTINFO_PROC=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_MD=y
+CONFIG_MD_LINEAR=y
+CONFIG_MD_MULTIPATH=y
+CONFIG_MD_FAULTY=y
+CONFIG_BLK_DEV_DM=y
+CONFIG_DM_UNSTRIPED=y
+CONFIG_DM_CRYPT=y
+CONFIG_DM_SNAPSHOT=y
+CONFIG_DM_THIN_PROVISIONING=y
+CONFIG_DM_CACHE=y
+CONFIG_DM_WRITECACHE=y
+CONFIG_DM_EBS=y
+CONFIG_DM_ERA=y
+CONFIG_DM_CLONE=y
+CONFIG_DM_MIRROR=y
+CONFIG_DM_RAID=y
+CONFIG_DM_ZERO=y
diff --git a/board/qemu/m68k-virt/readme.txt b/board/qemu/m68k-virt/readme.txt
new file mode 100644
index 000000000000..714b74c70ea1
--- /dev/null
+++ b/board/qemu/m68k-virt/readme.txt
@@ -0,0 +1,5 @@
+Run the emulation with:
+
+ qemu-system-m68k -M virt -kernel output/images/vmlinux -initrd output/images/rootfs.cpio.xz -append "console=ttyGF0" --nographic # qemu_m68k_virt_petitboot_defconfig
+
+The petiboot menu will appear in the terminal where QEMU has been started.
diff --git a/configs/qemu_m68k_virt_petitboot_defconfig b/configs/qemu_m68k_virt_petitboot_defconfig
new file mode 100644
index 000000000000..a109553187b4
--- /dev/null
+++ b/configs/qemu_m68k_virt_petitboot_defconfig
@@ -0,0 +1,24 @@
+BR2_m68k=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_19=y
+BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
+BR2_CCACHE=y
+BR2_RELRO_NONE=y
+BR2_TARGET_GENERIC_ISSUE="Welcome to Petitboot"
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
+BR2_ROOTFS_MERGED_USR=y
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.19"
+BR2_LINUX_KERNEL_DEFCONFIG="virt"
+BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/qemu/m68k-virt/linux.fragment"
+BR2_LINUX_KERNEL_XZ=y
+BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+BR2_PACKAGE_KEXEC=y
+BR2_PACKAGE_KEXEC_ZLIB=y
+BR2_PACKAGE_ETHTOOL=y
+BR2_PACKAGE_NET_TOOLS=y
+BR2_PACKAGE_NETCAT=y
+BR2_PACKAGE_RSYNC=y
+BR2_PACKAGE_PETITBOOT=y
+BR2_TARGET_ROOTFS_CPIO=y
+BR2_TARGET_ROOTFS_CPIO_XZ=y
-- 
2.40.0

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v11 5/5] support/scripts/boot-qemu-image.py: manage petitboot interface
  2023-04-21 18:49 [Buildroot] [PATCH v11 0/5] package: add petitboot to use with qemu-system-m68k Laurent Vivier
                   ` (3 preceding siblings ...)
  2023-04-21 18:50 ` [Buildroot] [PATCH v11 4/5] board/qemu/m68k-virt: Add virt-m68k linux config Laurent Vivier
@ 2023-04-21 18:50 ` Laurent Vivier
  4 siblings, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2023-04-21 18:50 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Huth, Laurent Vivier, Cédric Le Goater,
	Thomas Petazzoni, Romain Naour

Petitboot doesn't start a shell but a GUI.
Manage the menu to switch to the shell.

Enable the test for qemu_m68K_virt.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 configs/qemu_m68k_virt_petitboot_defconfig | 5 +++++
 support/scripts/boot-qemu-image.py         | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/configs/qemu_m68k_virt_petitboot_defconfig b/configs/qemu_m68k_virt_petitboot_defconfig
index a109553187b4..454c8e353f2a 100644
--- a/configs/qemu_m68k_virt_petitboot_defconfig
+++ b/configs/qemu_m68k_virt_petitboot_defconfig
@@ -6,6 +6,8 @@ BR2_RELRO_NONE=y
 BR2_TARGET_GENERIC_ISSUE="Welcome to Petitboot"
 BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
 BR2_ROOTFS_MERGED_USR=y
+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.19"
@@ -22,3 +24,6 @@ BR2_PACKAGE_RSYNC=y
 BR2_PACKAGE_PETITBOOT=y
 BR2_TARGET_ROOTFS_CPIO=y
 BR2_TARGET_ROOTFS_CPIO_XZ=y
+# host-qemu for gitlab testing
+BR2_PACKAGE_HOST_QEMU=y
+BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
diff --git a/support/scripts/boot-qemu-image.py b/support/scripts/boot-qemu-image.py
index ba50ea69ee9a..c94b7a5c969d 100755
--- a/support/scripts/boot-qemu-image.py
+++ b/support/scripts/boot-qemu-image.py
@@ -36,7 +36,7 @@ def main():
     time.sleep(1)
 
     try:
-        child.expect(["buildroot login:"], timeout=600)
+        idx = child.expect(["buildroot login:", "Exit to shell"], timeout=600)
     except pexpect.EOF as e:
         # Some emulations require a fork of qemu-system, which may be
         # missing on the system, and is not provided by Buildroot.
@@ -55,7 +55,11 @@ def main():
         print("System did not boot in time, exiting.")
         sys.exit(1)
 
-    child.sendline("root\r")
+    if idx == 0:
+        child.sendline("root\r")
+    elif idx == 1:
+        time.sleep(1)
+        child.sendline("\r")
 
     try:
         child.expect(["# "], timeout=600)
-- 
2.40.0

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc
  2023-04-21 18:49 ` [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc Laurent Vivier
@ 2023-04-23 10:29   ` Laurent Vivier
  2023-06-03 20:49   ` Arnout Vandecappelle via buildroot
  1 sibling, 0 replies; 8+ messages in thread
From: Laurent Vivier @ 2023-04-23 10:29 UTC (permalink / raw)
  To: buildroot
  Cc: Thomas Huth, Romain Naour, Cédric Le Goater, Thomas Petazzoni

Le 21/04/2023 à 20:49, Laurent Vivier a écrit :
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>   ...1-m68k-fix-getrandom-use-with-uclibc.patch | 35 +++++++++++++++++++
>   1 file changed, 35 insertions(+)
>   create mode 100644 package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
> 
> diff --git a/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch b/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
> new file mode 100644
> index 000000000000..d2fc3bc88641
> --- /dev/null
> +++ b/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
> @@ -0,0 +1,35 @@
> +From 491439a5c55b18dce96b522f3a603faaf1908ede Mon Sep 17 00:00:00 2001
> +From: Laurent Vivier <laurent@vivier.eu>
> +Date: Fri, 21 Apr 2023 18:22:07 +0200
> +Subject: [PATCH] m68k: fix getrandom() use with uclibc
> +
> +With uclibc, getrandom() is only defined with _GNU_SOURCE, fix that:
> +
> +kexec/arch/m68k/bootinfo.c: In function 'bootinfo_add_rng_seed':
> +kexec/arch/m68k/bootinfo.c:231:13: warning: implicit declaration of function 'getrandom'; did you mean 'srandom'? [-Wimplicit-function-declaration]
> +  231 |         if (getrandom(bi->rng_seed.data, RNG_SEED_LEN, GRND_NONBLOCK) != RNG_SEED_LEN) {
> +      |             ^~~~~~~~~
> +      |             srandom
> +kexec/arch/m68k/bootinfo.c:231:56: error: 'GRND_NONBLOCK' undeclared (first use in this function)
> +  231 |         if (getrandom(bi->rng_seed.data, RNG_SEED_LEN, GRND_NONBLOCK) != RNG_SEED_LEN) {
> +      |                                                        ^~~~~~~~~~~~~
> +
> +Fixes:  b9de05184816 ("m68k: pass rng seed via BI_RNG_SEED")
> +Cc: Jason@zx2c4.com
> +Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> +---
> + kexec/arch/m68k/bootinfo.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/kexec/arch/m68k/bootinfo.c b/kexec/arch/m68k/bootinfo.c
> +index 086a34bdfdeb..5afd212d9d34 100644
> +--- a/kexec/arch/m68k/bootinfo.c
> ++++ b/kexec/arch/m68k/bootinfo.c
> +@@ -1,3 +1,4 @@
> ++#define _GNU_SOURCE
> +
> + #include <stdio.h>
> + #include <stdlib.h>
> +--
> +2.40.0
> +

kexec patch sent to kexec ML:

https://lore.kernel.org/kexec/20230422095904.1303434-1-laurent@vivier.eu/T/#u

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc
  2023-04-21 18:49 ` [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc Laurent Vivier
  2023-04-23 10:29   ` Laurent Vivier
@ 2023-06-03 20:49   ` Arnout Vandecappelle via buildroot
  1 sibling, 0 replies; 8+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2023-06-03 20:49 UTC (permalink / raw)
  To: Laurent Vivier, buildroot
  Cc: Thomas Huth, Romain Naour, Cédric Le Goater, Thomas Petazzoni



On 21/04/2023 20:49, Laurent Vivier wrote:
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>

  Applied to master, thanks.

  I applied v12, but for some reason I don't have that version in my inbox, so I 
reply to v11.

  I also added a recent autobuild failure in a Fixes tag.

Fixes: 
http://autobuild.buildroot.net/results/b5a/b5a46cc164cb0fe6bf37dacb917b3664d2710a4a

  Regards,
  Arnout

> ---
>   ...1-m68k-fix-getrandom-use-with-uclibc.patch | 35 +++++++++++++++++++
>   1 file changed, 35 insertions(+)
>   create mode 100644 package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
> 
> diff --git a/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch b/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
> new file mode 100644
> index 000000000000..d2fc3bc88641
> --- /dev/null
> +++ b/package/kexec/0001-m68k-fix-getrandom-use-with-uclibc.patch
> @@ -0,0 +1,35 @@
> +From 491439a5c55b18dce96b522f3a603faaf1908ede Mon Sep 17 00:00:00 2001
> +From: Laurent Vivier <laurent@vivier.eu>
> +Date: Fri, 21 Apr 2023 18:22:07 +0200
> +Subject: [PATCH] m68k: fix getrandom() use with uclibc
> +
> +With uclibc, getrandom() is only defined with _GNU_SOURCE, fix that:
> +
> +kexec/arch/m68k/bootinfo.c: In function 'bootinfo_add_rng_seed':
> +kexec/arch/m68k/bootinfo.c:231:13: warning: implicit declaration of function 'getrandom'; did you mean 'srandom'? [-Wimplicit-function-declaration]
> +  231 |         if (getrandom(bi->rng_seed.data, RNG_SEED_LEN, GRND_NONBLOCK) != RNG_SEED_LEN) {
> +      |             ^~~~~~~~~
> +      |             srandom
> +kexec/arch/m68k/bootinfo.c:231:56: error: 'GRND_NONBLOCK' undeclared (first use in this function)
> +  231 |         if (getrandom(bi->rng_seed.data, RNG_SEED_LEN, GRND_NONBLOCK) != RNG_SEED_LEN) {
> +      |                                                        ^~~~~~~~~~~~~
> +
> +Fixes:  b9de05184816 ("m68k: pass rng seed via BI_RNG_SEED")
> +Cc: Jason@zx2c4.com
> +Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> +---
> + kexec/arch/m68k/bootinfo.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/kexec/arch/m68k/bootinfo.c b/kexec/arch/m68k/bootinfo.c
> +index 086a34bdfdeb..5afd212d9d34 100644
> +--- a/kexec/arch/m68k/bootinfo.c
> ++++ b/kexec/arch/m68k/bootinfo.c
> +@@ -1,3 +1,4 @@
> ++#define _GNU_SOURCE
> +
> + #include <stdio.h>
> + #include <stdlib.h>
> +--
> +2.40.0
> +
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-03 20:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 18:49 [Buildroot] [PATCH v11 0/5] package: add petitboot to use with qemu-system-m68k Laurent Vivier
2023-04-21 18:49 ` [Buildroot] [PATCH v11 1/5] kexec: fix sys/random.h with uclibc Laurent Vivier
2023-04-23 10:29   ` Laurent Vivier
2023-06-03 20:49   ` Arnout Vandecappelle via buildroot
2023-04-21 18:50 ` [Buildroot] [PATCH v11 2/5] petitboot: add pb-discover daemon Laurent Vivier
2023-04-21 18:50 ` [Buildroot] [PATCH v11 3/5] petitboot: start petitboot on all tty Laurent Vivier
2023-04-21 18:50 ` [Buildroot] [PATCH v11 4/5] board/qemu/m68k-virt: Add virt-m68k linux config Laurent Vivier
2023-04-21 18:50 ` [Buildroot] [PATCH v11 5/5] support/scripts/boot-qemu-image.py: manage petitboot interface Laurent Vivier

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.