* [PATCH] runqemu: parse QB_GRAPHICS for nographic flag
@ 2026-01-31 21:11 charles.embedded
2026-02-02 15:58 ` [OE-core] " Alexander Kanavin
0 siblings, 1 reply; 5+ messages in thread
From: charles.embedded @ 2026-01-31 21:11 UTC (permalink / raw)
To: openembedded-core; +Cc: richard.purdie, Charles Dias
From: Charles Dias <charlesdias.cd@outlook.com>
The setup_vga() function was ignoring -nographic in QB_GRAPHICS
because it only checked the command-line self.nographic flag.
This caused QB_GRAPHICS to be appended after display autodetection,
resulting in conflicting options like "-device virtio-vga -display sdl"
and "-nographic" in the same command.
Add a check after reading qemuboot.conf to detect -nographic in
QB_GRAPHICS and set self.nographic accordingly. This prevents
unnecessary display autodetection for BSPs that specify -nographic
in their machine configuration, as happens in meta-zephyr layer.
Signed-off-by: Charles Dias <charlesdias.cd@outlook.com>
---
scripts/runqemu | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/runqemu b/scripts/runqemu
index 32a3d6296a..b791abfda3 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -986,6 +986,12 @@ to your build configuration.
v = os.path.dirname(self.qemuboot)
self.set(k_upper, v)
+ # Parse QB_GRAPHICS to set internal flags if not already set by command-line
+ if not self.nographic and self.get('QB_GRAPHICS'):
+ if '-nographic' in self.get('QB_GRAPHICS'):
+ logger.debug('Detected -nographic in QB_GRAPHICS, setting nographic mode')
+ self.nographic = True
+
def validate_paths(self):
"""Ensure all relevant path variables are set"""
# When we're started with a *.qemuboot.conf arg assume that image
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] runqemu: parse QB_GRAPHICS for nographic flag
2026-01-31 21:11 [PATCH] runqemu: parse QB_GRAPHICS for nographic flag charles.embedded
@ 2026-02-02 15:58 ` Alexander Kanavin
2026-02-02 22:08 ` charles.embedded
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Kanavin @ 2026-02-02 15:58 UTC (permalink / raw)
To: charles.embedded; +Cc: openembedded-core, richard.purdie, Charles Dias
On Sat, 31 Jan 2026 at 22:12, charles.embedded via
lists.openembedded.org
<charles.embedded=gmail.com@lists.openembedded.org> wrote:
> The setup_vga() function was ignoring -nographic in QB_GRAPHICS
> because it only checked the command-line self.nographic flag.
> This caused QB_GRAPHICS to be appended after display autodetection,
> resulting in conflicting options like "-device virtio-vga -display sdl"
> and "-nographic" in the same command.
>
> Add a check after reading qemuboot.conf to detect -nographic in
> QB_GRAPHICS and set self.nographic accordingly. This prevents
> unnecessary display autodetection for BSPs that specify -nographic
> in their machine configuration, as happens in meta-zephyr layer.
I'm not sure specifying -nographic in a BSP layer via QB_GRAPHICS is
correct. QB_GRAPHICS is intended for what emulated hardware should be
present in the guest machine.
-nographic is a host option that tells qemu what to do with the
graphical output (in case of -nographic, discard it). I don't think
it's up to the BSP layer to make that decision.
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] runqemu: parse QB_GRAPHICS for nographic flag
2026-02-02 15:58 ` [OE-core] " Alexander Kanavin
@ 2026-02-02 22:08 ` charles.embedded
2026-02-03 9:59 ` [OE-core] " Alexander Kanavin
0 siblings, 1 reply; 5+ messages in thread
From: charles.embedded @ 2026-02-02 22:08 UTC (permalink / raw)
To: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 2006 bytes --]
On Mon, Feb 2, 2026 at 12:58 PM, Alexander Kanavin wrote:
>
> I'm not sure specifying -nographic in a BSP layer via QB_GRAPHICS is
> correct. QB_GRAPHICS is intended for what emulated hardware should be
> present in the guest machine.
>
> -nographic is a host option that tells qemu what to do with the
> graphical output (in case of -nographic, discard it). I don't think
> it's up to the BSP layer to make that decision.
Hi Alex,
Thanks for the feedback.
In meta-zephyr/meta-zephyr-bsp/conf/machine/qemu-x86.conf are defined several QEMU settings that are used to generate the.qemuboot.conf file during the image build (e.g. ${TMPDIR}/deploy/images/qemu-x86/zephyr-helloworld-qemu-x86-20260201174846.elf).
The expectation is that, based on the resulting.qemuboot.conf , running runqemu should be sufficient to boot Zephyr and see the console output in the terminal (no GUI required). However, in this case QB_GRAPHICS="-nographic" is ignored, and the generated QEMU invocation still selects a graphical display device, so the Zephyr output does not appear on the terminal as expected. Please see the QEMU command:
/<path-to>/usr/bin/qemu-system-i386 -nic none -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 -machine type=q35 -cpu qemu32,+nx,+pae -m 256 -serial mon:vc -serial null -device virtio-vga -display sdl,show-cursor=on -nographic -machine acpi=off -kernel <path-to-build> /tmp/deploy/images/qemu-x86/zephyr-helloworld-qemu-x86-20260201174846.elf -append ' mem=256M swiotlb=0 '
So even though -nographic is present, QEMU is still invoked with -device virtio-vga and -display sdl , and the serial is set to mon:vc.
My intent with the patch is to ensure that when QB_GRAPHICS includes -nographic , runqemu does not select a graphical display device and routes the serial console to the terminal (so the Zephyr log is visible as expected).
Please let me know if I'm not on the right track. Thank you!
Charles Dias
[-- Attachment #2: Type: text/html, Size: 2444 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] runqemu: parse QB_GRAPHICS for nographic flag
2026-02-02 22:08 ` charles.embedded
@ 2026-02-03 9:59 ` Alexander Kanavin
2026-02-03 11:25 ` Charles Dias
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Kanavin @ 2026-02-03 9:59 UTC (permalink / raw)
To: charles.embedded; +Cc: openembedded-core
On Mon, 2 Feb 2026 at 23:08, charles.embedded via
lists.openembedded.org
<charles.embedded=gmail.com@lists.openembedded.org> wrote:
> In meta-zephyr/meta-zephyr-bsp/conf/machine/qemu-x86.conf are defined several QEMU settings that are used to generate the .qemuboot.conf file during the image build (e.g. ${TMPDIR}/deploy/images/qemu-x86/zephyr-helloworld-qemu-x86-20260201174846.elf).
>
> The expectation is that, based on the resulting .qemuboot.conf, running runqemu should be sufficient to boot Zephyr and see the console output in the terminal (no GUI required). However, in this case QB_GRAPHICS="-nographic" is ignored, and the generated QEMU invocation still selects a graphical display device, so the Zephyr output does not appear on the terminal as expected. Please see the QEMU command:
> /<path-to>/usr/bin/qemu-system-i386 -nic none -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 -machine type=q35 -cpu qemu32,+nx,+pae -m 256 -serial mon:vc -serial null -device virtio-vga -display sdl,show-cursor=on -nographic -machine acpi=off -kernel <path-to-build>/tmp/deploy/images/qemu-x86/zephyr-helloworld-qemu-x86-20260201174846.elf -append ' mem=256M swiotlb=0 '
>
> So even though -nographic is present, QEMU is still invoked with -device virtio-vga and -display sdl, and the serial is set to mon:vc.
>
> My intent with the patch is to ensure that when QB_GRAPHICS includes -nographic, runqemu does not select a graphical display device and routes the serial console to the terminal (so the Zephyr log is visible as expected).
>
> Please let me know if I'm not on the right track. Thank you!
nographic is an option that can be passed only as a command line
parameter to runqemu. It is also not the default: when you run runqemu
with no parameters, it will default to having graphical output if that
is detected to be supported (via trying 'qemu-system.. --help' and
seeing what is enabled), or no output otherwise:
# If we have no display option, we autodetect based upon what
qemu supports. We
# need our font setup and show-cusor below so we need to see
what qemu --help says
# is supported so we can pass our correct config in.
if not self.nographic and not self.sdl and not self.gtk and
not self.publicvnc and not self.egl_headless == True:
output = subprocess.check_output([self.qemu_bin,
"--help"], universal_newlines=True, env=self.qemu_environ)
if "-display gtk" in output:
self.gtk = True
elif "-display sdl" in output:
self.sdl = True
else:
self.qemu_opt += ' -display none'
Once again, it is not up to layers to force a decision where qemu
output goes. Maybe users want it in a graphical window. Maybe they
want it in a vnc server. Maybe they don't want it at all, because they
will ssh into the system. We can consider whether the above logic
makes sense, and if nographic should be the default (instead of the
above if..else block), but taking that choice altogether away from
users is not right.
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] runqemu: parse QB_GRAPHICS for nographic flag
2026-02-03 9:59 ` [OE-core] " Alexander Kanavin
@ 2026-02-03 11:25 ` Charles Dias
0 siblings, 0 replies; 5+ messages in thread
From: Charles Dias @ 2026-02-03 11:25 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: openembedded-core
On Tue, Feb 3, 2026 at 7:00 AM Alexander Kanavin <alex.kanavin@gmail.com> wrote:
>
> nographic is an option that can be passed only as a command line
> parameter to runqemu. It is also not the default: when you run runqemu
> with no parameters, it will default to having graphical output if that
> is detected to be supported (via trying 'qemu-system.. --help' and
> seeing what is enabled), or no output otherwise:
>
> # If we have no display option, we autodetect based upon what
> qemu supports. We
> # need our font setup and show-cusor below so we need to see
> what qemu --help says
> # is supported so we can pass our correct config in.
> if not self.nographic and not self.sdl and not self.gtk and
> not self.publicvnc and not self.egl_headless == True:
> output = subprocess.check_output([self.qemu_bin,
> "--help"], universal_newlines=True, env=self.qemu_environ)
> if "-display gtk" in output:
> self.gtk = True
> elif "-display sdl" in output:
> self.sdl = True
> else:
> self.qemu_opt += ' -display none'
>
> Once again, it is not up to layers to force a decision where qemu
> output goes. Maybe users want it in a graphical window. Maybe they
> want it in a vnc server. Maybe they don't want it at all, because they
> will ssh into the system. We can consider whether the above logic
> makes sense, and if nographic should be the default (instead of the
> above if..else block), but taking that choice altogether away from
> users is not right.
>
Hi Alex,
Thanks for the clarification. I’ll drop this patch.
Charles Dias
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-02-03 11:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-31 21:11 [PATCH] runqemu: parse QB_GRAPHICS for nographic flag charles.embedded
2026-02-02 15:58 ` [OE-core] " Alexander Kanavin
2026-02-02 22:08 ` charles.embedded
2026-02-03 9:59 ` [OE-core] " Alexander Kanavin
2026-02-03 11:25 ` Charles Dias
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox