summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-02-16 21:16:53 +0300
committerDevaev Maxim <[email protected]>2019-02-16 21:16:53 +0300
commit303715ee613fca518644df63c10be3c06d4bfa72 (patch)
tree05fa4600ba5873827e0d2871f6e6c2a702f7472d
parent7d79f48fd87083ffe38158fc456cad4737ab0242 (diff)
os configs
-rw-r--r--Makefile2
-rw-r--r--PKGBUILD4
-rw-r--r--configs/kvmd/main/v1-hdmi.yaml (renamed from configs/kvmd/platforms/kvmd.v1-hdmi.yaml)0
-rw-r--r--configs/kvmd/main/v1-vga.yaml (renamed from configs/kvmd/platforms/kvmd.v1-vga.yaml)0
-rw-r--r--configs/os/boot-config/v1-hdmi-rpi2.txt9
-rw-r--r--configs/os/boot-config/v1-hdmi-rpi3.txt10
-rw-r--r--configs/os/boot-config/v1-vga-rpi2.txt7
-rw-r--r--configs/os/boot-config/v1-vga-rpi3.txt8
-rw-r--r--configs/os/cmdline/v1-hdmi.sed3
-rw-r--r--configs/os/cmdline/v1-vga.sed2
-rw-r--r--configs/os/modules-load/v1-hdmi.conf1
-rw-r--r--configs/os/sysctl.conf3
-rw-r--r--configs/os/systemd/kvmd-tc358743.service (renamed from configs/systemd/kvmd-tc358743.service)0
-rw-r--r--configs/os/systemd/kvmd.service (renamed from configs/systemd/kvmd.service)4
-rw-r--r--configs/os/udev/v1-hdmi-rpi2.rules5
-rw-r--r--configs/os/udev/v1-hdmi-rpi3.rules5
-rw-r--r--configs/os/udev/v1-vga-rpi2.rules5
-rw-r--r--configs/os/udev/v1-vga-rpi3.rules5
-rw-r--r--kvmd/apps/__init__.py2
-rw-r--r--testenv/main.yaml (renamed from testenv/kvmd.yaml)0
20 files changed, 69 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 7fc2a423..f7baf2f5 100644
--- a/Makefile
+++ b/Makefile
@@ -85,7 +85,7 @@ _run: _testenv
&& cp -r /usr/share/kvmd/configs.default/nginx/* /etc/nginx \
&& cp /usr/share/kvmd/configs.default/kvmd/*.yaml /etc/kvmd \
&& cp /usr/share/kvmd/configs.default/kvmd/htpasswd /etc/kvmd \
- && cp /testenv/kvmd.yaml /etc/kvmd \
+ && cp /testenv/main.yaml /etc/kvmd \
&& nginx -c /etc/nginx/nginx.conf \
&& ln -s $(TESTENV_VIDEO) /dev/kvmd-video \
&& (losetup -d /dev/kvmd-msd || true) \
diff --git a/PKGBUILD b/PKGBUILD
index bb9f4ef9..dbedbd75 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -43,13 +43,13 @@ package() {
python setup.py install --root="$pkgdir"
mkdir -p "$pkgdir/usr/lib/systemd/system"
- cp configs/systemd/*.service "$pkgdir/usr/lib/systemd/system"
+ cp configs/os/systemd/*.service "$pkgdir/usr/lib/systemd/system"
mkdir -p "$pkgdir/usr/share/kvmd"
cp -r web "$pkgdir/usr/share/kvmd"
cp -r extras "$pkgdir/usr/share/kvmd"
cp -r configs "$pkgdir/usr/share/kvmd/configs.default"
- rm -rf "$pkgdir/usr/share/kvmd/configs.default/systemd"
+ rm -rf "$pkgdir/usr/share/kvmd/configs.default/os/systemd"
sed -i -e "s/^#PROD//g" "$pkgdir/usr/share/kvmd/configs.default/nginx/nginx.conf"
find "$pkgdir" -name ".gitignore" -delete
find "$pkgdir/usr/share/kvmd/configs.default" -type f -exec chmod 444 '{}' \;
diff --git a/configs/kvmd/platforms/kvmd.v1-hdmi.yaml b/configs/kvmd/main/v1-hdmi.yaml
index ed5edb7d..ed5edb7d 100644
--- a/configs/kvmd/platforms/kvmd.v1-hdmi.yaml
+++ b/configs/kvmd/main/v1-hdmi.yaml
diff --git a/configs/kvmd/platforms/kvmd.v1-vga.yaml b/configs/kvmd/main/v1-vga.yaml
index 8cb931b5..8cb931b5 100644
--- a/configs/kvmd/platforms/kvmd.v1-vga.yaml
+++ b/configs/kvmd/main/v1-vga.yaml
diff --git a/configs/os/boot-config/v1-hdmi-rpi2.txt b/configs/os/boot-config/v1-hdmi-rpi2.txt
new file mode 100644
index 00000000..6bf6cf12
--- /dev/null
+++ b/configs/os/boot-config/v1-hdmi-rpi2.txt
@@ -0,0 +1,9 @@
+# See /boot/overlays/README for all available options
+initramfs initramfs-linux.img followkernel
+
+hdmi_force_hotplug=1
+gpu_mem=256
+start_x=1
+enable_uart=1
+dtoverlay=tc358743,i2c_pins_28_29=1
+dtparam=act_led_gpio=26
diff --git a/configs/os/boot-config/v1-hdmi-rpi3.txt b/configs/os/boot-config/v1-hdmi-rpi3.txt
new file mode 100644
index 00000000..fa86f60b
--- /dev/null
+++ b/configs/os/boot-config/v1-hdmi-rpi3.txt
@@ -0,0 +1,10 @@
+# See /boot/overlays/README for all available options
+initramfs initramfs-linux.img followkernel
+
+hdmi_force_hotplug=1
+gpu_mem=256
+start_x=1
+enable_uart=1
+dtoverlay=tc358743
+dtparam=act_led_gpio=26
+dtoverlay=pi3-disable-bt
diff --git a/configs/os/boot-config/v1-vga-rpi2.txt b/configs/os/boot-config/v1-vga-rpi2.txt
new file mode 100644
index 00000000..84053d2c
--- /dev/null
+++ b/configs/os/boot-config/v1-vga-rpi2.txt
@@ -0,0 +1,7 @@
+# See /boot/overlays/README for all available options
+initramfs initramfs-linux.img followkernel
+
+hdmi_force_hotplug=1
+gpu_mem=16
+dtparam=act_led_gpio=26
+enable_uart=1
diff --git a/configs/os/boot-config/v1-vga-rpi3.txt b/configs/os/boot-config/v1-vga-rpi3.txt
new file mode 100644
index 00000000..f444aba9
--- /dev/null
+++ b/configs/os/boot-config/v1-vga-rpi3.txt
@@ -0,0 +1,8 @@
+# See /boot/overlays/README for all available options
+initramfs initramfs-linux.img followkernel
+
+hdmi_force_hotplug=1
+gpu_mem=16
+dtparam=act_led_gpio=26
+enable_uart=1
+dtoverlay=pi3-disable-bt
diff --git a/configs/os/cmdline/v1-hdmi.sed b/configs/os/cmdline/v1-hdmi.sed
new file mode 100644
index 00000000..b3614eb0
--- /dev/null
+++ b/configs/os/cmdline/v1-hdmi.sed
@@ -0,0 +1,3 @@
+s/console=ttyAMA0\,115200//g
+s/kgdboc=ttyAMA0\,115200//g
+s/rootwait/cma=128M rootwait/g
diff --git a/configs/os/cmdline/v1-vga.sed b/configs/os/cmdline/v1-vga.sed
new file mode 100644
index 00000000..57f42700
--- /dev/null
+++ b/configs/os/cmdline/v1-vga.sed
@@ -0,0 +1,2 @@
+s/console=ttyAMA0\,115200//g
+s/kgdboc=ttyAMA0\,115200//g
diff --git a/configs/os/modules-load/v1-hdmi.conf b/configs/os/modules-load/v1-hdmi.conf
new file mode 100644
index 00000000..5be25408
--- /dev/null
+++ b/configs/os/modules-load/v1-hdmi.conf
@@ -0,0 +1 @@
+tc358743
diff --git a/configs/os/sysctl.conf b/configs/os/sysctl.conf
new file mode 100644
index 00000000..71db0efc
--- /dev/null
+++ b/configs/os/sysctl.conf
@@ -0,0 +1,3 @@
+# https://github.com/raspberrypi/linux/issues/1753
+vm.dirty_background_bytes = 5
+vm.dirty_writeback_centisecs = 25
diff --git a/configs/systemd/kvmd-tc358743.service b/configs/os/systemd/kvmd-tc358743.service
index 44d26d1a..44d26d1a 100644
--- a/configs/systemd/kvmd-tc358743.service
+++ b/configs/os/systemd/kvmd-tc358743.service
diff --git a/configs/systemd/kvmd.service b/configs/os/systemd/kvmd.service
index 5427d4c9..eaab01aa 100644
--- a/configs/systemd/kvmd.service
+++ b/configs/os/systemd/kvmd.service
@@ -9,8 +9,8 @@ Type=simple
Restart=always
RestartSec=3
-ExecStart=/usr/bin/kvmd --config /etc/kvmd/kvmd.yaml
-ExecStopPost=/usr/bin/kvmd-cleanup --config /etc/kvmd/kvmd.yaml
+ExecStart=/usr/bin/kvmd
+ExecStopPost=/usr/bin/kvmd-cleanup
[Install]
WantedBy=multi-user.target
diff --git a/configs/os/udev/v1-hdmi-rpi2.rules b/configs/os/udev/v1-hdmi-rpi2.rules
new file mode 100644
index 00000000..77e5aafd
--- /dev/null
+++ b/configs/os/udev/v1-hdmi-rpi2.rules
@@ -0,0 +1,5 @@
+# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
+# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
+KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", KERNELS=="3f801000.csi1", GROUP="kvmd", SYMLINK+="kvmd-video"
+KERNEL=="sd[a-z]", SUBSYSTEM=="block", KERNELS=="1-1.4:1.0", GROUP="kvmd", SYMLINK+="kvmd-msd"
+KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
diff --git a/configs/os/udev/v1-hdmi-rpi3.rules b/configs/os/udev/v1-hdmi-rpi3.rules
new file mode 100644
index 00000000..dedbf164
--- /dev/null
+++ b/configs/os/udev/v1-hdmi-rpi3.rules
@@ -0,0 +1,5 @@
+# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
+# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
+KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", KERNELS=="3f801000.csi1", GROUP="kvmd", SYMLINK+="kvmd-video"
+KERNEL=="sd[a-z]", SUBSYSTEM=="block", KERNELS=="1-1.1.2:1.0", GROUP="kvmd", SYMLINK+="kvmd-msd"
+KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
diff --git a/configs/os/udev/v1-vga-rpi2.rules b/configs/os/udev/v1-vga-rpi2.rules
new file mode 100644
index 00000000..a3c67123
--- /dev/null
+++ b/configs/os/udev/v1-vga-rpi2.rules
@@ -0,0 +1,5 @@
+# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
+# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
+KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", KERNELS=="1-1.3:1.0", GROUP="kvmd", SYMLINK+="kvmd-video"
+KERNEL=="sd[a-z]", SUBSYSTEM=="block", KERNELS=="1-1.4:1.0", GROUP="kvmd", SYMLINK+="kvmd-msd"
+KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
diff --git a/configs/os/udev/v1-vga-rpi3.rules b/configs/os/udev/v1-vga-rpi3.rules
new file mode 100644
index 00000000..c8e8f950
--- /dev/null
+++ b/configs/os/udev/v1-vga-rpi3.rules
@@ -0,0 +1,5 @@
+# https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name
+# https://wiki.archlinux.org/index.php/Udev#Setting_static_device_names
+KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", KERNELS=="1-1.1.3:1.0", GROUP="kvmd", SYMLINK+="kvmd-video"
+KERNEL=="sd[a-z]", SUBSYSTEM=="block", KERNELS=="1-1.1.2:1.0", GROUP="kvmd", SYMLINK+="kvmd-msd"
+KERNEL=="ttyAMA0", SYMLINK+="kvmd-hid"
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py
index fa10b948..73524cfb 100644
--- a/kvmd/apps/__init__.py
+++ b/kvmd/apps/__init__.py
@@ -31,7 +31,7 @@ def init(
) -> Tuple[argparse.ArgumentParser, List[str], Section]:
args_parser = argparse.ArgumentParser(prog=prog, description=description, add_help=add_help)
- args_parser.add_argument("-c", "--config", dest="config_path", default="/etc/kvmd/kvmd.yaml", metavar="<file>",
+ args_parser.add_argument("-c", "--config", dest="config_path", default="/etc/kvmd/main.yaml", metavar="<file>",
help="Set config file path")
args_parser.add_argument("-o", "--set-options", dest="set_options", default=[], nargs="+",
help="Override config options list (like sec/sub/opt=value)")
diff --git a/testenv/kvmd.yaml b/testenv/main.yaml
index 994d1c0b..994d1c0b 100644
--- a/testenv/kvmd.yaml
+++ b/testenv/main.yaml