From 5edce691885fb41252676df6b94768683a165157 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Tue, 5 Aug 2025 21:07:26 +0200 Subject: [PATCH] configs/qemu_sh4*: switch back to disk emulation Back in commit 44a6b7866c95ca5459a53a50eab5ab1d38b6b8e1 ("configs/qemu_sh4*: switch to initramfs"), the Qemu SuperH defconfigs were switched to initramfs due to a bug in the Qemu disk emulation. However, the initramfs solution has an issue: if the initramfs is slightly too large (like just 6 MB!), the system no longer boots. Since the disk emulation problem has apparently been resolved in Qemu 10 (according to testing), let's switch back to this. In addition to essentially reverting 44a6b7866c95ca5459a53a50eab5ab1d38b6b8e1, we also need to adjust the kernel configuration so that the kernel takes its command line for the bootloader (in our case from the Qemu -append option). Otherwise an hardcoded command line is used, which doesn't mount /dev/sda as the root filesystem. This update has been tested on Gitlab CI: https://gitlab.com/tpetazzoni/buildroot/-/pipelines/1968267919 Thanks to Romain Naour for pointing to the initramfs size as being the issue. Cc: Romain Naour Signed-off-by: Thomas Petazzoni Signed-off-by: Julien Olivain --- board/qemu/sh4-r2d/linux.config | 1 + board/qemu/sh4-r2d/readme.txt | 2 +- board/qemu/sh4eb-r2d/linux.config | 1 + board/qemu/sh4eb-r2d/readme.txt | 2 +- configs/qemu_sh4_r2d_defconfig | 2 +- configs/qemu_sh4eb_r2d_defconfig | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/board/qemu/sh4-r2d/linux.config b/board/qemu/sh4-r2d/linux.config index a3d6544549..dd4bf5204f 100644 --- a/board/qemu/sh4-r2d/linux.config +++ b/board/qemu/sh4-r2d/linux.config @@ -5,6 +5,7 @@ CONFIG_MEMORY_START=0x0c000000 CONFIG_FLATMEM_MANUAL=y CONFIG_SH_RTS7751R2D=y CONFIG_RTS7751R2D_PLUS=y +CONFIG_CMDLINE_FROM_BOOTLOADER=y CONFIG_HEARTBEAT=y CONFIG_PCI=y CONFIG_NET=y diff --git a/board/qemu/sh4-r2d/readme.txt b/board/qemu/sh4-r2d/readme.txt index 24c3676d8a..b0799e47a8 100644 --- a/board/qemu/sh4-r2d/readme.txt +++ b/board/qemu/sh4-r2d/readme.txt @@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-sh4 -M r2d -kernel output/images/zImage -append "console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user # qemu_sh4_r2d_defconfig + qemu-system-sh4 -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user # qemu_sh4_r2d_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer. diff --git a/board/qemu/sh4eb-r2d/linux.config b/board/qemu/sh4eb-r2d/linux.config index 6ead626c41..5f94bee77d 100644 --- a/board/qemu/sh4eb-r2d/linux.config +++ b/board/qemu/sh4eb-r2d/linux.config @@ -6,6 +6,7 @@ CONFIG_FLATMEM_MANUAL=y CONFIG_CPU_BIG_ENDIAN=y CONFIG_SH_RTS7751R2D=y CONFIG_RTS7751R2D_PLUS=y +CONFIG_CMDLINE_FROM_BOOTLOADER=y CONFIG_HEARTBEAT=y CONFIG_PCI=y CONFIG_NET=y diff --git a/board/qemu/sh4eb-r2d/readme.txt b/board/qemu/sh4eb-r2d/readme.txt index 577c54cd9d..9f3dd8b20b 100644 --- a/board/qemu/sh4eb-r2d/readme.txt +++ b/board/qemu/sh4eb-r2d/readme.txt @@ -1,6 +1,6 @@ Run the emulation with: - qemu-system-sh4eb -M r2d -kernel output/images/zImage -append "console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user # qemu_sh4eb_r2d_defconfig + qemu-system-sh4eb -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user # qemu_sh4eb_r2d_defconfig The login prompt will appear in the terminal that started Qemu. The graphical window is the framebuffer. diff --git a/configs/qemu_sh4_r2d_defconfig b/configs/qemu_sh4_r2d_defconfig index 63b9fa1b29..628ca05543 100644 --- a/configs/qemu_sh4_r2d_defconfig +++ b/configs/qemu_sh4_r2d_defconfig @@ -12,7 +12,7 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.27" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/sh4-r2d/linux.config" BR2_LINUX_KERNEL_ZIMAGE=y -BR2_TARGET_ROOTFS_INITRAMFS=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 diff --git a/configs/qemu_sh4eb_r2d_defconfig b/configs/qemu_sh4eb_r2d_defconfig index 97cbd6bd8a..4fd07775ed 100644 --- a/configs/qemu_sh4eb_r2d_defconfig +++ b/configs/qemu_sh4eb_r2d_defconfig @@ -12,7 +12,7 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.27" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/sh4eb-r2d/linux.config" BR2_LINUX_KERNEL_ZIMAGE=y -BR2_TARGET_ROOTFS_INITRAMFS=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