Skip to content

Commit e2ff7a7

Browse files
author
Itaru Kitayama
committed
For 64-bit Arm QEMU operation, use the -blockdev and -device options.
Also execute dracut with sudo as it fails as a non-privileged user during the script execution.
1 parent 569c475 commit e2ff7a7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

run_qemu.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ install_build_initrd()
594594
# and it expects a /lib/modules/$kver/vmlinuz
595595
cp "$inst_path/vmlinuz-$kver" "$inst_prefix/lib/modules/$kver/vmlinuz"
596596

597-
dracut --force --verbose \
597+
sudo dracut --force --verbose \
598598
--no-hostonly \
599599
--show-modules \
600600
--kver="$kver" \
@@ -1818,8 +1818,12 @@ prepare_qcmd()
18181818
machine_args+=("cxl=on")
18191819
fi
18201820
case "${qemu_machine}" in
1821+
q35)
1822+
qcmd+=("-drive" "file=$_arg_rootfs,format=raw,media=disk") ;;
18211823
virt)
1822-
machine_args+=("highmem=on,compact-highmem=on,highmem-ecam=on,highmem-mmio=on") ;;
1824+
machine_args+=("highmem=on,compact-highmem=on,highmem-ecam=on,highmem-mmio=on")
1825+
qcmd+=("-blockdev" "driver=file,filename=$_arg_rootfs,node-name=disk0")
1826+
qcmd+=("-device" "virtio-blk-pci,drive=disk0") ;;
18231827
esac
18241828
qcmd+=("-machine" "$(IFS=,; echo "${machine_args[*]}")")
18251829
qcmd+=("-m" "${qemu_mem}M,slots=$((num_pmems + num_mems)),$pmem_append")
@@ -1851,7 +1855,6 @@ prepare_qcmd()
18511855
;;
18521856
esac
18531857

1854-
qcmd+=("-drive" "file=$_arg_rootfs,format=raw,media=disk")
18551858
if [ $_arg_direct_kernel = "on" ] && [ -n "$vmlinuz" ] && [ -n "$initrd" ]; then
18561859
qcmd+=("-kernel" "$vmlinuz" "-initrd" "$initrd")
18571860
qcmd+=("-append" "${kcmd[*]}")

0 commit comments

Comments
 (0)