[Feature][T106_INTEST2WIFI]update from T106-M42-INTEST2WIFI-P56U11.AP.19.06_CAP.19.06 to T106-M42-INTEST2WIFI-P56U11.AP.19.09_CAP.19.09
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: If26290a63fb3e7fda94ba36d2e8f1e39ec1b9dbf
diff --git a/rootfs/etc/config/lynq_uci_ro b/rootfs/etc/config/lynq_uci_ro
index ca27fdc..8376e89 100755
--- a/rootfs/etc/config/lynq_uci_ro
+++ b/rootfs/etc/config/lynq_uci_ro
@@ -1,5 +1,5 @@
config lynq_version_ro 'lynq_version'
- option LYNQ_SW_VERSION 'T106-MXX-INTEST2WIFI-P56U11.AP.19.06_CAP.19.06'
+ option LYNQ_SW_VERSION 'T106-MXX-INTEST2WIFI-P56U11.AP.19.09_CAP.19.09'
option LYNQ_SW_INSIDE_VERSION 'T106-M42-INTEST2WIFI-P56U11.AP.19.09_CAP.19.09'
config debug_mode 'debug_mode'
option conntrack_mode '1'
\ No newline at end of file
diff --git a/rootfs/etc/init.d/lynq-fota-backup.sh b/rootfs/etc/init.d/lynq-fota-backup.sh
index 53eb20f..8013112 100755
--- a/rootfs/etc/init.d/lynq-fota-backup.sh
+++ b/rootfs/etc/init.d/lynq-fota-backup.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Run the daemon
+# Run the daemon with CPU cgroup limitation
#
DAEMON="lynq-fota-backup-service"
@@ -8,11 +8,52 @@
EXEC="/usr/bin/lynq-fota-backup"
EXEC_ARGS=""
+# Cgroup配置
+CGROUP_NAME="fota_backup"
+CGROUP_PATH="/sys/fs/cgroup/cpu/$CGROUP_NAME"
+CPU_LIMIT="20000" # 20% CPU (100000 = 100%)
+
+# 创建Cgroup并设置CPU限制
+setup_cgroup() {
+ if [ ! -d "$CGROUP_PATH" ]; then
+ mkdir -p "$CGROUP_PATH"
+ echo "$CPU_LIMIT" > "$CGROUP_PATH/cpu.cfs_quota_us"
+ echo "100000" > "$CGROUP_PATH/cpu.cfs_period_us"
+ echo "Cgroup $CGROUP_NAME created with 20% CPU limit"
+ else
+ echo "Cgroup $CGROUP_NAME already exists, updating limit"
+ echo "$CPU_LIMIT" > "$CGROUP_PATH/cpu.cfs_quota_us"
+ fi
+}
+
+# 将进程添加到Cgroup
+add_to_cgroup() {
+ PID=$1
+ if [ -d "$CGROUP_PATH" ]; then
+ echo "$PID" > "$CGROUP_PATH/tasks"
+ echo -n "Process $PID added to Cgroup $CGROUP_NAME"
+ else
+ echo -n "ERROR: Cgroup $CGROUP_PATH does not exist!"
+ fi
+}
start() {
- echo -n "Starting $DAEMON... "
- start-stop-daemon --no-close -S -b -m -p $PIDFILE -x $EXEC -- $EXEC_ARGS
- [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+ sleep 600
+ echo "Starting $DAEMON with 20% CPU limit... "
+ setup_cgroup
+ start-stop-daemon --no-close -S -b -m -p $PIDFILE -x $EXEC -- $EXEC_ARGS
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ PID=$(cat $PIDFILE 2>/dev/null)
+ if [ -n "$PID" ]; then
+ add_to_cgroup "$PID"
+ else
+ echo "WARNING: Failed to read PID from $PIDFILE"
+ fi
+ echo "OK"
+ else
+ echo "ERROR"
+ fi
}
stop() {
@@ -22,18 +63,22 @@
}
restart() {
- stop
- start
+ stop
+ start &
}
case "$1" in
- start|stop|restart)
+ start)
+ start &
+ ;;
+ stop|restart)
"$1"
;;
- *)
+ *)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
+
diff --git a/rootfs/etc/passwd b/rootfs/etc/passwd
index 744d0de..31250de 100755
--- a/rootfs/etc/passwd
+++ b/rootfs/etc/passwd
@@ -1,20 +1,20 @@
root:x:0:0:root:/root:/bin/sh
-daemon:x:1:1:daemon:/usr/sbin:/bin/sh
-bin:x:2:2:bin:/bin:/bin/sh
-sys:x:3:3:sys:/dev:/bin/sh
-sync:x:4:65534:sync:/bin:/bin/sync
-games:x:5:60:games:/usr/games:/bin/sh
-man:x:6:12:man:/var/cache/man:/bin/sh
-lp:x:7:7:lp:/var/spool/lpd:/bin/sh
-mail:x:8:8:mail:/var/mail:/bin/sh
-news:x:9:9:news:/var/spool/news:/bin/sh
-uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
-proxy:x:13:13:proxy:/bin:/bin/sh
-www-data:x:33:33:www-data:/var/www:/bin/sh
-backup:x:34:34:backup:/var/backups:/bin/sh
-list:x:38:38:Mailing List Manager:/var/list:/bin/sh
-irc:x:39:39:ircd:/var/run/ircd:/bin/sh
-gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
+daemon:x:1:1:daemon:/usr/sbin:/bin/false
+bin:x:2:2:bin:/bin:/bin/false
+sys:x:3:3:sys:/dev:/bin/false
+sync:x:4:65534:sync:/bin:/bin/false
+games:x:5:60:games:/usr/games:/bin/false
+man:x:6:12:man:/var/cache/man:/bin/false
+lp:x:7:7:lp:/var/spool/lpd:/bin/false
+mail:x:8:8:mail:/var/mail:/bin/false
+news:x:9:9:news:/var/spool/news:/bin/false
+uucp:x:10:10:uucp:/var/spool/uucp:/bin/false
+proxy:x:13:13:proxy:/bin:/bin/false
+www-data:x:33:33:www-data:/var/www:/bin/false
+backup:x:34:34:backup:/var/backups:/bin/false
+list:x:38:38:Mailing List Manager:/var/list:/bin/false
+irc:x:39:39:ircd:/var/run/ircd:/bin/false
+gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/false
messagebus:x:998:998::/var/lib/dbus:/bin/false
radvd:x:999:65534::/var/run/radvd/:/bin/false
-nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
+nobody:x:65534:65534:nobody:/nonexistent:/bin/false
diff --git a/rootfs/etc/rcS.d/S82lynq-fota-backup-service b/rootfs/etc/rcS.d/S82lynq-fota-backup-service
index 53eb20f..8013112 100755
--- a/rootfs/etc/rcS.d/S82lynq-fota-backup-service
+++ b/rootfs/etc/rcS.d/S82lynq-fota-backup-service
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Run the daemon
+# Run the daemon with CPU cgroup limitation
#
DAEMON="lynq-fota-backup-service"
@@ -8,11 +8,52 @@
EXEC="/usr/bin/lynq-fota-backup"
EXEC_ARGS=""
+# Cgroup配置
+CGROUP_NAME="fota_backup"
+CGROUP_PATH="/sys/fs/cgroup/cpu/$CGROUP_NAME"
+CPU_LIMIT="20000" # 20% CPU (100000 = 100%)
+
+# 创建Cgroup并设置CPU限制
+setup_cgroup() {
+ if [ ! -d "$CGROUP_PATH" ]; then
+ mkdir -p "$CGROUP_PATH"
+ echo "$CPU_LIMIT" > "$CGROUP_PATH/cpu.cfs_quota_us"
+ echo "100000" > "$CGROUP_PATH/cpu.cfs_period_us"
+ echo "Cgroup $CGROUP_NAME created with 20% CPU limit"
+ else
+ echo "Cgroup $CGROUP_NAME already exists, updating limit"
+ echo "$CPU_LIMIT" > "$CGROUP_PATH/cpu.cfs_quota_us"
+ fi
+}
+
+# 将进程添加到Cgroup
+add_to_cgroup() {
+ PID=$1
+ if [ -d "$CGROUP_PATH" ]; then
+ echo "$PID" > "$CGROUP_PATH/tasks"
+ echo -n "Process $PID added to Cgroup $CGROUP_NAME"
+ else
+ echo -n "ERROR: Cgroup $CGROUP_PATH does not exist!"
+ fi
+}
start() {
- echo -n "Starting $DAEMON... "
- start-stop-daemon --no-close -S -b -m -p $PIDFILE -x $EXEC -- $EXEC_ARGS
- [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+ sleep 600
+ echo "Starting $DAEMON with 20% CPU limit... "
+ setup_cgroup
+ start-stop-daemon --no-close -S -b -m -p $PIDFILE -x $EXEC -- $EXEC_ARGS
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ PID=$(cat $PIDFILE 2>/dev/null)
+ if [ -n "$PID" ]; then
+ add_to_cgroup "$PID"
+ else
+ echo "WARNING: Failed to read PID from $PIDFILE"
+ fi
+ echo "OK"
+ else
+ echo "ERROR"
+ fi
}
stop() {
@@ -22,18 +63,22 @@
}
restart() {
- stop
- start
+ stop
+ start &
}
case "$1" in
- start|stop|restart)
+ start)
+ start &
+ ;;
+ stop|restart)
"$1"
;;
- *)
+ *)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
+