@@ -810,15 +810,25 @@ update_rootfs_boot_kernel()
810
810
sudo mkdir -p " $builddir /mnt/run-qemu-kernel/$kver "
811
811
sudo cp " $builddir /mkosi.extra/boot/vmlinuz-$kver " " $builddir /mnt/run-qemu-kernel/$kver /vmlinuz"
812
812
813
+ local loader_timeout=4
814
+ if [[ $_arg_kvm == " on" ]] && [[ $_arg_gdb == " on" ]]; then
815
+ # KVM is not compatible with qemu -S, see
816
+ # https://github.com/pmem/run_qemu/issues/11
817
+ loader_timeout=301
818
+ fi
819
+
813
820
defconf=" $builddir /mnt/loader/loader.conf"
814
821
if [ -f " $defconf " ]; then
815
- sudo sed -i -e ' s/^#.*timeout.*/timeout 4/' " $defconf "
822
+ # mkosi->"bootctl install ..." creates a stub loader.conf
823
+ sudo sed -i -e ' s/^#.*timeout.*/timeout ' " $loader_timeout /" " $defconf "
816
824
sudo sed -i -e ' /default.*/d' " $defconf "
817
825
else
818
- echo " timeout 4 " | sudo tee " $defconf "
826
+ echo " timeout $loader_timeout " | sudo tee " $defconf "
819
827
fi
820
828
echo " default run-qemu-kernel-$kver .conf" | sudo tee -a " $defconf "
821
829
830
+ generatedfrom_header ' update_rootfs_boot_kernel()' | sudo tee -a " $defconf " > /dev/null
831
+
822
832
# Fedora
823
833
sudo cp " $ovmf_path " /Shell.efi " $builddir " /mnt/shellx64.efi ||
824
834
# Arch Linux
@@ -1575,7 +1585,22 @@ prepare_qcmd()
1575
1585
fi
1576
1586
1577
1587
if [ " $_arg_gdb " == " on" ]; then
1578
- qcmd+=(" -gdb" " tcp::10000" " -S" )
1588
+ qcmd+=(" -gdb" " tcp::10000" )
1589
+ # -S seems to rely on a _software_ breakpoint which seems incompatible with KVM,
1590
+ # see https://github.com/pmem/run_qemu/issues/11
1591
+ if [[ " $_arg_kvm " == ' on' ]]; then
1592
+ {
1593
+ printf ' \n\nWARNING: qemu "-S" option seems incompatible with KVM; not used.\n'
1594
+ if [[ " $_arg_direct_kernel " == ' on' ]]; then
1595
+ printf ' \tOption --no-direct-kernel is recommended.\n\n'
1596
+ else
1597
+ printf ' \tBoot loader will wait a few minutes.\n\n'
1598
+ fi
1599
+ } >&2
1600
+ sleep 2
1601
+ else
1602
+ qcmd+=(" -S" )
1603
+ fi
1579
1604
fi
1580
1605
1581
1606
# cpu + mem nodes (i.e. the --nodes option)
0 commit comments