@@ -862,15 +862,25 @@ update_rootfs_boot_kernel()
862
862
sudo mkdir -p " $builddir /mnt/run-qemu-kernel/$kver "
863
863
sudo cp " $builddir /mkosi.extra/boot/vmlinuz-$kver " " $builddir /mnt/run-qemu-kernel/$kver /vmlinuz"
864
864
865
+ local loader_timeout=4
866
+ if [[ $_arg_kvm == " on" ]] && [[ $_arg_gdb == " on" ]]; then
867
+ # KVM is not compatible with qemu -S, see
868
+ # https://github.com/pmem/run_qemu/issues/11
869
+ loader_timeout=301
870
+ fi
871
+
865
872
defconf=" $builddir /mnt/loader/loader.conf"
866
873
if [ -f " $defconf " ]; then
867
- sudo sed -i -e ' s/^#.*timeout.*/timeout 4/' " $defconf "
874
+ # mkosi->"bootctl install ..." creates a stub loader.conf
875
+ sudo sed -i -e ' s/^#.*timeout.*/timeout ' " $loader_timeout /" " $defconf "
868
876
sudo sed -i -e ' /default.*/d' " $defconf "
869
877
else
870
- echo " timeout 4 " | sudo tee " $defconf "
878
+ echo " timeout $loader_timeout " | sudo tee " $defconf "
871
879
fi
872
880
echo " default run-qemu-kernel-$kver .conf" | sudo tee -a " $defconf "
873
881
882
+ generatedfrom_header ' update_rootfs_boot_kernel()' | sudo tee -a " $defconf " > /dev/null
883
+
874
884
[[ " $_arg_legacy_bios " == ' on' ]] || install_opt_efi_shell
875
885
876
886
umount_rootfs 1
@@ -1733,7 +1743,22 @@ prepare_qcmd()
1733
1743
fi
1734
1744
1735
1745
if [ " $_arg_gdb " == " on" ]; then
1736
- qcmd+=(" -gdb" " tcp::10000" " -S" )
1746
+ qcmd+=(" -gdb" " tcp::10000" )
1747
+ # -S seems to rely on a _software_ breakpoint which seems incompatible with KVM,
1748
+ # see https://github.com/pmem/run_qemu/issues/11
1749
+ if [[ " $_arg_kvm " == ' on' ]]; then
1750
+ {
1751
+ printf ' \n\nWARNING: qemu "-S" option seems incompatible with KVM; not used.\n'
1752
+ if [[ " $_arg_direct_kernel " == ' on' ]]; then
1753
+ printf ' \tOption --no-direct-kernel is recommended.\n\n'
1754
+ else
1755
+ printf ' \tBoot loader will wait a few minutes.\n\n'
1756
+ fi
1757
+ } >&2
1758
+ sleep 2
1759
+ else
1760
+ qcmd+=(" -S" )
1761
+ fi
1737
1762
fi
1738
1763
1739
1764
# cpu + mem nodes (i.e. the --nodes option)
0 commit comments