MeowOS for HiBy R3 Pro II — 公共发布版本(历史已重置)

• 全新单提交:清除含敏感信息的旧历史(sudo 口令、内网 IP、SSH 密钥路径、热点 SSID、设备 MAC)
• 本地开发文档/测试记录/构建脚本全部移入 gitignored 的 devdocs/ 与 scripts/build/(不入库)
• 保留:MeowOS 源码(launcher/watchdog/bootmenu/meow_svcd/SDK)、项目规范文档、mips-repo
增补组件:SDK 统一日志+通知 API、meow_svcd 服务管理器、mips-repo 软件仓库
This commit is contained in:
MeowOS Dev committed 2026-08-30 01:12:34 +08:00
commit 245bee2946
136 files changed
+32730

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
#!/bin/sh
#
# S99ssh - HiBy R3 Pro II: dropbear SSH 服务 + ADB 持久自启
#
# 设计要点:
# * dropbear 为静态 musl 二进制(/usr/sbin/dropbear),仅 pubkey 认证
# (编译时已去掉 password auth,无需 /etc/passwd 写密码)。
# * /root 位于只读 squashfs,authorized_keys 放可写 UBIFS 卷:
# /usr/data/ssh/.ssh/authorized_keys
# 并用 bind-mount 把 /usr/data/ssh 挂到 /root(/root 在固件中是空目录),
# dropbear 按 passwd 的 pw_dir=/root 查找 ~/.ssh/authorized_keys。
# * host key 首次开机用 dropbearkey 生成到 /usr/data/ssh/
# (dropbear -R 的运行时生成路径是只读的 /etc/dropbear,不可用)。
# * 日志:/usr/data/ssh.log(= /data/ssh.log)。
# * 顺带删除 /usr/data/disableadb,使 ADB 在 USB 连接时持久自启
# (etc/init.d/adb/S440adb 检查该文件存在则不起 adb)。
#
case "$1" in
start)
echo "Starting dropbear sshd ..."
# ADB 持久自启:清掉禁用标记
rm -f /usr/data/disableadb
# UBIFS 未挂好/不可写则放弃(避免在只读 squashfs 上瞎写)
[ -d /usr/data ] && [ -w /usr/data ] || {
echo "S99ssh: /usr/data not writable, abort" > /dev/console 2>&1
exit 0
}
mkdir -p /usr/data/ssh/.ssh
chmod 700 /usr/data/ssh
chmod 700 /usr/data/ssh/.ssh
# 首次开机:从只读模板写入 authorized_keys
if [ ! -f /usr/data/ssh/.ssh/authorized_keys ] && [ -f /etc/dropbear/authorized_keys ]; then
cp /etc/dropbear/authorized_keys /usr/data/ssh/.ssh/authorized_keys
fi
chmod 600 /usr/data/ssh/.ssh/authorized_keys 2>/dev/null
# /root 只读 -> bind 可写的 ssh 工作目录过去
mount --bind /usr/data/ssh /root 2>/dev/null
# MeowAPPs 应用加载器: 把看门狗复制到可写卷 (cave exec 路径 /usr/data/meow_watchdog)
if [ -f /usr/bin/meow_watchdog ]; then
cp -f /usr/bin/meow_watchdog /usr/data/meow_watchdog 2>/dev/null
chmod 755 /usr/data/meow_watchdog 2>/dev/null
fi
# 首次开机:生成 ed25519 host key
if [ ! -f /usr/data/ssh/dropbear_ed25519_host_key ]; then
/usr/sbin/dropbearkey -t ed25519 -f /usr/data/ssh/dropbear_ed25519_host_key \
>> /usr/data/ssh.log 2>&1
chmod 600 /usr/data/ssh/dropbear_ed25519_host_key
fi
# 启动 dropbear:仅 pubkey 认证,禁用端口转发
/usr/sbin/dropbear -j -k \
-r /usr/data/ssh/dropbear_ed25519_host_key \
-p 22 \
-P /usr/data/ssh/dropbear.pid \
>> /usr/data/ssh.log 2>&1 &
;;
stop)
killall dropbear 2>/dev/null
sleep 1
umount /root 2>/dev/null
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
exit 0
+47
View File
@@ -0,0 +1,47 @@
#!/bin/sh
#
# S90meow_bootmenu - R3 Pro II boot selector (Boot Selector phase 0 · M2 接管 HibyOS)
#
# Design (BOOT_SELECTOR_DESIGN.md §2.1 timing / §9 M2):
# * Placed AFTER S80_bt_init, BEFORE S92_03_start_music_player (S80 < S90 < S92),
# so the selector runs before the official player is started.
# * M2: meow_bootmenu is launched with --fork, so:
# 选 HibyOS -> bootmenu forks /usr/bin/hiby_player (最小启动契约),
# parent becomes supervisor/热键守护, blocks rcS.
# 选 MeowOS -> bootmenu exec /usr/bin/meow_launcherd (MeowOS 基础主屏),
# blocks rcS.
# Either way rcS is blocked by S90 until整机重启/热键切换, so S92 (兜底 patch)
# is normally never reached; SSH was moved to S84 so it is already online.
# * rcS runs S??* (non-.sh) as fork-ed subprocesses, so `exec` here replaces
# ONLY this script's process.
# * 红线: 启动前清 /data/recovery_all、禁经 hiby_player.sh、禁 killall、
# 禁 SIGUSR1。回退 = 重刷不含选单固件 (M1 r3proii_m1.upt)。
#
case "$1" in
start)
echo -n "Starting meow_bootmenu: "
# Boot mode marker (tmpfs is cleared each boot; rm once more to be sure).
rm -f /tmp/meow_boot_mode
# 红线:启动前清除 recovery_all,避免进入恢复流程。
rm -f /data/recovery_all
if [ -x /usr/bin/meow_bootmenu ]; then
echo "OK (selector --fork)"
exec /usr/bin/meow_bootmenu --fork
else
echo "MISSING /usr/bin/meow_bootmenu (fall through to S92)"
fi
;;
stop)
echo -n "Stopping meow_bootmenu: "
killall meow_bootmenu 2>/dev/null
echo "OK"
;;
restart|reload)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
exit 0
@@ -0,0 +1,66 @@
#!/bin/sh
#
# S92_03_start_music_player - Boot Selector phase 0 · M2 兜底 patch
#
# 正常路径:rcS 被 S90meow_bootmenu 阻塞(fork 播放器后父进程监督,或 exec
# meow_launcherd),本脚本**不会执行**。
# 兜底路径:S90 崩溃/选单 fork 失败导致 rcS 推进到本脚本时,读 /tmp/meow_boot_mode
# + pidof 判断,安全拉起播放器或跳过。
#
# 红线:* 仅经 pidof 判断,不 killall hiby_player(触发 sh 看门狗 reboot);
# * 禁 SIGUSR1;* 兜底拉起才用 hiby_player.sh(官方行为,含 sleep 1; reboot
# 看门狗——只在播放器无人接管时兜底,正常 HibyOS 由 bootmenu 直拉二进制)。
#
PL01=/usr/bin/hiby_player.sh
case "$1" in
start)
echo -n "Starting $0 : begin "
# 若 S90 已把模式写成 /tmp/meow_boot_mode,优先按其决策兜底
if [ -f /tmp/meow_boot_mode ]; then
case "$(cat /tmp/meow_boot_mode)" in
meow)
echo "MeowOS mode: skip player (launcher should have taken over)"
exit 0
;;
hiby)
if pidof hiby_player >/dev/null 2>&1; then
echo "player already up (bootmenu fork), skip"
exit 0
fi
[ -f $PL01 ] && ( $PL01 & ) || echo " file <$PL01> don't exist."
;;
*)
# 未知 mode:按官方兜底
if pidof hiby_player >/dev/null 2>&1; then
echo "unknown mode, player already up, skip"
exit 0
fi
[ -f $PL01 ] && ( $PL01 & ) || echo " file <$PL01> don't exist."
;;
esac
else
# 无模式标记:选单崩/未写,官方兜底(先 pidof 防双拉竞态)
if pidof hiby_player >/dev/null 2>&1; then
echo "no mode file, player already up, skip"
exit 0
fi
[ -f $PL01 ] && ( $PL01 & ) || echo " file <$PL01> don't exist."
fi
echo -n "Starting $0 : end "
;;
stop)
echo -n "Stopping $0 : "
echo "OK"
;;
restart|reload)
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
#
# S95shutdown_logo - R3 Pro II 关机 logo(阶段0 · M2.1)
#
# 机制(BusyBox init,见 /etc/inittab):
# ::shutdown:/etc/init.d/rcK
# rcK 按数字**反序**执行 /etc/init.d/S??* stop(S99ssh → S95 → S92 → S80 → …)。
# 本脚本(S95)在 `stop` 分支、大多数服务仍存活、/dev/fb0 仍可用时,
# 先用 cmd_jpeg_display 显示 /etc/shutdown_logo.jpeg 并点亮面板。
#
# ⚠️ 局限(M2.1 记录,待真机验证):poweroff 由**内核长按电源**触发,是否可靠走
# rcK 的 ::shutdown 路径未实测(可能直接断电,rcK 不执行)。若不可靠,关机
# logo 应改由 MeowOS 的 poweroff 处理显示(M3 范畴)。M2.1 先在固件放文件 +
# 写脚本,标注待验证。
#
case "$1" in
start)
;;
stop)
echo -n "S95shutdown_logo: "
if [ -x /usr/bin/cmd_jpeg_display ] && [ -f /etc/shutdown_logo.jpeg ]; then
# 先点亮面板(避免黑屏上画图不可见),再显示关机 logo。
echo 60 > /sys/class/backlight/backlight_pwm0/brightness 2>/dev/null
cmd_jpeg_display /etc/shutdown_logo.jpeg 2>/dev/null
echo "shutdown logo shown"
else
echo "skip (no cmd_jpeg_display or no /etc/shutdown_logo.jpeg)"
fi
;;
restart|reload)
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
exit 0
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# build_bootmenu.sh — build the meow_bootmenu binary: static MIPS32r2 musl (soft-float).
# M2.26: 链入 meow_launcherd/meow_touch.c(统一触摸接口),boot menu 选单/确认框触摸迁到 meow_touch,
# 修「触摸确认点两下」。meow_touch.h 在 ../meow_launcherd/ 下,用 -I 引相对路径。
set -e
cd "$(dirname "$0")"
CC="$HOME/Project/R3ProII/.tools/zig-mipsel-cc"
MEOW_TOUCH_DIR="../meow_launcherd"
"$CC" -Os -static -I "$MEOW_TOUCH_DIR" meow_bootmenu.c "$MEOW_TOUCH_DIR/meow_touch.c" -o meow_bootmenu
ls -la meow_bootmenu
file meow_bootmenu
BIN
View File
Binary file not shown.
File diff suppressed because it is too large. Load diff