Skip to content

scripts: ci: qemu-run.sh: make audio device optional #945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

DaniilKl
Copy link
Contributor

@DaniilKl DaniilKl commented Jul 17, 2025

The QEMU audio device emulation caused issues in github.com/dasharo/meta-dts testing CIs. Check this issue for more inf.: Dasharo/dasharo-issues#1382 . Because the audio device is not used in the CIs - it could be disabled optionally.

The QEMU audio device emulation caused issues in
github.com/dasharo/meta-dts testing CIs. Check this issue for more inf.:
Dasharo/dasharo-issues#1382 . Because the
audio device is not used in the CIs - it could be disabled optionally.

Signed-off-by: Daniil Klimuk <daniil.klimuk@3mdeb.com>
@DaniilKl DaniilKl requested a review from m-iwanicki July 17, 2025 08:48
@DaniilKl DaniilKl self-assigned this Jul 17, 2025
The change is caused by:

codespell................................................................Failed
- hook id: codespell
- exit code: 65

scripts/ci/qemu-run.sh:161: hda ==> had

Signed-off-by: Daniil Klimuk <daniil.klimuk@3mdeb.com>
@DaniilKl DaniilKl force-pushed the optional-audio-device-qemu branch from 4da57cc to 8fa988e Compare July 17, 2025 09:05
-device virtio-rng-pci,max-bytes=1024,period=1000 \
-device virtio-net,netdev=vmnic \
-netdev user,id=vmnic,hostfwd=tcp::5222-:22 \
-drive file=${HDD_PATH},if=ide"

QEMU_PARAMS_OS_SAUND="-device ich9-intel-hda \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
QEMU_PARAMS_OS_SAUND="-device ich9-intel-hda \
QEMU_PARAMS_OS_AUDIO="-device ich9-intel-hda \

@@ -22,6 +22,7 @@ then
exit 1
fi

NO_AUDIO_EMUALTION=""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NO_AUDIO_EMUALTION=""
NO_AUDIO_EMULATION=""

@@ -38,7 +39,7 @@ QEMU_FW_FILE="./qemu_q35.rom"

usage() {
cat <<EOF
Usage: ./$(basename ${0}) QEMU_MODE ACTION
Usage: ./$(basename ${0}) QEMU_MODE ACTION ARGUMENTS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Usage: ./$(basename ${0}) QEMU_MODE ACTION ARGUMENTS
Usage: ./$(basename ${0}) [OPTIONS]... QEMU_MODE ACTION

@@ -62,6 +63,10 @@ This is the QEMU wrapper script for the Dasharo Open Source Firmware Validation.
HDD2_PATH optional path of the second hard drive to connect to the machine if
ACTION "os" is used. Relative to DIR

Additional ARGUMENTS:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Additional ARGUMENTS:
OPTIONS:

@@ -129,10 +134,6 @@ cleanup() {

trap cleanup INT

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parse_args() {
while [[ $# -gt 0 ]]; do
case $1 in
-v|--verbose)
set -x
shift
;;
-h|--help)
usage
exit 0
;;
-*)
usage
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=( "$1" )
shift
;;
esac
done
}
parse_args "$@"
set -- "${POSITIONAL_ARGS[@]}"

That way:

  • You don't need to remove next if
  • You can use arguments anywhere

If you apply then bring back

if [ $# -ne 2 ]; then
  usage
fi

And add --help and --verbose to usage.
I mostly use this template: https://github.com/m-iwanicki/scripts/blob/main/scripts/script-template.sh when writing scripts.

Comment on lines +175 to +192
ACTION="$2"
shift 2

# Check for additional parameters before deciding on QEMU_PARAMS. Because the
# additional parameters might change the QEMU_PARAMS.
while [[ $# -gt 0 ]]; do
case $1 in
"--no-audio-emulation")
NO_AUDIO_EMUALTION="true"
shift
;;
*)
echo -e "Additional argument: ${1} not supported\n"
usage
exit 1
;;
esac
done
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ACTION="$2"
shift 2
# Check for additional parameters before deciding on QEMU_PARAMS. Because the
# additional parameters might change the QEMU_PARAMS.
while [[ $# -gt 0 ]]; do
case $1 in
"--no-audio-emulation")
NO_AUDIO_EMUALTION="true"
shift
;;
*)
echo -e "Additional argument: ${1} not supported\n"
usage
exit 1
;;
esac
done

Implement previous suggestion

@@ -2,6 +2,7 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove everything from this file and add hda to .codespellrc file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct .codespellrc format: #945 (comment)

while [[ $# -gt 0 ]]; do
case $1 in
"--no-audio-emulation")
NO_AUDIO_EMUALTION="true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NO_AUDIO_EMUALTION="true"
NO_AUDIO_EMULATION="true"

case "${ACTION}" in
firmware)
MEMORY="1G"
;;
os)
MEMORY="4G"
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS}"

if [[ "$NO_AUDIO_EMUALTION" != "true" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [[ "$NO_AUDIO_EMUALTION" != "true" ]]; then
if [[ "$NO_AUDIO_EMULATION" != "true" ]]; then

case "${ACTION}" in
firmware)
MEMORY="1G"
;;
os)
MEMORY="4G"
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS}"

if [[ "$NO_AUDIO_EMUALTION" != "true" ]]; then
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS_SAUND}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS_SAUND}"
QEMU_PARAMS="${QEMU_PARAMS} ${QEMU_PARAMS_OS_AUDIO}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants