一些更新

This commit is contained in:
mofeng-git 2024-06-10 14:47:14 +08:00
parent ab3bb95bdb
commit b8b6dff995
9 changed files with 110 additions and 150 deletions

View File

@ -1,5 +1,6 @@
更新日志
- V0.56[Build-Armbian]回退5.9内核版本V0.52目前运行最稳定的内核版本支持docker;此前高内核的累积更新
- V0.57: [build]mac固定第一次启动时随机生成解决armbain源因密钥无法使用解决sd启动配置问题
- V0.56[Build-Armbian]回退5.9内核版本V0.52目前运行最稳定的内核版本支持docker;此前高内核的累积更新
- V0.55: [build]使用lanlan Uboot通电按重置键可进入线刷模式HDM可用WIFI模块已编译预装armbian-config实用工具Webterm和VNC修复tighervnc存在兼容问题可尝试使用uvnc viewer添加状态信息显示
- V0.54: [build]内核切换至xdarklight/linux/tree/meson-mx-integration-6.7-20231221系统运行更加稳定包含armbian-config等实用工具
- V0.53: [build]修复高内核OTG拔插内核崩溃问题切换至更新的Linux内核6.6.15-current-meson去除线刷镜像分区校验

View File

@ -4,36 +4,44 @@
### 介绍
One-KVM是基于玩客云硬件和PiKVM软件的远控设备。通过移植PiKVM该软件至玩客云设备上实现了极高的性价比不到百元功能即可接近甚至超越部分昂贵的商业设备
One-KVM是基于经济计算机硬件目前为玩客云和X64兼容机和PiKVM软件的硬件级远程控制项目。KVM over IP可以远程管理服务器或工作站实现无侵入式控制无论被控机为什么操作系统或是否安装了操作系统具有更广泛的适用性。此项目基于 [PiKVM](https://github.com/pikvm/pikvm),和基于远控软件的远程管理方式不同,无需在被控电脑安装任何软件,实现无侵入式控制
该软件可以帮助用户通过得到控制设备的HDMI 画面和鼠标键盘去远程管理服务器、工作站或个人PC等。 和基于软件的远程管理方式不同,无需在被控电脑安装任何软件,实现无侵入式控制。
该项目基于PiKVM提供了玩客云兼容PiKVM操作的自动处理脚本。
![image](https://github.com/mofeng-git/One-KVM/assets/62919083/ec7e049f-ca6c-426f-bfa4-314536965db0)
**功能特性**
![image](https://github.com/mofeng-git/One-KVM/assets/62919083/b160c03b-31c5-465b-b9f8-acf421a35f79)
主要功能比较TinyPilot 社区版本、PiKVMv3版本出现在这里仅做比较目的。
| 功能 | One-KVM | TinyPilot 社区版本 | PiKVMv3版本 |
| :------------: | :---------------------: | :----------------: | :----------: |
| HTML5界面语言 | 简体中文 | 英文 | 英文 |
| BIOS控制 | √ | √ | √ |
| 视频捕捉 | √ | √ | √ |
| 音频捕捉 | × | √ | √ |
| 鼠键捕获类型 | OTG CH9329 | OTG | OTG CH9329 |
| 从剪贴板粘贴 | √ | √ | √ |
| OCR识别 | √ | × | √ |
| LAN唤醒 | √ | × | √ |
| VNC支持 | √ | × | √ |
| HDMI环出 | √含HDMI设备初步支持 | × | × |
| 虚拟存储驱动器 | √仅含OTG设备支持 | × | √ |
| ATX开关机 | √仅含GPIO设备支持 | × | √ |
| 板载WiFi | × | √ | √ |
| 视频流格式 | MJPEG H.264(软编码) | MJPEG, H.264 | MJPEG, H.264 |
| 最大视频分辨率 | 1920x1080 | 1920x1080 | 1920x1080 |
### 快速开始
**方式一直刷One-KVM镜像**
本项目Releases页可以找到包含PiKVM的预编译镜像内核版本为5.9.0-rc7。镜像名称带One-KVM前缀、burn后缀的为线刷镜像可使用USB_Burning_Tool软件线刷至玩客云。预编译线刷镜像为开箱即用刷好后启动设备就可以开始使用One-KVM。
对于玩客云设备本项目Releases页可以找到适配玩客云的One-KVM预编译镜像。镜像名称带One-KVM前缀、burn后缀的为线刷镜像可使用USB_Burning_Tool软件线刷至玩客云。预编译线刷镜像为开箱即用刷好后启动设备就可以开始使用One-KVM。
**方式二One-KVM脚本安装**
一键脚本对于非玩客云设备安装未作测试适用于玩客云Armbian Jammy系统。
一键脚本适用于玩客云Armbian Jammy系统。更多系统正在适配中。
```bash
git clone https://github.com/mofeng-git/One-KVM.git
cd One-KVM && ./install.sh
#对于大陆网络环境,可以尝试使用下命令
wget https://mirror.ghproxy.com/https://github.com/mofeng-git/One-KVM/archive/refs/heads/main.zip -o One-KVM-main.zip && unzip One-KVM-main.zip
cd One-KVM-main && ./install.sh
```
**方式三docker镜像部署**
@ -43,7 +51,7 @@ cd One-KVM-main && ./install.sh
docker run -itd -p443:443 -p80:80 --name pikvm-docker --device=/dev/ttyUSB0:/dev/kvmd-hid --device=/dev/video0:/dev/kvmd-video pikvm-ch9329:0.61
```
详细内容可以参照飞书文档:[One-KVM使用文档](https://p1b237lu9xm.feishu.cn/drive/folder/IsOifWmMKlzYpRdWfcocI7jdnQA?from=from_copylink)
详细内容可以参照[One-KVM文档](https://one-kvm.mofeng.run/)。
### 其他

View File

@ -11,60 +11,23 @@ FIND_STR="short_press_gpio420"
check-environment(){
echo -e "\e[0;32m设备名称$MACHINE\nPython版本$PYVER"
if [ ! $ARCH = "armv7l" ]; then
echo -e "\e[0;31m暂不支持$MACHINE架构以外的设备\n退出脚本"
echo -e "\e[0;31m此脚本暂不支持armv7l架构以外的设备\n退出脚本"
exit
fi
if [[ "$PYVER" != *"3.10"* && $(which python3.10) != *"python"* ]]; then
echo -e "您似乎没有安装 Python 3.10\n退出脚本\e[0;37m"
exit
else
update-alternative
fi
}
#使用Python3.10版本
update-alternative(){
counter=2
for i in {1..9}
do
bindir=$(which python3.$i)
if [[ $bindir == *"bin"* ]]; then
echo $i $bindir
update-alternatives --install /usr/bin/python3 python3 $bindir $counter
let counter++
fi
done
update-alternatives --install /usr/bin/python3 python3 $(which python3.10) 1
update-alternatives --set python3 $(which python3.10)
}
#修改设备树文件
change-device-tree(){
cp -f ./patch/meson8b-onecloud.dtb /boot/dtb/meson8b-onecloud.dtb
echo "设备树文件覆盖成功!"
}
#覆盖引导分区
override-uboot(){
echo -e "\e[0;31m玩客云默认启用USB线刷检测是否保存原样\e[1;32mY保持原样/N关闭此功能"
read USERYN
case $USERYN in
N | n)
gzip -dc ./patch/Boot_SkipUSBBurning.gz | dd of=/dev/mmcblk1
echo -e "\e[0;30m覆盖引导成功\e[0;37m"
;;
*)
echo -e "\e[0;30m已跳过覆盖UBoot分区\e[0;37m"
;;
esac
}
#安装依赖软件
install-dependencies(){
bash <(curl -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh) --source mirrors.tuna.tsinghua.edu.cn --updata-software false --web-protocol http && echo "换源成功!"
echo -e "\e[0;32m正在安装依赖软件python3.10 patch iptables nginx tesseract-ocr tesseract-ocr-eng janus libevent-dev libgpiod-dev tesseract-ocr-chi-sim libjpeg-dev libfreetype6-dev......"
apt install -y python3.10 python3-pip python3-dev patch iptables nginx tesseract-ocr tesseract-ocr-eng janus libevent-dev libgpiod-dev tesseract-ocr-chi-sim libjpeg-dev libfreetype6-dev armbian-config
echo -e "\e[0;32m正在安装依赖软件p......"
apt install -y python3.10 python3-pip python3-dev patch iptables nginx \
tesseract-ocr tesseract-ocr-eng janus libevent-dev libgpiod-dev \
tesseract-ocr-chi-sim libjpeg-dev libfreetype6-dev
}
#安装PiKVM
@ -77,9 +40,9 @@ install-pikvm(){
#rm -f /lib/systemd/system/kvmd-janus.service && systemctl daemon-reload
echo "PiKVM安装成功"
cd $CURRENTWD
cp -f ./patch/long_press_gpio420 /usr/bin && cp -f ./patch/short_press_gpio420 /usr/bin
chmod +x /usr/bin/long_press_gpio420 && chmod +x /usr/bin/short_press_gpio420
echo "GPIO-420脚本移动成功!"
cp -f ./patch/onecloud_gpio.sh /usr/bin
chmod +x /usr/bin/onecloud_gpio.sh
echo "GPIO脚本移动成功!"
cp -f ./patch/hw.py /usr/local/lib/python3.10/kvmd-packages/kvmd/apps/kvmd/info/
chmod +x /usr/local/lib/python3.10/kvmd-packages/kvmd/apps/kvmd/info/hw.py
cp -f ./config/main.yaml /etc/kvmd/ && cp -f ./config/override.yaml /etc/kvmd/
@ -90,7 +53,7 @@ install-pikvm(){
#应用补丁
add-patches(){
if [ ! -f `grep -c "$FIND_STR" $FIND_FILE` ]; then
echo kvmd ALL=\(ALL\) NOPASSWD: /usr/bin/long_press_gpio420,/usr/bin/short_press_gpio420 >> /etc/sudoers
echo kvmd ALL=\(ALL\) NOPASSWD: /usr/bin/onecloud_gpio.sh >> /etc/sudoers
fi
if [ ! -f "/usr/local/lib/python3.10/kvmd-packages/3.198msd.patch" ]; then
@ -117,15 +80,12 @@ fix-motd() {
if [ -e /etc/update-motd.d/10-armbian-header ]; then /etc/update-motd.d/10-armbian-header; fi
if [ -e /etc/update-motd.d/30-armbian-sysinfo ]; then /etc/update-motd.d/30-armbian-sysinfo; fi
printf " Welcome to One-KVM - Open Source IP-KVM installed on onecloud board
printf " 欢迎使用 One-KVM - 基于开源程序PiKVM的IP-KVM 应用
____________________________________________________________________________
To prevent kernel messages from printing to the terminal use \"dmesg -n 1\".
要修改默认账户admin密码可使用 \"kvmd-htpasswd set admin\"
To change KVM password use command \"kvmd-htpasswd set admin\".
Useful links:
* https://pikvm.org
帮助链接:
* https://docs.pikvm.org
* https://github.com/mofeng-git/One-KVM
@ -139,79 +99,11 @@ EOF
show-info(){
ipaddr=`ip addr | grep "scope global" | awk '{print $2}' |awk -F/ '{print $1}'`
echo -e "\e[0;32m内网访问地址为\nhttp://$ipaddr\nhttps://$ipaddr"
echo "机器已重启等待10秒然后拔插电源One-KVM就安装完成了"
}
#配置H.264功能
kvmd-ffmpeg-h-264(){
echo "正在配置H.264功能..."
cd $CURRENTWD
apt install -y ffmpeg
#写入ffmpeg转码推流文件和janus streaming配置文件
cp -r /etc/kvmd/janus /etc/kvmd/janus2
rm /etc/kvmd/janus2/janus.plugin.ustreamer.jcfg
cat > /etc/kvmd/janus2/janus.plugin.streaming.jcfg << EOF
kvmd-ffmpeg: {
type = "rtp"
id = 1
description = "H.264 live stream coming from ustreamer"
audio = false
video = true
videoport = 5004
videopt = 96
videocodec = "h264"
videofmtp = "profile-level-id=42e01f;packetization-mode=1"
videortpmap = "H264/90000"
}
EOF
cat > /lib/systemd/system/kvmd-ffmpeg.service << EOF
[Unit]
Description=PiKVM - Transcode (Static Config)
After=network.target network-online.target nss-lookup.target kvmd.service
[Service]
User=kvmd
Group=kvmd
Type=simple
Restart=on-failure
RestartSec=3
AmbientCapabilities=CAP_NET_RAW
LimitNOFILE=65536
UMask=0117
ExecStart=/usr/share/kvmd/stream_when_ustream_exists.sh
TimeoutStopSec=10
KillMode=mixed
[Install]
WantedBy=multi-user.target
EOF
#修改原有kvmd代码和配置文件
sed -i '17s/.*/ExecStart=\/usr\/bin\/janus --disable-colors --configs-folder=\/etc\/kvmd\/janus2/' /lib/systemd/system/kvmd-janus-static.service
sed -i 's/janus.plugin.ustreamer/janus.plugin.streaming/' /usr/share/kvmd/web/share/js/kvm/stream_janus.js
sed -i '293c \/\/' /usr/share/kvmd/web/share/js/kvm/stream_janus.js
sed -i 's/request\": \"watch\", \"p/request\": \"watch\", \"id\" : 1, \"p/' /usr/share/kvmd/web/share/js/kvm/stream_janus.js
#补全网页JS文件并添加相应脚本
mkdir /usr/share/janus/javascript/ && cp -f ./web/adapter.js /usr/share/janus/javascript/ && cp -f ./web/janus.js /usr/share/janus/javascript/
cp -f ./patch/stream.sh /usr/share/kvmd/ && cp -f ./patch/stream_when_ustream_exists.sh /usr/share/kvmd/ && chmod +x /usr/share/kvmd/stream.sh /usr/share/kvmd/stream_when_ustream_exists.sh
#启动服务
#systemctl enable kvmd-ffmpeg && systemctl enable kvmd-janus-static
#systemctl start kvmd-ffmpeg && systemctl start kvmd-janus-static
}
check-environment
#Only for onecloud Armbian with kernel 5.10,now this these two steps is deprecated!
#override-uboot
#change-device-tree
install-dependencies
install-pikvm
add-patches
fix-motd
#H.264 soft encoded video, default off, uncomment if needed
#kvmd-ffmpeg-h-264
show-info
reboot
show-info

60
kvmd-h264_install.sh Normal file
View File

@ -0,0 +1,60 @@
#!/bin/bash
#配置H.264功能
kvmd-ffmpeg-h-264(){
echo "正在配置H.264功能..."
cd $CURRENTWD
apt install -y ffmpeg
#写入ffmpeg转码推流文件和janus streaming配置文件
cp -r /etc/kvmd/janus /etc/kvmd/janus2
rm /etc/kvmd/janus2/janus.plugin.ustreamer.jcfg
cat > /etc/kvmd/janus2/janus.plugin.streaming.jcfg << EOF
kvmd-ffmpeg: {
type = "rtp"
id = 1
description = "H.264 live stream coming from ustreamer"
audio = false
video = true
videoport = 5004
videopt = 96
videocodec = "h264"
videofmtp = "profile-level-id=42e01f;packetization-mode=1"
videortpmap = "H264/90000"
}
EOF
cat > /lib/systemd/system/kvmd-ffmpeg.service << EOF
[Unit]
Description=PiKVM - Transcode (Static Config)
After=network.target network-online.target nss-lookup.target kvmd.service
[Service]
User=kvmd
Group=kvmd
Type=simple
Restart=on-failure
RestartSec=3
AmbientCapabilities=CAP_NET_RAW
LimitNOFILE=65536
UMask=0117
ExecStart=/usr/share/kvmd/stream_when_ustream_exists.sh
TimeoutStopSec=10
KillMode=mixed
[Install]
WantedBy=multi-user.target
EOF
#修改原有kvmd代码和配置文件
sed -i '17s/.*/ExecStart=\/usr\/bin\/janus --disable-colors --configs-folder=\/etc\/kvmd\/janus2/' /lib/systemd/system/kvmd-janus-static.service
sed -i 's/janus.plugin.ustreamer/janus.plugin.streaming/' /usr/share/kvmd/web/share/js/kvm/stream_janus.js
sed -i '293c \/\/' /usr/share/kvmd/web/share/js/kvm/stream_janus.js
sed -i 's/request\": \"watch\", \"p/request\": \"watch\", \"id\" : 1, \"p/' /usr/share/kvmd/web/share/js/kvm/stream_janus.js
#补全网页JS文件并添加相应脚本
mkdir /usr/share/janus/javascript/ && cp -f ./web/adapter.js /usr/share/janus/javascript/ && cp -f ./web/janus.js /usr/share/janus/javascript/
cp -f ./patch/stream.sh /usr/share/kvmd/ && cp -f ./patch/stream_when_ustream_exists.sh /usr/share/kvmd/ && chmod +x /usr/share/kvmd/stream.sh /usr/share/kvmd/stream_when_ustream_exists.sh
#启动服务
systemctl enable kvmd-ffmpeg && systemctl enable kvmd-janus-static
systemctl start kvmd-ffmpeg && systemctl start kvmd-janus-static
}
kvmd-ffmpeg-h-264

Binary file not shown.

View File

@ -1,7 +0,0 @@
#!/bin/bash
echo 420 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio420/direction
echo 0 > /sys/class/gpio/gpio420/value
sleep 5
echo 1 > /sys/class/gpio/gpio420/value
echo 420 > /sys/class/gpio/unexport

Binary file not shown.

13
patch/onecloud_gpio.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
case $1 in
short)
gpioset -m time -s 1 gpiochip1 7=0
gpioset gpiochip1 7=1
;;
long)
gpioset -m time -s 5 gpiochip1 7=0
gpioset gpiochip1 7=1
;;
*)
echo "No thing."
esac

View File

@ -1,7 +0,0 @@
#!/bin/bash
echo 420 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio420/direction
echo 0 > /sys/class/gpio/gpio420/value
sleep 0.5
echo 1 > /sys/class/gpio/gpio420/value
echo 420 > /sys/class/gpio/unexport