mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-30 17:41:54 +08:00
v2 beta
This commit is contained in:
21
os/Makefile
21
os/Makefile
@@ -9,7 +9,12 @@ WEBUI_ADMIN_PASSWD ?= admin
|
||||
|
||||
# =====
|
||||
_BUILD_DIR = ./.build
|
||||
_KVMD_VERSION = $(shell bash -c 'source ../kvmd/PKGBUILD; echo $$pkgver')
|
||||
|
||||
define fetch_version
|
||||
curl --silent "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=$(1)" \
|
||||
| grep "^pkgver=" \
|
||||
| grep -Po "\d+\.\d+[^\"']*"
|
||||
endef
|
||||
|
||||
|
||||
# =====
|
||||
@@ -21,24 +26,30 @@ v1:
|
||||
make _pikvm PIKVM_PLATFORM=v1 PI_BOARD=rpi-2
|
||||
|
||||
|
||||
v2:
|
||||
make _pikvm PIKVM_PLATFORM=v2 PI_BOARD=rpi-2
|
||||
|
||||
|
||||
shell:
|
||||
cd $(_BUILD_DIR) && make shell
|
||||
|
||||
|
||||
_pikvm: $(_BUILD_DIR)
|
||||
rm -rf $(_BUILD_DIR)/stages/pikvm
|
||||
rm -rf $(_BUILD_DIR)/stages/pikvm-*
|
||||
rm -rf $(_BUILD_DIR)/builder/scripts/pikvm
|
||||
cp -a platforms/$(PIKVM_PLATFORM) $(_BUILD_DIR)/stages/pikvm
|
||||
cp -a platforms/common $(_BUILD_DIR)/stages/pikvm-common
|
||||
cp -a platforms/$(PIKVM_PLATFORM) $(_BUILD_DIR)/stages/pikvm-$(PIKVM_PLATFORM)
|
||||
cd $(_BUILD_DIR) && make binfmt && make _rpi \
|
||||
BUILD_OPTS=" $(BUILD_OPTS) \
|
||||
--build-arg KVMD_VERSION=$(_KVMD_VERSION) \
|
||||
--build-arg USTREAMER_VERSION=$(call fetch_version, ustreamer) \
|
||||
--build-arg KVMD_VERSION=$(call fetch_version, kvmd) \
|
||||
--build-arg NEW_SSH_KEYGEN=$(shell uuidgen) \
|
||||
--build-arg WEBUI_ADMIN_PASSWD='$(WEBUI_ADMIN_PASSWD)' \
|
||||
--build-arg NEW_HTTPS_CERT=$(shell uuidgen) \
|
||||
" \
|
||||
PROJECT=pikvm \
|
||||
BOARD=$(PI_BOARD) \
|
||||
STAGES="__init__ os watchdog ro pikvm rootssh __cleanup__" \
|
||||
STAGES="__init__ os watchdog ro pikvm-common pikvm-$(PIKVM_PLATFORM) rootssh __cleanup__" \
|
||||
LOCALE=$(LOCALE) \
|
||||
TIMEZONE=$(TIMEZONE)
|
||||
|
||||
|
||||
51
os/platforms/common/Dockerfile.part
Normal file
51
os/platforms/common/Dockerfile.part
Normal file
@@ -0,0 +1,51 @@
|
||||
RUN pkg-install \
|
||||
nginx-mainline \
|
||||
apache-tools \
|
||||
raspberrypi-firmware \
|
||||
v4l-utils \
|
||||
python \
|
||||
python-raspberry-gpio \
|
||||
customizepkg
|
||||
RUN systemctl enable nginx
|
||||
|
||||
COPY stages/pikvm-common/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-ndk
|
||||
COPY stages/pikvm-common/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-lua
|
||||
RUN env MAKEPKGOPTS="--skipchecksums --skippgpcheck" pkg-install nginx-mainline-mod-lua
|
||||
|
||||
ARG USTREAMER_VERSION
|
||||
ENV USTREAMER_VERSION $USTREAMER_VERSION
|
||||
RUN echo $USTREAMER_VERSION
|
||||
RUN pkg-install ustreamer
|
||||
|
||||
ARG KVMD_VERSION
|
||||
ENV KVMD_VERSION $KVMD_VERSION
|
||||
RUN echo $KVMD_VERSION
|
||||
RUN pkg-install kvmd
|
||||
RUN systemctl enable kvmd
|
||||
|
||||
COPY stages/pikvm-common/sysctl.conf /etc/sysctl.d/99-pikvm.conf
|
||||
COPY stages/pikvm-common/motd /etc/
|
||||
|
||||
RUN sed -i -e "s/console=ttyAMA0\,115200//g" /boot/cmdline.txt \
|
||||
&& sed -i -e "s/kgdboc=ttyAMA0\,115200//g" /boot/cmdline.txt
|
||||
RUN systemctl mask serial-getty@ttyAMA0.service
|
||||
|
||||
RUN rm -rf /etc/nginx/* \
|
||||
&& cp /usr/share/kvmd/configs/nginx/* /etc/nginx/ \
|
||||
&& sed -i -e "s/^#PROD//g" /etc/nginx/nginx.conf
|
||||
|
||||
ARG WEBUI_ADMIN_PASSWD
|
||||
ENV WEBUI_ADMIN_PASSWD $WEBUI_ADMIN_PASSWD
|
||||
RUN echo "$WEBUI_ADMIN_PASSWD" | htpasswd -ci /etc/nginx/htpasswd admin
|
||||
|
||||
ARG NEW_HTTPS_CERT
|
||||
ENV NEW_HTTPS_CERT $NEW_HTTPS_CERT
|
||||
RUN echo $NEW_HTTPS_CERT
|
||||
RUN mkdir /etc/nginx/ssl \
|
||||
&& cd /etc/nginx/ssl \
|
||||
&& openssl req -new -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt -days 3650 \
|
||||
-subj "/C=RU/ST=Moscow/L=Moscow/O=Pi-KVM/OU=Pi-KVM/CN=localhost" \
|
||||
&& chmod 400 server.key \
|
||||
&& chmod 444 server.crt \
|
||||
&& chmod 750 /etc/nginx/ssl \
|
||||
&& chown -R root:http /etc/nginx/ssl
|
||||
@@ -1,48 +1,4 @@
|
||||
RUN pkg-install \
|
||||
nginx-mainline \
|
||||
apache-tools \
|
||||
mjpg-streamer \
|
||||
python \
|
||||
python-raspberry-gpio \
|
||||
customizepkg
|
||||
RUN systemctl enable nginx
|
||||
COPY stages/pikvm-v1/config.txt /boot/
|
||||
COPY stages/pikvm-v1/udev.rules /etc/udev/rules.d/pikvm.rules
|
||||
|
||||
COPY stages/pikvm/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-ndk
|
||||
COPY stages/pikvm/customizepkg.nginx /etc/customizepkg.d/nginx-mainline-mod-lua
|
||||
RUN env MAKEPKGOPTS="--skipchecksums --skippgpcheck" pkg-install nginx-mainline-mod-lua
|
||||
|
||||
ARG KVMD_VERSION
|
||||
ENV KVMD_VERSION $KVMD_VERSION
|
||||
RUN echo $KVMD_VERSION
|
||||
RUN pkg-install kvmd
|
||||
RUN systemctl enable kvmd
|
||||
|
||||
COPY stages/pikvm/config.txt /boot/
|
||||
COPY stages/pikvm/sysctl.conf /etc/sysctl.d/99-pikvm.conf
|
||||
COPY stages/pikvm/udev.rules /etc/udev/rules.d/pikvm.rules
|
||||
COPY stages/pikvm/motd /etc/
|
||||
|
||||
RUN sed -i -e "s/console=ttyAMA0\,115200//g" /boot/cmdline.txt \
|
||||
&& sed -i -e "s/kgdboc=ttyAMA0\,115200//g" /boot/cmdline.txt
|
||||
RUN systemctl mask serial-getty@ttyAMA0.service
|
||||
|
||||
RUN rm -rf /etc/nginx/* \
|
||||
&& cp /usr/share/kvmd/configs/nginx/* /etc/nginx/ \
|
||||
&& sed -i -e "s/^#PROD//g" /etc/nginx/nginx.conf
|
||||
RUN cp /usr/share/kvmd/configs/kvmd/v1.yaml /etc/kvmd.yaml
|
||||
|
||||
ARG WEBUI_ADMIN_PASSWD
|
||||
ENV WEBUI_ADMIN_PASSWD $WEBUI_ADMIN_PASSWD
|
||||
RUN echo "$WEBUI_ADMIN_PASSWD" | htpasswd -ci /etc/nginx/htpasswd admin
|
||||
|
||||
ARG NEW_HTTPS_CERT
|
||||
ENV NEW_HTTPS_CERT $NEW_HTTPS_CERT
|
||||
RUN echo $NEW_HTTPS_CERT
|
||||
RUN mkdir /etc/nginx/ssl \
|
||||
&& cd /etc/nginx/ssl \
|
||||
&& openssl req -new -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt -days 3650 \
|
||||
-subj "/C=RU/ST=Moscow/L=Moscow/O=Pi-KVM/OU=Pi-KVM/CN=localhost" \
|
||||
&& chmod 400 server.key \
|
||||
&& chmod 444 server.crt \
|
||||
&& chmod 750 /etc/nginx/ssl \
|
||||
&& chown -R root:http /etc/nginx/ssl
|
||||
|
||||
11
os/platforms/v2/Dockerfile.part
Normal file
11
os/platforms/v2/Dockerfile.part
Normal file
@@ -0,0 +1,11 @@
|
||||
RUN pkg-install \
|
||||
dkms \
|
||||
tc358743-dkms
|
||||
|
||||
RUN sed -i -e "s/rootwait/cma=128M rootwait/g" /boot/cmdline.txt
|
||||
|
||||
COPY stages/pikvm-v2/config.txt /boot/
|
||||
COPY stages/pikvm-v2/udev.rules /etc/udev/rules.d/pikvm.rules
|
||||
COPY stages/pikvm-v2/modules.load /etc/modules-load.d/pikvm.conf
|
||||
|
||||
RUN cp /usr/share/kvmd/configs/kvmd/v2.yaml /etc/kvmd.yaml
|
||||
5
os/platforms/v2/config.txt
Normal file
5
os/platforms/v2/config.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
gpu_mem=16
|
||||
start_x=1
|
||||
enable_uart=1
|
||||
dtoverlay=tc358743,i2c_pins_28_29=1
|
||||
dtparam=act_led_gpio=27
|
||||
1
os/platforms/v2/modules.load
Normal file
1
os/platforms/v2/modules.load
Normal file
@@ -0,0 +1 @@
|
||||
tc358743
|
||||
4
os/platforms/v2/udev.rules
Normal file
4
os/platforms/v2/udev.rules
Normal file
@@ -0,0 +1,4 @@
|
||||
# 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=="soc", SYMLINK+="kvmd-streamer"
|
||||
KERNEL=="sd[a-z]", SUBSYSTEM=="block", KERNELS=="1-1.4:1.0", SYMLINK+="kvmd-msd"
|
||||
Reference in New Issue
Block a user