[Buildroot] [PATCH v12 5/5] support/scripts/boot-qemu-image.py: manage petitboot interface
Laurent Vivier
laurent at vivier.eu
Sun May 7 16:53:40 UTC 2023
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 at 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.1
More information about the buildroot
mailing list