-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We expose a new 'guivm' flavor. In order to enable this remote GuiVM, one has to enable Qubes services: - lightdm - guivm - guivm-vnc This is similar to `sys-gui-gpu` setup but here, `guivm-vnc` service add ExecStartPre and ExecStartPost to lightdm systemd service in order to configure Xorg server with dummyqbs driver and x11vnc server.
- Loading branch information
Showing
11 changed files
with
225 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Section "Module" | ||
Load "fb" | ||
EndSection | ||
|
||
Section "ServerLayout" | ||
Identifier "Default Layout" | ||
Screen 0 "Screen0" 0 0 | ||
EndSection | ||
|
||
Section "Device" | ||
Identifier "Videocard0" | ||
Driver "dummyqbs" | ||
VideoRam %MEM% | ||
Option "GUIDomID" "%GUI_DOMID%" | ||
EndSection | ||
|
||
Section "Monitor" | ||
Identifier "Monitor0" | ||
HorizSync %MIN_MAX_HSYNC% | ||
VertRefresh %MIN_MAX_VSYNC% | ||
%MODELINES% | ||
Option "PreferredMode" "QB1024x768" | ||
EndSection | ||
|
||
Section "Screen" | ||
Identifier "Screen0" | ||
Device "Videocard0" | ||
Monitor "Monitor0" | ||
DefaultDepth %DEPTH% | ||
SubSection "Display" | ||
Viewport 0 0 | ||
Depth %DEPTH% | ||
EndSubSection | ||
EndSection |
6 changes: 6 additions & 0 deletions
6
appvm-scripts/etc/systemd/system/lightdm.service.d/qubes-guivm-vnc.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[Unit] | ||
ConditionPathExists=/var/run/qubes-service/lightdm | ||
|
||
[Service] | ||
ExecStartPre=/usr/bin/qubes-run-x11vnc-pre | ||
ExecStartPost=/usr/bin/qubes-run-x11vnc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
# | ||
# The Qubes OS Project, http://www.qubes-os.org | ||
# | ||
# Copyright (C) 2021 Frédéric Pierret <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
# | ||
X11VNC=/usr/bin/x11vnc | ||
# WIP: Ensure to have the good set of x11vnc options. | ||
OPTIONS_VNC="-display :0 -auth /var/run/lightdm/root/\:0 -noxrecord -noxfixes -noxdamage -loop" | ||
|
||
$X11VNC $OPTIONS_VNC & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/bin/bash | ||
# | ||
# The Qubes OS Project, http://www.qubes-os.org | ||
# | ||
# Copyright (C) 2021 Frédéric Pierret <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
# | ||
# | ||
|
||
# Source Qubes library. | ||
# shellcheck disable=SC1091 | ||
. /usr/lib/qubes/init/functions | ||
|
||
array_min_max() { | ||
read -r -a array <<< "$@" | ||
max=${array[0]} | ||
min=${array[0]} | ||
|
||
for i in ${array[*]}; do | ||
(( i > max )) && max=$i | ||
(( i < min )) && min=$i | ||
done | ||
echo "$min"-"$max" | ||
} | ||
|
||
if qsvc guivm-vnc; then | ||
GUI_DOMID="$(qubesdb-read /qubes-gui-domain-xid 2>/dev/null)" | ||
MEM_MIN="$(qubesdb-read /qubes-gui-videoram-min 2>/dev/null)" | ||
MEM_OVERHEAD="$(qubesdb-read /qubes-gui-videoram-overhead 2>/dev/null)" | ||
: "${MEM_MIN:=0}" | ||
: "${MEM_OVERHEAD:=$((2560 * 1600 * 4 / 1024))}" | ||
|
||
MEM=$((MEM + MEM_OVERHEAD)) | ||
if [ $MEM -lt $MEM_MIN ]; then | ||
MEM=$MEM_MIN | ||
fi | ||
|
||
DUMMY_MAX_CLOCK=300 | ||
PREFERRED_HSYNC=50 | ||
DEPTH=24 | ||
|
||
HSYNC=() | ||
VSYNC=() | ||
MODELINES=() | ||
RESOLUTIONS="320x240 | ||
640x480 | ||
800x600 | ||
1024x768 | ||
1152x864 | ||
1280x1024 | ||
1400x1050 | ||
1600x1200 | ||
2048x1536 | ||
800x480 | ||
1366x768 | ||
1440x900 | ||
1600x1024 | ||
1680x1050 | ||
1920x1200 | ||
2560x1600 | ||
1280x720 | ||
1920x1080" | ||
|
||
for RES in ${RESOLUTIONS[*]}; | ||
do | ||
W=${RES%x*} | ||
H=${RES#*x} | ||
HTOTAL=$((W+3)) | ||
VTOTAL=$((H+3)) | ||
CLOCK=$((PREFERRED_HSYNC*HTOTAL/1000)) | ||
if [ $CLOCK -gt $DUMMY_MAX_CLOCK ]; then CLOCK=$DUMMY_MAX_CLOCK ; fi | ||
MODELINE="$CLOCK $W $((W+1)) $((W+2)) $HTOTAL $H $((H+1)) $((H+2)) $VTOTAL" | ||
|
||
HSYNC_START=$((CLOCK*1000/HTOTAL)) | ||
HSYNC_END=$((HSYNC_START+1)) | ||
|
||
VREFR_START=$((CLOCK*1000000/HTOTAL/VTOTAL)) | ||
VREFR_END=$((VREFR_START+1)) | ||
|
||
HSYNC+=("$HSYNC_START" "$HSYNC_END") | ||
VSYNC+=("$VREFR_START" "$VREFR_END") | ||
MODELINES+=(" Modeline \"QB$RES\" $MODELINE") | ||
done | ||
|
||
ALL_MODELINES="$(printf '%s\\n' "${MODELINES[@]}")" | ||
MIN_MAX_HSYNC="$(array_min_max "${HSYNC[@]}")" | ||
MIN_MAX_VSYNC="$(array_min_max "${VSYNC[@]}")" | ||
|
||
sed -e s/%MEM%/$MEM/ \ | ||
-e s/%GUI_DOMID%/"$GUI_DOMID"/ \ | ||
-e s/%DEPTH%/$DEPTH/ \ | ||
-e s/%MODELINES%/"$ALL_MODELINES"/ \ | ||
-e s/%MIN_MAX_HSYNC%/"$MIN_MAX_HSYNC"/ \ | ||
-e s/%MIN_MAX_VSYNC%/"$MIN_MAX_VSYNC"/ \ | ||
< /etc/X11/xorg-qubes-x11vnc.conf.template > /etc/X11/xorg.conf | ||
|
||
# 2**30 | ||
echo 1073741824 > /sys/module/xen_gntalloc/parameters/limit | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
usr/bin/qubes-run-x11vnc-pre | ||
usr/bin/qubes-run-x11vnc | ||
etc/X11/xorg-qubes-x11vnc.conf.template | ||
etc/systemd/system/lightdm.service.d/qubes-guivm-vnc.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters