Skip to content

Commit 021831b

Browse files
author
olevole
committed
qemu: add nographics options
1 parent 587722c commit 021831b

File tree

12 files changed

+63
-16
lines changed

12 files changed

+63
-16
lines changed

qemuctl/qconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ if [ -z "${cmd}" ]; then
6262
myargs="astart vm_cpus vm_ram vm_boot vm_vnc_port qemu_vnc_tcp_bind qemu_vnc_resolution \
6363
cd_vnc_wait protected hidden ip4_addr vnc_password on_poweroff on_reboot on_crash spice_default \
6464
vm_spice_port qemu_spice_tcp_bind qemu_spice_resolution qemu_spice_flags spice_password soundhw debug_engine \
65-
vm_iso_path machine machine_accel vga usb tablet xhci boot_delay kernel bios cpu"
65+
vm_iso_path machine machine_accel vga usb tablet xhci boot_delay kernel bios cpu nographic"
6666

6767
# jailed for FreeBSD 12.0+
6868
[ ${freebsdhostversion} -gt 1200086 ] && myargs="${myargs} jailed"

qemuctl/qconstruct-tui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,9 @@ while [ 1 ]; do
396396
;;
397397
"GO")
398398
# store last choices
399-
/usr/local/cbsd/misc/cbsdsysrc -qf ${tmpdir}/qconstruct.conf last_vm_os_type="${vm_os_type}" > /dev/null 2>&1
400-
/usr/local/cbsd/misc/cbsdsysrc -qf ${tmpdir}/qconstruct.conf last_vm_os_profile="${vm_os_profile}" > /dev/null 2>&1
401-
/usr/local/cbsd/misc/cbsdsysrc -qf ${tmpdir}/qconstruct.conf last_vm_os_arch="${arch}" > /dev/null 2>&1
399+
/usr/local/cbsd/misc/cbsdsysrc -qf ${tmpdir}/qconstruct.conf last_vm_os_type="${vm_os_type}" \
400+
last_vm_os_profile="${vm_os_profile}" \
401+
last_vm_os_arch="${arch}" > /dev/null 2>&1
402402
gen_newjail_conf
403403
;;
404404
"-")

qemuctl/qset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ update_jails()
111111
cbsdsqlrw ${jailsysdir}/${jname}/local.sqlite UPDATE settings SET ${i}=\"${VAL}\"
112112
# back compatible
113113
case "${i}" in
114-
vm_cpus|vm_ram)
115-
cbsdsqlrw local UPDATE qemu SET ${i}=\"${VAL}\" WHERE jname=\"${jname}\"
114+
vm_cpus|vm_ram|nographic)
115+
cbsdsqlrw local "UPDATE qemu SET ${i}='${VAL}' WHERE jname='${jname}'"
116116
;;
117117
esac
118118
;;

qemuctl/qsetup-tui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ dialog_menu_main()
114114
# don't show it in main menu:
115115
local _in_sub_menu="qemu_generate_acpi qemu_wire_memory qemu_rts_keeps_utc qemu_force_msi_irq qemu_x2apic_mode qemu_mptable_gen qemu_ignore_msr_acc cd_vnc_wait qemu_vnc_resolution qemu_vnc_tcp_bind \
116116
vnc_password qemu_vnc_vgaconf on_crash on_poweroff on_reboot double_acpi virtio_rnd qemurun_wrapper qemustop_wrapper boot_delay usb xhci tablet machine machine_accel vga spice_default vm_spice_port \
117-
qemu_spice_tcp_bind qemu_spice_resolution qemu_spice_flags spice_password soundhw jailed kernel bios cpu"
117+
qemu_spice_tcp_bind qemu_spice_resolution qemu_spice_flags spice_password soundhw jailed kernel bios cpu nographic"
118118

119119
item_let="A"
120120
item_num=0
@@ -275,7 +275,7 @@ while [ 1 ]; do
275275
;;
276276
b_order|order)
277277
border-tui jname="${jname}"
278-
b_order=$( cbsdsqlro local "SELECT b_order FROM jails WHERE jname=\"${jname}\"" 2>/dev/null )
278+
b_order=$( cbsdsqlro local "SELECT b_order FROM jails WHERE jname='${jname}'" 2>/dev/null )
279279
;;
280280
"EXIT")
281281
f_die

share/local-qemu-settings.schema

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ boot_delay="integer default 0"
6565
arch="text default 0"
6666
kernel="text default 0"
6767
cpu="text default \"auto\""
68+
nographic="integer default 0"
6869

6970
INITDB=""
7071
CONSTRAINT=""

share/local-qemu.schema

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
jname="text default 0 unique"
99
vm_cpus="integer default 1"
1010
vm_ram="integer default 536870912"
11+
nographic="integer default 0"
1112

1213
CONSTRAINT=", FOREIGN KEY(jname) REFERENCES jails(jname)"
1314

share/qemu.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Default SQL scheme for DB local::qemu
2-
MYCOL="jname astart vm_cpus vm_ram"
2+
MYCOL="jname astart vm_cpus vm_ram nographic"

share/qemu_settings.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Default SQL scheme for DB local::qemu_settings
22
MYCOL="created astart vm_cpus vm_ram vm_os_type vm_boot vm_os_profile vm_vnc_port qemu_vnc_tcp_bind qemu_vnc_resolution cd_vnc_wait protected hidden maintenance ip4_addr \
33
vnc_password state_time on_poweroff on_reboot on_crash spice_default vm_spice_port qemu_spice_tcp_bind qemu_spice_resolution qemu_spice_flags spice_password soundhw \
4-
debug_engine vm_iso_path2 vm_zfs_guid vnc_port qemu_hap qemu_nestedhvm vm_iso_path bios machine machine_accel vga usb tablet xhci boot_delay arch kernel cpu"
4+
debug_engine vm_iso_path2 vm_zfs_guid vnc_port qemu_hap qemu_nestedhvm vm_iso_path bios machine machine_accel vga usb tablet xhci boot_delay arch kernel cpu nographic"

subr/qemu.subr

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,17 @@ compile_cpu_args()
10191019

10201020
# todo: auto
10211021
if [ "${cpu}" = "auto" ]; then
1022-
true
1023-
# ???
1022+
1023+
# !! check for native arch before auto
1024+
case "${vm_arch}" in
1025+
aarch64)
1026+
cpu_args="-cpu cortex-a57"
1027+
;;
1028+
*)
1029+
true
1030+
;;
1031+
esac
1032+
10241033
else
10251034
cpu_args="-cpu ${cpu}"
10261035
fi
@@ -1033,6 +1042,11 @@ compile_vga_args()
10331042
vga_args=
10341043

10351044
[ -z "${vga}" ] && return 0
1045+
1046+
if [ "${nographic}" = "1" ]; then
1047+
vga_args="-nographic"
1048+
return 0
1049+
fi
10361050
if [ "${vga}" = "0" ]; then
10371051
vga_args="-nographic"
10381052
return 0

subr/rcconf.subr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ init_qemu_rcconf()
137137
local sqldelimer="|"
138138
local A
139139

140-
A=$( cbsdsqlro ${jailsysdir}/${jname}/local.sqlite "SELECT astart,vm_cpus,vm_ram,vm_os_type,vm_boot,vm_os_profile,vm_vnc_port,qemu_vnc_tcp_bind,qemu_vnc_resolution,cd_vnc_wait,protected,hidden,maintenance,ip4_addr,vnc_password,on_poweroff,on_reboot,on_crash,spice_default,vm_spice_port,qemu_spice_tcp_bind,qemu_spice_resolution,qemu_spice_flags,spice_password,soundhw,debug_engine,vm_iso_path2,vm_zfs_guid,vnc_port,qemu_hap,qemu_nestedhvm,vm_iso_path,bios,machine,machine_accel,vga,usb,tablet,xhci,boot_delay,arch,kernel,cpu FROM settings ORDER BY (created) DESC LIMIT 1;" )
140+
A=$( cbsdsqlro ${jailsysdir}/${jname}/local.sqlite "SELECT astart,vm_cpus,vm_ram,vm_os_type,vm_boot,vm_os_profile,vm_vnc_port,qemu_vnc_tcp_bind,qemu_vnc_resolution,cd_vnc_wait,protected,hidden,maintenance,ip4_addr,vnc_password,on_poweroff,on_reboot,on_crash,spice_default,vm_spice_port,qemu_spice_tcp_bind,qemu_spice_resolution,qemu_spice_flags,spice_password,soundhw,debug_engine,vm_iso_path2,vm_zfs_guid,vnc_port,qemu_hap,qemu_nestedhvm,vm_iso_path,bios,machine,machine_accel,vga,usb,tablet,xhci,boot_delay,arch,kernel,cpu,nographic FROM settings ORDER BY (created) DESC LIMIT 1;" )
141141
if [ -n "${A}" ]; then
142142
OIFS="${IFS}"
143143
IFS="|"
@@ -184,7 +184,8 @@ init_qemu_rcconf()
184184
arch=
185185
kernel=
186186
cpu=
187-
sqllist "${A}" astart vm_cpus vm_ram vm_os_type vm_boot vm_os_profile vm_vnc_port qemu_vnc_tcp_bind qemu_vnc_resolution cd_vnc_wait protected hidden maintenance ip4_addr vnc_password on_poweroff on_reboot on_crash spice_default vm_spice_port qemu_spice_tcp_bind qemu_spice_resolution qemu_spice_flags spice_password soundhw debug_engine vm_iso_path2 vm_zfs_guid vnc_port qemu_hap qemu_nestedhvm vm_iso_path bios machine machine_accel vga usb tablet xhci boot_delay arch kernel cpu
187+
nographic=
188+
sqllist "${A}" astart vm_cpus vm_ram vm_os_type vm_boot vm_os_profile vm_vnc_port qemu_vnc_tcp_bind qemu_vnc_resolution cd_vnc_wait protected hidden maintenance ip4_addr vnc_password on_poweroff on_reboot on_crash spice_default vm_spice_port qemu_spice_tcp_bind qemu_spice_resolution qemu_spice_flags spice_password soundhw debug_engine vm_iso_path2 vm_zfs_guid vnc_port qemu_hap qemu_nestedhvm vm_iso_path bios machine machine_accel vga usb tablet xhci boot_delay arch kernel cpu nographic
188189
IFS="${OIFS}"
189190
else
190191
err 1 "${N1_COLOR}Unable to fetch vm data from: ${N2_COLOR}${jailsysdir}/${jname}/local.sqlite${N0_COLOR}"

0 commit comments

Comments
 (0)