mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-03-15 15:36:44 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffebd2b484 | ||
|
|
f4c1dbe56e | ||
|
|
09d72c4567 | ||
|
|
6ba888f37a | ||
|
|
1d03dac58d | ||
|
|
e0050d43a4 | ||
|
|
0c139adb77 | ||
|
|
a2f73543ed | ||
|
|
b4016cf8d8 | ||
|
|
ec8886608f |
12
ChangeLogs.txt
Normal file
12
ChangeLogs.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
更新日志
|
||||
- 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);去除线刷镜像分区校验
|
||||
- V0.52:[Build-Armbian]添加MSD内核补丁;完全使用hzyitc的uboot,减小boot分区从512M至128M,引导和分区表使用UUID,默认关闭线刷刷机;dtb切换为外围设备模式;led颜色修改,红色(UBoot)-紫色(内核)-绿色(完全启动);调整dts CPU频率和版本,添加H.264支持(来自群友 自.知 )
|
||||
- V0.51: [Build-Armbian]5.9内核构建,初步完成直刷镜像构建。
|
||||
- V0.5:通过锁定CPU频率修复ustreamer mjpeg视频流异常的问题;屏蔽主程序找不到温度传感器的报错;优化中文翻译;更新VNC依赖;优化安装流程。
|
||||
- V0.4:利用玩客云自动GPIO实现ATX开关机物理控制功能;初步建立飞书使用文档;制作一键安装脚本,优化安装流程。
|
||||
- V0.3:添加简体中文补丁;实现MSD功能在EMMC和TF卡上的使用;添加WOL和中文OCR功能;优化了安装流程。
|
||||
- V0.2:通过替换系统解决OTG拔插死机问题;初步实现MSD功能;修改启动分区解决开机卡线刷检测;优化安装流程。
|
||||
- V0.1:PiKVM在玩客云上初步运行。
|
||||
76
README.md
76
README.md
@@ -1,46 +1,82 @@
|
||||
<h3 align=center><img src="https://github.com/mofeng-git/Build-Armbian/assets/62919083/add9743a-0987-4e8a-b2cb-62121f236582" alt="logo" width="300"><br></h3>
|
||||
<h3 align=center><a href="https://github.com/mofeng-git/One-KVM/blob/master/README.md">简体中文</a> </h3>
|
||||
<p align=right> </p>
|
||||
|
||||
### 介绍
|
||||
|
||||
One-KVM是基于玩客云硬件和PiKVM软件的远控设备。通过移植PiKVM该软件至玩客云设备上,实现了极高的性价比,不到百元功能即可接近甚至超越部分昂贵的商业设备。
|
||||
|
||||
该设备在于帮助用户通过得到控制设备的HDMI 画面和鼠标键盘,去远程管理服务器、工作站或个人PC等。 和基于软件的远程管理方式不同,你无需在被控电脑安装任何软件,做到无侵入式控制。
|
||||
该软件可以帮助用户通过得到控制设备的HDMI 画面和鼠标键盘,去远程管理服务器、工作站或个人PC等。 和基于软件的远程管理方式不同,无需在被控电脑安装任何软件,实现无侵入式控制。
|
||||
|
||||
该项目基于PiKVM和Fruity PiKVM,提供了玩客云兼容PiKVM操作的自动处理脚本。我不是PiKVM和Fruity PiKVM项目的开发者,所以不会对PiKVM软件本身和PiKVM deb包进行功能开发,请勿向此项目提交此类需求。
|
||||
该项目基于PiKVM,提供了玩客云兼容PiKVM操作的自动处理脚本。
|
||||
|
||||

