Compare commits
4 Commits
6ebac57538
...
53aa17a9b6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53aa17a9b6 | ||
|
|
d021abeaa0 | ||
|
|
a34ee348b3 | ||
|
|
d1f54c3292 |
1
package/third-party/initscripts/init.d/rcS
vendored
1
package/third-party/initscripts/init.d/rcS
vendored
@ -25,3 +25,4 @@ for i in /etc/init.d/S??* ;do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
/data/bin/e_player &
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
/home/tzkj/work/code/linuxOS_D21X/target/d211/demo128_nand/image_cfg.json
|
/home/hyx/work/15.6/linuxOS_D21X/target/d211/demo128_nand/image_cfg.json
|
||||||
@ -17,6 +17,14 @@ BR2_SYSTEM_DEFAULT_PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
|
|||||||
BR2_TARGET_ROOTFS_UBI=y
|
BR2_TARGET_ROOTFS_UBI=y
|
||||||
BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE=0x4000000
|
BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE=0x4000000
|
||||||
BR2_TARGET_ROOTFS_UBIFS_OPTS="-F"
|
BR2_TARGET_ROOTFS_UBIFS_OPTS="-F"
|
||||||
|
BR2_TARGET_USERFS1=y
|
||||||
|
BR2_TARGET_USERFS1_NAME="system"
|
||||||
|
BR2_TARGET_USERFS1_TYPE_UBIFS=y
|
||||||
|
BR2_TARGET_USERFS1_OVERLAY="target/$(LUBAN_CHIP_NAME)/$(LUBAN_BOARD_NAME)/system"
|
||||||
|
BR2_TARGET_USERFS2=y
|
||||||
|
BR2_TARGET_USERFS2_NAME="data"
|
||||||
|
BR2_TARGET_USERFS2_TYPE_UBIFS=y
|
||||||
|
BR2_TARGET_USERFS2_OVERLAY="target/$(LUBAN_CHIP_NAME)/$(LUBAN_BOARD_NAME)/data"
|
||||||
BR2_GENERATE_BURNER_IMAGE=y
|
BR2_GENERATE_BURNER_IMAGE=y
|
||||||
BR2_GENERATE_IMAGE_AUTO_CALCULATE_SIZE=y
|
BR2_GENERATE_IMAGE_AUTO_CALCULATE_SIZE=y
|
||||||
BR2_PACKAGE_OPENSBI_FW_TEXT_BASE=0x47FE0000
|
BR2_PACKAGE_OPENSBI_FW_TEXT_BASE=0x47FE0000
|
||||||
|
|||||||
@ -63,7 +63,7 @@ set_nand_mtdargs=env delete mtdparts
|
|||||||
|
|
||||||
set_nand_bootargs=run set_nand_mtdargs; \
|
set_nand_bootargs=run set_nand_mtdargs; \
|
||||||
run set_commonargs; \
|
run set_commonargs; \
|
||||||
setenv bootargs ${bootargs} mtdparts=${MTD} ubi.mtd=${ubi_rootfs_mtd} root=${nand_root} rootfstype=${nand_rootfstype}
|
setenv bootargs ${bootargs} mtdparts=${MTD} ubi.mtd=${ubi_rootfs_mtd} ubi.mtd=11 root=${nand_root} rootfstype=${nand_rootfstype}
|
||||||
|
|
||||||
set_nand_bootargs_recovery=run set_nand_mtdargs; \
|
set_nand_bootargs_recovery=run set_nand_mtdargs; \
|
||||||
run set_commonargs_recovery; \
|
run set_commonargs_recovery; \
|
||||||
|
|||||||
Binary file not shown.
@ -13,7 +13,7 @@
|
|||||||
"kernel": { "size": "12m" },
|
"kernel": { "size": "12m" },
|
||||||
"recovery": { "size": "16m" },
|
"recovery": { "size": "16m" },
|
||||||
"ubiroot": {
|
"ubiroot": {
|
||||||
"size": "218m",
|
"size": "64m",
|
||||||
"ubi": { // Volume in UBI device
|
"ubi": { // Volume in UBI device
|
||||||
"rootfs": { "size": "-" },
|
"rootfs": { "size": "-" },
|
||||||
},
|
},
|
||||||
@ -21,7 +21,8 @@
|
|||||||
"ubisystem": {
|
"ubisystem": {
|
||||||
"size": "-",
|
"size": "-",
|
||||||
"ubi": { // Volume in UBI device
|
"ubi": { // Volume in UBI device
|
||||||
"user": { "size": "-" },
|
"system": { "size": "8m" },
|
||||||
|
"data": { "size": "-" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -103,10 +104,15 @@
|
|||||||
"attr": ["ubi", "required"],
|
"attr": ["ubi", "required"],
|
||||||
"part": ["ubiroot:rootfs"]
|
"part": ["ubiroot:rootfs"]
|
||||||
},
|
},
|
||||||
"app": {
|
"system": {
|
||||||
"file": "user*.ubifs",
|
"file": "system*.ubifs",
|
||||||
"attr": ["ubi", "optional"],
|
"attr": ["ubi", "optional"],
|
||||||
"part": ["ubisystem:user"]
|
"part": ["ubisystem:system"]
|
||||||
|
},
|
||||||
|
"data": {
|
||||||
|
"file": "data*.ubifs",
|
||||||
|
"attr": ["ubi", "optional"],
|
||||||
|
"part": ["ubisystem:data"]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
11
target/d211/demo128_nand/rootfs_overlay/etc/fstab
Normal file
11
target/d211/demo128_nand/rootfs_overlay/etc/fstab
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# <file system> <mount pt> <type> <options> <dump> <pass>
|
||||||
|
/dev/root / ext2 rw,noauto 0 1
|
||||||
|
proc /proc proc defaults 0 0
|
||||||
|
devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0
|
||||||
|
tmpfs /dev/shm tmpfs mode=0777 0 0
|
||||||
|
tmpfs /tmp tmpfs mode=1777 0 0
|
||||||
|
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
|
||||||
|
sysfs /sys sysfs defaults 0 0
|
||||||
|
|
||||||
|
ubi1:system /system ubifs ro,defaults 0 0
|
||||||
|
ubi1:data /data ubifs defaults 0 0
|
||||||
55
target/d211/demo128_nand/rootfs_overlay/etc/init.d/S01ubivol
Executable file
55
target/d211/demo128_nand/rootfs_overlay/etc/init.d/S01ubivol
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Auto-create and mount UBI volumes for system and data partitions
|
||||||
|
#
|
||||||
|
|
||||||
|
start() {
|
||||||
|
echo "Initializing UBI volumes..."
|
||||||
|
|
||||||
|
# Check if ubi1 device exists
|
||||||
|
if [ ! -e /dev/ubi1 ]; then
|
||||||
|
echo "ubi1 device not found, skipping..."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create mount points
|
||||||
|
mkdir -p /system /data
|
||||||
|
|
||||||
|
# Mount system (read-only)
|
||||||
|
if ! mountpoint -q /system; then
|
||||||
|
echo "Mounting /system..."
|
||||||
|
mount -t ubifs -o ro ubi1:system /system 2>/dev/null || echo "Failed to mount /system"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mount data (read-write)
|
||||||
|
if ! mountpoint -q /data; then
|
||||||
|
echo "Mounting /data..."
|
||||||
|
mount -t ubifs ubi1:data /data 2>/dev/null || echo "Failed to mount /data"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "UBI volumes initialized"
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
echo "Unmounting UBI volumes..."
|
||||||
|
umount /data 2>/dev/null
|
||||||
|
umount /system 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -1,28 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
|
|
||||||
# Start all init scripts in /etc/init.d
|
|
||||||
# executing them in numerical order.
|
|
||||||
#
|
|
||||||
for i in /etc/init.d/S??* ;do
|
|
||||||
|
|
||||||
# Ignore dangling symlinks (if any).
|
|
||||||
[ ! -f "$i" ] && continue
|
|
||||||
|
|
||||||
case "$i" in
|
|
||||||
*.sh)
|
|
||||||
# Source shell script for speed.
|
|
||||||
(
|
|
||||||
trap - INT QUIT TSTP
|
|
||||||
set start
|
|
||||||
. $i
|
|
||||||
)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# No sh extension, so fork subprocess.
|
|
||||||
$i start
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
/usr/bin/e_player &
|
|
||||||
42
target/d211/demo128_nand/rootfs_overlay/etc/inittab
Normal file
42
target/d211/demo128_nand/rootfs_overlay/etc/inittab
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# /etc/inittab
|
||||||
|
#
|
||||||
|
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
|
||||||
|
#
|
||||||
|
# Note: BusyBox init doesn't support runlevels. The runlevels field is
|
||||||
|
# completely ignored by BusyBox init. If you want runlevels, use
|
||||||
|
# sysvinit.
|
||||||
|
#
|
||||||
|
# Format for each entry: <id>:<runlevels>:<action>:<process>
|
||||||
|
#
|
||||||
|
# id == tty to run on, or empty for /dev/console
|
||||||
|
# runlevels == ignored
|
||||||
|
# action == one of sysinit, respawn, askfirst, wait, and once
|
||||||
|
# process == program to run
|
||||||
|
|
||||||
|
# Startup the system
|
||||||
|
::sysinit:/bin/mount -t proc proc /proc
|
||||||
|
::sysinit:/bin/mount -o remount,rw /
|
||||||
|
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
|
||||||
|
::sysinit:/bin/mount -a
|
||||||
|
::sysinit:/sbin/swapon -a
|
||||||
|
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
|
||||||
|
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
|
||||||
|
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
|
||||||
|
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
|
||||||
|
::sysinit:/bin/hostname -F /etc/hostname
|
||||||
|
# now run any rc scripts
|
||||||
|
::sysinit:/etc/init.d/rcS
|
||||||
|
|
||||||
|
# e_player monitor and auto-restart
|
||||||
|
::respawn:/usr/bin/e_player_wrapper
|
||||||
|
|
||||||
|
::sysinit:/bin/cat /etc/issue # Put a getty on the serial port
|
||||||
|
console::respawn:-/bin/sh # GENERIC_SERIAL
|
||||||
|
|
||||||
|
# Stuff to do for the 3-finger salute
|
||||||
|
#::ctrlaltdel:/sbin/reboot
|
||||||
|
|
||||||
|
# Stuff to do before rebooting
|
||||||
|
::shutdown:/etc/init.d/rcK
|
||||||
|
::shutdown:/sbin/swapoff -a
|
||||||
|
::shutdown:/bin/umount -a -r
|
||||||
BIN
target/d211/demo128_nand/rootfs_overlay/usr/bin/btgatt-server
Executable file → Normal file
BIN
target/d211/demo128_nand/rootfs_overlay/usr/bin/btgatt-server
Executable file → Normal file
Binary file not shown.
106
target/d211/demo128_nand/rootfs_overlay/usr/bin/e_player_wrapper
Executable file
106
target/d211/demo128_nand/rootfs_overlay/usr/bin/e_player_wrapper
Executable file
@ -0,0 +1,106 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# e_player 崩溃监控和恢复脚本
|
||||||
|
|
||||||
|
CRASH_COUNT_FILE="/data/.e_player_crash_count"
|
||||||
|
STABLE_COUNT_FILE="/data/.e_player_stable_count"
|
||||||
|
MAX_CRASH=5
|
||||||
|
CHECK_INTERVAL=1
|
||||||
|
STABLE_CHECKS=120 # 连续检测120s 进程存在才认为稳定
|
||||||
|
|
||||||
|
if [ ! -f "$CRASH_COUNT_FILE" ]; then
|
||||||
|
echo 0 > "$CRASH_COUNT_FILE"
|
||||||
|
fi
|
||||||
|
if [ ! -f "$STABLE_COUNT_FILE" ]; then
|
||||||
|
echo 0 > "$STABLE_COUNT_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(date): e_player_wrapper starting, waiting for e_player..." >> /data/crash.log
|
||||||
|
WAIT_COUNT=0
|
||||||
|
while [ $WAIT_COUNT -lt 20 ]; do
|
||||||
|
if ps | grep -v grep | grep -v e_player_wrapper | grep e_player > /dev/null; then
|
||||||
|
echo "$(date): e_player detected after ${WAIT_COUNT} checks, starting monitoring..." >> /data/crash.log
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 3
|
||||||
|
WAIT_COUNT=$((WAIT_COUNT + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! ps | grep -v grep | grep -v e_player_wrapper | grep e_player > /dev/null; then
|
||||||
|
echo "$(date): WARNING - e_player not found after 60s, will monitor anyway..." >> /data/crash.log
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(date): Starting main monitoring loop..." >> /data/crash.log
|
||||||
|
|
||||||
|
HEARTBEAT=0
|
||||||
|
while true; do
|
||||||
|
HEARTBEAT=$((HEARTBEAT + 1))
|
||||||
|
if [ $HEARTBEAT -ge 120 ]; then
|
||||||
|
echo "$(date): [Heartbeat] Monitoring active, stable_count=$(cat $STABLE_COUNT_FILE)" >> /data/crash.log
|
||||||
|
HEARTBEAT=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! ps | grep -v grep | grep -v e_player_wrapper | grep e_player > /dev/null; then
|
||||||
|
# 进程不存在,崩溃了
|
||||||
|
echo 0 > "$STABLE_COUNT_FILE" # 重置稳定计数
|
||||||
|
|
||||||
|
COUNT=$(cat "$CRASH_COUNT_FILE")
|
||||||
|
COUNT=$((COUNT + 1))
|
||||||
|
echo $COUNT > "$CRASH_COUNT_FILE"
|
||||||
|
|
||||||
|
echo "$(date): e_player crashed, count: $COUNT" >> /data/crash.log
|
||||||
|
|
||||||
|
if [ $COUNT -ge $MAX_CRASH ]; then
|
||||||
|
echo "$(date): Crash count exceeded $MAX_CRASH, restoring from factory..." >> /data/crash.log
|
||||||
|
|
||||||
|
# 从factory恢复bin文件
|
||||||
|
if [ -f /system/factory/bin/e_player ]; then
|
||||||
|
cp /system/factory/bin/e_player /data/bin/e_player
|
||||||
|
chmod +x /data/bin/e_player
|
||||||
|
echo "$(date): Restored e_player from factory" >> /data/crash.log
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /system/factory/bin/lbh_client ]; then
|
||||||
|
cp /system/factory/bin/lbh_client /data/bin/lbh_client
|
||||||
|
chmod +x /data/bin/lbh_client
|
||||||
|
echo "$(date): Restored lbh_client from factory" >> /data/crash.log
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 恢复配置文件
|
||||||
|
if [ -f /system/factory/system_properties.cfg ]; then
|
||||||
|
cp /system/factory/system_properties.cfg /data/system_properties.cfg
|
||||||
|
echo "$(date): Restored system_properties.cfg from factory" >> /data/crash.log
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 重置崩溃计数,重新开始
|
||||||
|
echo 0 > "$CRASH_COUNT_FILE"
|
||||||
|
echo "$(date): Reset crash count, retrying..." >> /data/crash.log
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(date): Restarting e_player..." >> /data/crash.log
|
||||||
|
killall -9 e_player 2>/dev/null
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH=/data/bin/libs:/vendor/qua/lib:/lib:/usr/lib:$LD_LIBRARY_PATH
|
||||||
|
cd /data
|
||||||
|
/data/bin/e_player &
|
||||||
|
sleep 3
|
||||||
|
else
|
||||||
|
# 进程存在,累加稳定计数
|
||||||
|
STABLE=$(cat "$STABLE_COUNT_FILE")
|
||||||
|
STABLE=$((STABLE + 1))
|
||||||
|
echo $STABLE > "$STABLE_COUNT_FILE"
|
||||||
|
|
||||||
|
# 如果稳定运行120秒,重置崩溃计数
|
||||||
|
if [ $STABLE -ge $STABLE_CHECKS ]; then
|
||||||
|
COUNT=$(cat "$CRASH_COUNT_FILE")
|
||||||
|
if [ $COUNT -gt 0 ]; then
|
||||||
|
echo "$(date): e_player stable, resetting crash count" >> /data/crash.log
|
||||||
|
echo 0 > "$CRASH_COUNT_FILE"
|
||||||
|
fi
|
||||||
|
echo 0 > "$STABLE_COUNT_FILE" # 重置稳定计数,下次再累计
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep $CHECK_INTERVAL
|
||||||
|
done
|
||||||
|
|
||||||
BIN
target/d211/demo128_nand/system/factory/bin/e_player
Executable file
BIN
target/d211/demo128_nand/system/factory/bin/e_player
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user