Skip to contentSkip to conversation

Struggling to get QEMU sound working on core-image-base

OE-core Mark Jonas 2 participants 2 messages Jan 3, 2023 1 message not in the archive

lore
Share & tools
lore

Mark Jonas

author
#1 lore raw
In reply to a message not in the archive

Hi,

Quoted 14 lines

I have difficulties getting core-image-base and QEMU x86-64 sound output working. I do not even get to the point of having a visible ALSA sound device.

What part of the puzzle am I missing?

Alternatively, can someone point me to a (simple) YP image where sound works with QEMU x86 or x86-64?

I built a core-image-base image from latest YP Poky [dunfell,langdale] with the following additions in a default local.conf:

MACHINE = "qemux86-64"

Quoted 7 lines

# Load kernel modules matching QEMU audio support
KERNEL_MODULE_AUTOLOAD += "snd-ens1370"

# Check ALSA cards available
IMAGE_INSTALL:append = " alsa-utils"

EXTRA_IMAGE_FEATURES += "debug-tweaks"

I was able to solve part of the riddle. Now I am wondering whether I hit a bug in the meta/conf/machine/qemux86*.conf files.

The conf/machine/qemux86*.conf recommends the installation of the
snd-ens1370 module.
(since https://git.openembedded.org/openembedded-core/commit/?id=112775995158cf6c504fd6beef345ee446f4f11d)

MACHINE_EXTRA_RRECOMMENDS = "kernel-module-snd-ens1370 kernel-module-snd-rawmidi"

Thus, I assumed that (as suggested by
https://docs.yoctoproject.org/dev-manual/qemu.html) QEMU would create an ENS1370 device.

- ``audio``: Enables audio in QEMU. The MACHINE option must be either "qemux86" or "qemux86-64" in order for audio to be enabled. Additionally, the ``snd_intel8x0`` or ``snd_ens1370`` driver must be installed in linux guest.

Actually, the sound device in the virtual machine is an Intel 8x0 type.

root@qemux86-64:~# lspci
[..]
00:04.0 Multimedia audio controller: Intel Corporation 82801AA AC'97
Audio Controller (rev 01)
[..]

After installing the snd-intel8x0 module into the image and adding it to the auto-loaded modules, I can finally see an ALSA card.

IMAGE_INSTALL:append = " kernel-module-snd-intel8x0" KERNEL_MODULE_AUTOLOAD += "snd-ens1370 snd-intel8x0"

(see https://gitlab.com/toertel/meta-qemusound)

root@qemux86-64:~# cat /proc/asound/cards
 0 [I82801AAICH    ]: ICH - Intel 82801AA-ICH
                      Intel 82801AA-ICH with STAC9700,83,84 at irq 20

Then, isn't it a bug in the meta/conf/machine/qemux86*.conf files that (only?) the kernel-module-snd-ens1370 is recommended? Shouldn't the kernel-module-snd-intel8x0 be recommended (additionally?)?

Staying in line with the Poky QEMU documentation I offer to send a patch which adds kernel-module-snd-intel8x0 to MACHINE_EXTRA_RRECOMMENDS of the meta/conf/machine/qemux86*.conf files.

Shouldn't then also linux-yocto.inc be amended such that the KERNEL_MODULE_AUTOLOAD is set in case it is a qemux86* kernel and the DISTRO_FEATURES contain alsa?

ALSA_MODULES = "${@bb.utils.contains("DISTRO_FEATURES", "alsa", " snd-ens1370 snd-intel8x0", "", d)}" KERNEL_MODULE_AUTOLOAD:qemux86 += "${ALSA_MODULES}" KERNEL_MODULE_AUTOLOAD:qemux86-64 += "${ALSA_MODULES}"

Cheers,
Mark

#2 lore raw
Quoted 71 lines · Mark Jonas

Hi,

Quoted 14 lines

I have difficulties getting core-image-base and QEMU x86-64 sound output working. I do not even get to the point of having a visible ALSA sound device.

What part of the puzzle am I missing?

Alternatively, can someone point me to a (simple) YP image where sound works with QEMU x86 or x86-64?

I built a core-image-base image from latest YP Poky [dunfell,langdale] with the following additions in a default local.conf:

MACHINE = "qemux86-64"

Quoted 7 lines

# Load kernel modules matching QEMU audio support
KERNEL_MODULE_AUTOLOAD += "snd-ens1370"

# Check ALSA cards available
IMAGE_INSTALL:append = " alsa-utils"

EXTRA_IMAGE_FEATURES += "debug-tweaks"

I was able to solve part of the riddle. Now I am wondering whether I hit a bug in the meta/conf/machine/qemux86*.conf files.

The conf/machine/qemux86*.conf recommends the installation of the
snd-ens1370 module.
(since https://git.openembedded.org/openembedded-core/commit/?id=112775995158cf6c504fd6beef345ee446f4f11d)

MACHINE_EXTRA_RRECOMMENDS = "kernel-module-snd-ens1370 kernel-module-snd-rawmidi"

Thus, I assumed that (as suggested by
https://docs.yoctoproject.org/dev-manual/qemu.html) QEMU would create an ENS1370 device.

- ``audio``: Enables audio in QEMU. The MACHINE option must be either "qemux86" or "qemux86-64" in order for audio to be enabled. Additionally, the ``snd_intel8x0`` or ``snd_ens1370`` driver must be installed in linux guest.

Actually, the sound device in the virtual machine is an Intel 8x0 type.

root@qemux86-64:~# lspci
[..]
00:04.0 Multimedia audio controller: Intel Corporation 82801AA AC'97
Audio Controller (rev 01)
[..]

After installing the snd-intel8x0 module into the image and adding it to the auto-loaded modules, I can finally see an ALSA card.

IMAGE_INSTALL:append = " kernel-module-snd-intel8x0" KERNEL_MODULE_AUTOLOAD += "snd-ens1370 snd-intel8x0"

(see https://gitlab.com/toertel/meta-qemusound)

root@qemux86-64:~# cat /proc/asound/cards
 0 [I82801AAICH    ]: ICH - Intel 82801AA-ICH
                      Intel 82801AA-ICH with STAC9700,83,84 at irq 20

Then, isn't it a bug in the meta/conf/machine/qemux86*.conf files that (only?) the kernel-module-snd-ens1370 is recommended? Shouldn't the kernel-module-snd-intel8x0 be recommended (additionally?)?

Staying in line with the Poky QEMU documentation I offer to send a patch which adds kernel-module-snd-intel8x0 to MACHINE_EXTRA_RRECOMMENDS of the meta/conf/machine/qemux86*.conf files.

Quoted 8 lines

Shouldn't then also linux-yocto.inc be amended such that the KERNEL_MODULE_AUTOLOAD is set in case it is a qemux86* kernel and the DISTRO_FEATURES contain alsa?

ALSA_MODULES = "${@bb.utils.contains("DISTRO_FEATURES", "alsa", " snd-ens1370 snd-intel8x0", "", d)}" KERNEL_MODULE_AUTOLOAD:qemux86 += "${ALSA_MODULES}" KERNEL_MODULE_AUTOLOAD:qemux86-64 += "${ALSA_MODULES}"

Thanks for debugging this, please do send some patches as we should fix this. Without having gone into the details the direction sounds right to me.

Cheers,

Richard