|
||||
|
||||
**功能特性**
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
### 快速开始
|
||||
该脚本在玩客云(新旧版,[Armbian 22.11.0-trunk Jammy Linux onecloud 5.10.149-meson]( https://github.com/hzyitc/armbian-onecloud/releases/download/ci-20221026-074131-UTC/Armbian_22.11.0-trunk_Onecloud_jammy_legacy_5.10.149.burn.img.xz)系统)上运行,请确保你的设备已安装好Armbian系统。
|
||||
|
||||
**方式一:直刷One-KVM镜像**
|
||||
|
||||
本项目Releases页可以找到包含PiKVM的预编译镜像,内核版本为5.9.0-rc7。镜像名称带One-KVM前缀、burn后缀的为线刷镜像,可使用USB_Burning_Tool软件线刷至玩客云。预编译线刷镜像为开箱即用,刷好后启动设备就可以开始使用One-KVM。
|
||||
|
||||
**方式二:One-KVM脚本安装**
|
||||
|
||||
一键脚本,对于非玩客云设备安装未作测试,适用于玩客云Armbian Jammy系统。
|
||||
|
||||
```bash
|
||||
git clone https://github.com/mofeng-git/One-KVM.git
|
||||
cd One-KVM && ./install.sh
|
||||
```
|
||||
|
||||
对于国内网络环境,可以使用下命令
|
||||
```bash
|
||||
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
|
||||
#对于大陆网络环境,可以尝试使用下命令
|
||||
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
|
||||
```
|
||||
详细教程和扩展内容请参照飞书文档:[One-KVM使用手册](https://p1b237lu9xm.feishu.cn/drive/folder/IsOifWmMKlzYpRdWfcocI7jdnQA?from=from_copylink)
|
||||
**方式三:docker镜像部署**
|
||||
|
||||
目前仅有pikvm-ch9329_amd64,后续将支持更多控制方式和处理器架构。
|
||||
```bash
|
||||
#使用示例:
|
||||
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)
|
||||
|
||||
### 其他
|
||||
|
||||
**更新日志**
|
||||
- V0.5:通过锁定CPU频率修复ustreamer mjpeg视频流异常的问题;屏蔽主程序找不到温度传感器的报错;优化中文翻译;更新VNC依赖;优化安装流程。
|
||||
- V0.4:利用玩客云自动GPIO实现ATX开关机物理控制功能;初步建立飞书使用文档;制作一键安装脚本,优化安装流程。
|
||||
- V0.3:添加简体中文补丁;实现MSD功能在EMMC和TF卡上的使用;添加WOL和中文OCR功能;优化了安装流程。
|
||||
- V0.2:通过替换系统解决OTG拔插死机问题;初步实现MSD功能;修改启动分区解决开机卡线刷检测;优化安装流程。
|
||||
- V0.1:PiKVM在玩客云上初步运行。
|
||||
**感谢名单**
|
||||
|
||||
**感谢**
|
||||
H_xiaoming测试适配OTG正常可用镜像、0蓝蓝0提供开机卡线刷检测解决办法、fairybl关于MSD和线刷检测的其他解决方案、Will的PiKVM测试、浩龙的电子嵌入式之路的充电,各位网友的讨论交流和下列开源项目。
|
||||
<details>
|
||||
|
||||
浩龙的电子嵌入式之路(赞助)
|
||||
|
||||
Tsuki(赞助)
|
||||
|
||||
H_xiaoming
|
||||
|
||||
0蓝蓝0
|
||||
|
||||
fairybl
|
||||
|
||||
Will
|
||||
|
||||
浩龙的电子嵌入式之路
|
||||
|
||||
自.知
|
||||
|
||||
观棋不语٩ ི۶
|
||||
|
||||
以及各位讨论交流的网友
|
||||
</details>
|
||||
|
||||
**更新日志**
|
||||
|
||||
[One-KVM/ChangeLogs.txt](https://github.com/mofeng-git/One-KVM/blob/main/ChangeLogs.txt)
|
||||
|
||||
本项目间接或直接使用了下下列开源项目:
|
||||
1. [pikvm/pikvm: Open and inexpensive DIY IP-KVM based on Raspberry Pi (github.com)](https://github.com/pikvm/pikvm)
|
||||
2. [hzyitc/armbian-onecloud: Armbian for onecloud. 玩客云用armbian (github.com)](https://github.com/hzyitc/armbian-onecloud/)
|
||||
3. [jacobbar/fruity-pikvm: Install Pi-KVM on debian SBCs such as Orange Pi, Banana Pi, Mango Pi, etc (github.com)](https://github.com/jacobbar/fruity-pikvm)
|
||||
|
||||
|
||||
|
||||
111
install.sh
111
install.sh
@@ -47,7 +47,7 @@ change-device-tree(){
|
||||
|
||||
#覆盖引导分区
|
||||
override-uboot(){
|
||||
echo -e "\e[0;31m是否跳过玩客云重置键时的USB线刷检测?(\e[1;32mY/\e[1;31mN)"
|
||||
echo -e "\e[0;31m玩客云默认启用USB线刷检测,是否保存原样?(\e[1;32mY保持原样/N关闭此功能)"
|
||||
read USERYN
|
||||
case $USERYN in
|
||||
N | n)
|
||||
@@ -63,15 +63,18 @@ override-uboot(){
|
||||
#安装依赖软件
|
||||
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正在安装依赖软件nginx tesseract-ocr tesseract-ocr-eng janus libevent-dev libgpiod-dev tesseract-ocr-chi-sim......"
|
||||
apt install -y nginx tesseract-ocr tesseract-ocr-eng janus libevent-dev libgpiod-dev tesseract-ocr-chi-sim >> ./log.txt
|
||||
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
|
||||
}
|
||||
|
||||
#安装PiKVM
|
||||
install-pikvm(){
|
||||
echo "正在安装PiKVM......"
|
||||
dpkg -i ./fruity-pikvm_0.2_armhf.deb >> ./log.txt
|
||||
dpkg -i ./fruity-pikvm_0.2_armhf.deb
|
||||
systemctl enable kvmd-vnc
|
||||
systemctl disable nginx kvmd-janus
|
||||
#rm -f /lib/systemd/system/nginx.service
|
||||
#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
|
||||
@@ -81,7 +84,7 @@ install-pikvm(){
|
||||
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/
|
||||
echo "配置文件替换成功!"
|
||||
kvmd -m >> ./log.txt
|
||||
kvmd -m
|
||||
}
|
||||
|
||||
#应用补丁
|
||||
@@ -101,24 +104,114 @@ add-patches(){
|
||||
cp -f ./patch/chinese.patch /usr/share/kvmd/web/ && cd /usr/share/kvmd/web/
|
||||
patch -s -p0 < chinese.patch
|
||||
echo -e "\e[0;32m中文补丁应用成功!"
|
||||
apt install -y libjpeg-dev libfreetype6-dev python3-dev python3-pip
|
||||
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
|
||||
pip3 install -U Pillow
|
||||
|
||||
}
|
||||
|
||||
fix-motd() {
|
||||
#cd $CURRENTWD
|
||||
if [ -e /etc/motd ]; then rm /etc/motd; fi
|
||||
cat > /usr/bin/armbian-motd << EOF
|
||||
#!/bin/sh
|
||||
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
|
||||
____________________________________________________________________________
|
||||
|
||||
To prevent kernel messages from printing to the terminal use \"dmesg -n 1\".
|
||||
|
||||
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
|
||||
|
||||
"
|
||||
EOF
|
||||
chmod +x /usr/bin/armbian-motd /etc/update-motd.d/10-armbian-header /etc/update-motd.d/30-armbian-sysinfo
|
||||
sed -i 's/cat \/etc\/motd/armbian-motd/g' /lib/systemd/system/kvmd-webterm.service
|
||||
echo "fixed motd"
|
||||
}
|
||||
|
||||
show-info(){
|
||||
echo "One-KVM V0.5" >> installed.txt
|
||||
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
|
||||
override-uboot
|
||||
change-device-tree
|
||||
|
||||
#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
|
||||
|
||||
Binary file not shown.
3
patch/stream.sh
Normal file
3
patch/stream.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
/usr/bin/ustreamer-dump --sink kvmd::ustreamer::jpeg --output - | /usr/bin/ffmpeg -re -use_wallclock_as_timestamps 1 -i pipe: -rtbufsize 10M -c:v libx264 -pix_fmt yuv420p -preset:v ultrafast -tune:v zerolatency -profile:v baseline -bf 0 -b:v 3M -maxrate:v 5M -r 10 -g 10 -an -f rtp rtp://127.0.0.1:5004
|
||||
43
patch/stream_when_ustream_exists.sh
Normal file
43
patch/stream_when_ustream_exists.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 存储 stream.sh 的进程 ID
|
||||
b_pid=""
|
||||
|
||||
|
||||
cleanup() {
|
||||
echo "Received SIGINT. Terminating the process group..."
|
||||
[ -n "$b_pid" ] && pkill -9 -g $b_pid # 终止整个进程组
|
||||
exit 0
|
||||
}
|
||||
|
||||
# 捕获 SIGINT 信号
|
||||
trap cleanup SIGINT
|
||||
|
||||
|
||||
while true; do
|
||||
# 检测是否有包含 "ustreamer" 的进程
|
||||
if pgrep -f "/usr/bin/ustreamer " > /dev/null; then
|
||||
# 如果存在,但是 stream.sh 进程不存在,执行 stream.sh 并记录其进程 ID
|
||||
if [ -z "$b_pid" ]; then
|
||||
echo "Found a process with 'ustreamer' in the command. Executing stream.sh in the background..."
|
||||
setsid /usr/share/kvmd/stream.sh &
|
||||
b_pid=$(ps -o pgid= $!)
|
||||
echo "stream.sh started with PID: $b_pid"
|
||||
else
|
||||
echo "Process with 'ustreamer' is already running. Skipping..."
|
||||
fi
|
||||
else
|
||||
# 如果不存在 "ustreamer" 进程,但是 stream.sh 进程存在,终止 stream.sh 并清除进程 ID
|
||||
if [ -n "$b_pid" ]; then
|
||||
echo "No process with 'ustreamer' found. Terminating stream.sh (PID: $b_pid)..."
|
||||
pkill -9 -g $b_pid
|
||||
b_pid=""
|
||||
else
|
||||
echo "No process with 'ustreamer' found. Waiting for the next check..."
|
||||
fi
|
||||
fi
|
||||
|
||||
# 等待一段时间,可以根据需要调整等待的时间间隔
|
||||
sleep 1
|
||||
|
||||
done
|
||||
3364
web/adapter.js
Normal file
3364
web/adapter.js
Normal file
File diff suppressed because it is too large
Load Diff
3651
web/janus.js
Normal file
3651
web/janus.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user