mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2025-12-01 05:28:15 +00:00
@@ -1,7 +1,4 @@
|
||||
#!/bin/sh
|
||||
###
|
||||
###DO NOT MODIFY UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
###
|
||||
|
||||
###This file is run by switch_root, from the initramfs in the kernel.
|
||||
LOG_NAME=/opt/wz_mini/log/wz_init
|
||||
@@ -36,13 +33,13 @@ echo '
|
||||
|
||||
set -x
|
||||
|
||||
#replace stock busybox
|
||||
echo "replace stock busybox"
|
||||
mount --bind /opt/wz_mini/bin/busybox /bin/busybox
|
||||
|
||||
echo "replace stock fstab"
|
||||
mount --bind /opt/wz_mini/etc/fstab /etc/fstab
|
||||
|
||||
echo "mount workplace dir"
|
||||
echo "mount wz_mini tmpfs"
|
||||
mount -t tmpfs /opt/wz_mini/tmp
|
||||
|
||||
echo "install busybox applets"
|
||||
@@ -55,6 +52,7 @@ mkdir /opt/wz_mini/tmp/.bin
|
||||
#PANv2=HL_PAN2
|
||||
#V3=WYZE_CAKP2JFUS
|
||||
#DB3=WYZEDB3
|
||||
#V3C=ATOM_CamV3C
|
||||
|
||||
#mtdblock9 only exists on the T20 platform, indicating V2 or PANv1
|
||||
if [ -b /dev/mtdblock9 ]; then
|
||||
@@ -96,14 +94,21 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
touch /opt/wz_mini/etc/.first_boot
|
||||
|
||||
if [ -f /opt/wz_mini/etc/.first_boot ]; then
|
||||
echo "Not first_boot"
|
||||
else
|
||||
echo "Set first_boot"
|
||||
touch /opt/wz_mini/etc/.first_boot
|
||||
fi
|
||||
|
||||
echo "replace stock inittab"
|
||||
mount --bind /opt/wz_mini/etc/inittab /etc/inittab
|
||||
|
||||
echo "bind /etc/profile for local/ssh shells"
|
||||
mount --bind /opt/wz_mini/etc/profile /etc/profile
|
||||
|
||||
echo "mounting tmpfs"
|
||||
echo "mounting global tmpfs"
|
||||
mount -t tmpfs /tmp
|
||||
|
||||
echo "mount system to replace factorycheck with dummy, to prevent bind unmount"
|
||||
@@ -122,7 +127,7 @@ cp /etc/init.d/rcS /opt/wz_mini/tmp/.storage/rcS
|
||||
|
||||
echo "add wz_post inject to stock rcS"
|
||||
sed -i '/^".*/aset -x' /opt/wz_mini/tmp/.storage/rcS
|
||||
sed -i '/^# Mount configs.*/i/opt/wz_mini/etc/init.d/wz_post.sh\n' /opt/wz_mini/tmp/.storage/rcS
|
||||
sed -i '/^# Run init script.*/i/opt/wz_mini/etc/init.d/wz_post.sh\n' /opt/wz_mini/tmp/.storage/rcS
|
||||
|
||||
sed -i '/sbin:/s/$/:\/opt\/wz_mini\/bin/' /opt/wz_mini/tmp/.storage/rcS
|
||||
sed -i '/system\/\lib/s/$/:\/opt\/wz_mini\/lib/' /opt/wz_mini/tmp/.storage/rcS
|
||||
|
||||
@@ -28,6 +28,40 @@ export WZMINI_CFG=/opt/wz_mini/wz_mini.conf
|
||||
echo "welcome to wz_post.sh"
|
||||
echo "PID $$"
|
||||
|
||||
#CAMERA CONFIGURATION FILES BACKUP
|
||||
if [ -d /opt/.wz_backup ]; then
|
||||
echo "backup directory missing"
|
||||
else
|
||||
echo "creating backup directory"
|
||||
mkdir /opt/.wz_backup
|
||||
fi
|
||||
|
||||
if [ -f /opt/wz_mini/tmp/.T31 ]; then
|
||||
echo "T31 platform backup"
|
||||
if [ -d /opt/.wz_backup/configs ]; then
|
||||
echo "configs backup directory present, not backing up again"
|
||||
else
|
||||
echo "backup /configs"
|
||||
cp -R /configs/ /opt/.wz_backup/
|
||||
fi
|
||||
elif [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
echo "T20 platform backup"
|
||||
if [ -d /opt/.wz_backup/configs ]; then
|
||||
echo "configs backup directory present, not backing up again"
|
||||
else
|
||||
echo "backup /configs"
|
||||
cp -R /configs/ /opt/.wz_backup/
|
||||
fi
|
||||
|
||||
if [ -d /opt/.wz_backup/params ]; then
|
||||
echo "configs backup directory present, not backing up again"
|
||||
else
|
||||
echo "backup /params"
|
||||
cp -R /params/ /opt/.wz_backup/
|
||||
fi
|
||||
fi
|
||||
|
||||
#SWAP FILE, REQUIRED FOR OPERATION!
|
||||
if [[ "$ENABLE_SWAP" == "true" ]] && [[ -e /opt/wz_mini/swap ]]; then
|
||||
echo "swap file found, enable"
|
||||
swapon /opt/wz_mini/swap
|
||||
@@ -41,28 +75,36 @@ if [ -d /lib/modules ]; then
|
||||
fi
|
||||
|
||||
## REPLACE STOCK MODULES
|
||||
|
||||
if [[ "$ENABLE_RTL8189FS_DRIVER" == "true" ]] || [[ "$ENABLE_RTL8189FS_DRIVER" == "" ]]; then
|
||||
echo "Enable 8189fs"
|
||||
if [ -f /opt/wz_mini/tmp/.WYZEC1-JZ ]; then
|
||||
sed -i 's/\/driver\/rtl8189ftv.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\/extra\/8189fs.ko rtw_power_mgnt=0 rtw_enusbss=0 rtw_drv_log_level=3/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
sed -i 's/\/driver\/rtl8189ftv.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\/extra\/8189fs.ko rtw_power_mgnt=0 rtw_enusbss=0 rtw_drv_log_level=0/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
elif [ -f /opt/wz_mini/tmp/.WYZECP1_JEF ]; then
|
||||
sed -i 's/insmod \/driver\/8189es.ko/insmod \/opt\/wz_mini\/lib\/modules\/3.10.14\/extra\/8189es.ko rtw_power_mgnt=0 rtw_enusbss=0 rtw_drv_log_level=3/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
sed -i 's/insmod \/driver\/8189es.ko/insmod \/opt\/wz_mini\/lib\/modules\/3.10.14\/extra\/8189es.ko rtw_power_mgnt=0 rtw_enusbss=0 rtw_drv_log_level=0/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
elif [ -f /opt/wz_mini/tmp/.WYZE_CAKP2JFUS ]; then
|
||||
sed -i 's/\/system\/driver\/rtl8189ftv.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\_\_isvp_swan_1.0\_\_\/extra\/8189fs.ko rtw_power_mgnt=0 rtw_enusbss=0 rtw_drv_log_level=4/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
sed -i 's/\/system\/driver\/rtl8189ftv.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\_\_isvp_swan_1.0\_\_\/extra\/8189fs.ko rtw_power_mgnt=0 rtw_enusbss=0 rtw_drv_log_level=0/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
elif [ -f /opt/wz_mini/tmp/.ATOM_CamV3C ]; then
|
||||
sed -i 's/\/system\/driver\/rtl8189ftv.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\_\_isvp_swan_1.0\_\_\/extra\/8189fs.ko rtw_power_mgnt=0 rtw_enusbss=0 rtw_drv_log_level=0/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_ATBM603X_DRIVER" == "true" ]] || [[ "$ENABLE_ATBM603X_DRIVER" == "" ]]; then
|
||||
echo "Enable atbm603x_wifi_sdio"
|
||||
if [ -f /opt/wz_mini/tmp/.T31 ]; then
|
||||
sed -i 's/\/system\/driver\/atbm603x_wifi_sdio.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\_\_isvp_swan_1.0\_\_\/extra\/atbm603x_wifi_sdio.ko/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
if [ -f /opt/wz_mini/tmp/.ATOM_CamV3C ]; then
|
||||
sed -i 's/\/thirdlib\/atbm603x_wifi_sdio.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\_\_isvp_swan_1.0\_\_\/extra\/atbm603x_wifi_sdio.ko atbm_printk_mask=0/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
elif [ -f /opt/wz_mini/tmp/.T31 ] && ! [ -f /opt/wz_mini/tmp/.ATOM_CamV3C ]; then
|
||||
sed -i 's/\/system\/driver\/atbm603x_wifi_sdio.ko/\/opt\/wz_mini\/lib\/modules\/3.10.14\_\_isvp_swan_1.0\_\_\/extra\/atbm603x_wifi_sdio.ko atbm_printk_mask=0/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
##RTSP SERVER INIT
|
||||
##ENABLE LIBCALLBACK BY DEFAULT
|
||||
if [[ "$LIBCALLBACK_ENABLE" == "true" ]] || ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]); then
|
||||
echo "set path for iCamera"
|
||||
sed -i 's/\/system\/bin\/iCamera/\/opt\/wz_mini\/usr\/bin\/iCamera/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] && ! [[ -e /tmp/dbgflag ]]; then
|
||||
#RTSP SERVER
|
||||
if ([[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]) && ! [[ -e /tmp/dbgflag ]]; then
|
||||
if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] && [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
echo "load video loopback driver at video6 video7"
|
||||
@@ -88,8 +130,12 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]] || [[ "$RTSP_LOW_RES_ENABLED" == "tru
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/extra/v4l2loopback.ko video_nr=1
|
||||
fi
|
||||
fi
|
||||
echo "set path for iCamera"
|
||||
sed -i 's/\/system\/bin\/iCamera/\/opt\/wz_mini\/usr\/bin\/iCamera/g' /opt/wz_mini/tmp/.storage/app_init.sh
|
||||
fi
|
||||
|
||||
#MOTORIZED CAMERA CONTROL
|
||||
if [[ "$DISABLE_MOTOR" == "true" ]]; then
|
||||
echo "Motor Disabled"
|
||||
touch /opt/wz_mini/tmp/.ms
|
||||
fi
|
||||
|
||||
/opt/wz_mini/etc/init.d/wz_user.sh &
|
||||
|
||||
@@ -320,7 +320,7 @@ if [[ "$ENABLE_USB_ETH" == "true" ]]; then
|
||||
modprobe ax88179_178a
|
||||
;;
|
||||
'1004:61aa' | '046d:c11f' | '1410:b001' | '1410:9010' | '413c:8195' |\
|
||||
'413c:8196' | '413c:819b' | '16d5:650a' | '12d1:14ac' | '0bda:8152')
|
||||
'413c:8196' | '413c:819b' | '16d5:650a' | '12d1:14ac')
|
||||
echo "Loading USB CDC Ethernet driver..."
|
||||
modprobe cdc_ether
|
||||
;;
|
||||
@@ -334,7 +334,7 @@ if [[ "$ENABLE_USB_ETH" == "true" ]]; then
|
||||
|
||||
# Manually load any other Ethernet Drivers if asked for
|
||||
if [[ "$ENABLE_USB_ETH_MODULE_MANUAL" != "" ]]; then
|
||||
for i in $(echo "$ENABLE_USB_ETH_MODULES" | tr "," "\n")
|
||||
for i in $(echo "$ENABLE_USB_ETH_MODULE_MANUAL" | tr "," "\n")
|
||||
do
|
||||
insmod $KMOD_PATH/kernel/drivers/net/usb/$i.ko
|
||||
done
|
||||
@@ -530,54 +530,7 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
|
||||
echo "rtsp audio disabled"
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_HI_RES_ENC_PARAMETER" != "" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
if [[ $RTSP_HI_RES_ENC_PARAMETER =~ "^[0|1|2|4|8]$" ]]; then
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:0:4:$RTSP_HI_RES_ENC_PARAMETER" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
else
|
||||
echo "Invalid encoder value"
|
||||
fi
|
||||
else
|
||||
if [[ $RTSP_HI_RES_ENC_PARAMETER =~ "^[0|1|2|4|8]$" ]]; then
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:44:4:$RTSP_HI_RES_ENC_PARAMETER" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
else
|
||||
echo "Invalid encoder value"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_HI_RES_MAX_BITRATE" != "" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:28:4:$RTSP_HI_RES_MAX_BITRATE" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
else
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:52:4:$RTSP_HI_RES_MAX_BITRATE" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_HI_RES_TARGET_BITRATE" != "" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
echo "not supported on T20"
|
||||
else
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:48:4:$RTSP_HI_RES_TARGET_BITRATE" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_HI_RES_FPS" != "" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:8:4:$RTSP_HI_RES_FPS" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
else
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:80:4:$RTSP_HI_RES_FPS" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
else
|
||||
echo "rtsp disabled"
|
||||
|
||||
fi
|
||||
@@ -609,50 +562,7 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
|
||||
echo "rtsp audio disabled"
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_LOW_RES_ENC_PARAMETER" != "" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
if [[ $RTSP_LOW_RES_ENC_PARAMETER =~ "^[0|1|2|4|8]$" ]]; then
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:0:4:$RTSP_LOW_RES_ENC_PARAMETER" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
else
|
||||
echo "Invalid encoder value"
|
||||
fi
|
||||
else
|
||||
if [[ $RTSP_LOW_RES_ENC_PARAMETER =~ "^[0|1|2|4|8]$" ]]; then
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:44:4:$RTSP_LOW_RES_ENC_PARAMETER" > /dev/null 2>&1 &
|
||||
else
|
||||
echo "Invalid encoder value"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_LOW_RES_MAX_BITRATE" != "" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:28:4:$RTSP_LOW_RES_MAX_BITRATE" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
else
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:52:4:$RTSP_LOW_RES_MAX_BITRATE" > /dev/null 2>&1 &
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_LOW_RES_TARGET_BITRATE" != "" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
echo "not supported on T20"
|
||||
else
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:48:4:$RTSP_LOW_RES_TARGET_BITRATE" > /dev/null 2>&1 &
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_LOW_RES_FPS" != "" ]]; then
|
||||
if [ -f /opt/wz_mini/tmp/.T20 ]; then
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:8:4:$RTSP_LOW_RES_FPS" > /dev/null 2>&1 &
|
||||
sleep 5
|
||||
else
|
||||
watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:80:4:$RTSP_LOW_RES_FPS" > /dev/null 2>&1 &
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
else
|
||||
echo "rtsp disabled"
|
||||
|
||||
fi
|
||||
@@ -662,6 +572,9 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$RTSP_HI_RES_ENABLED" == "true
|
||||
#This delay is required. Sometimes, if you start the rtsp server too soon, live view will break on the app.
|
||||
sleep 5
|
||||
LD_LIBRARY_PATH=/opt/wz_mini/lib /opt/wz_mini/bin/v4l2rtspserver $AUDIO_CH $AUDIO_FMT -F0 -U "$RTSP_LOGIN":"$RTSP_PASSWORD" -P "$RTSP_PORT" $DEVICE1 $DEVICE2 &
|
||||
sleep 1
|
||||
echo "Set imp variables via helper"
|
||||
/opt/wz_mini/usr/bin/imp_helper.sh > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
if ([[ "$RTSP_LOW_RES_ENABLED" == "true" ]] || [[ "$RTSP_HI_RES_ENABLED" == "true" ]]) && [[ "$RTMP_STREAM_ENABLED" == "true" ]] && ([[ "$RTSP_LOW_RES_ENABLE_AUDIO" == "true" ]] || [[ "$RTSP_HI_RES_ENABLE_AUDIO" == "true" ]]); then
|
||||
@@ -678,11 +591,6 @@ if [[ "$NIGHT_DROP_DISABLE" == "true" ]]; then
|
||||
touch /opt/wz_mini/tmp/.nd
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_ATBM603X_DRIVER" == "true" ]]; then
|
||||
#Reduce dmesg log spam by driver
|
||||
echo "LOG_ERR=OFF LOG_WARN=ON LOG_LMAC=ON LOG_SCAN=OFF" > /sys/module/atbm603x_wifi_sdio/atbmfs/atbm_printk_mask
|
||||
fi
|
||||
|
||||
hostname_set
|
||||
touch /opt/wz_mini/tmp/.wz_user_firstrun
|
||||
pkill -f dumpload #Kill dumpload so it won't waste cpu or ram gathering cores and uploading them when something crashes
|
||||
@@ -696,7 +604,18 @@ if [ -f "$CUSTOM_SCRIPT_PATH" ]; then
|
||||
echo "starting custom script"
|
||||
$CUSTOM_SCRIPT_PATH &
|
||||
else
|
||||
echo "custom script not found"
|
||||
echo "no custom script configured in wz_mini.conf"
|
||||
fi
|
||||
|
||||
echo "searching for custom scripts in /opt/wz_mini/etc/rc.local.d"
|
||||
if [ -d "${1:-/opt/wz_mini/etc/rc.local.d}" ] ; then
|
||||
for filename in $(find /opt/wz_mini/etc/rc.local.d/ -name "*.sh" | /opt/wz_mini/bin/busybox sort) ; do
|
||||
if [ -f "${filename}" ] && [ -x "${filename}" ]; then
|
||||
echo "running ${filename}"
|
||||
"${filename}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
echo "finished executing custom scripts from /opt/wz_mini/etc/rc.local.d"
|
||||
|
||||
echo "wz_user.sh done" > /dev/kmsg
|
||||
|
||||
0
SD_ROOT/wz_mini/etc/rc.local.d/.gitignore
vendored
Normal file
0
SD_ROOT/wz_mini/etc/rc.local.d/.gitignore
vendored
Normal file
@@ -80,6 +80,7 @@ RTMP_STREAM_TWITCH_KEY=""
|
||||
RTMP_STREAM_FACEBOOK_KEY=""
|
||||
|
||||
#####GENERAL#####
|
||||
LIBCALLBACK_ENABLE="true"
|
||||
ENABLE_SWAP="true"
|
||||
ENABLE_USB_STORAGE="false"
|
||||
ENABLE_EXT4="false"
|
||||
@@ -88,6 +89,8 @@ DISABLE_FW_UPGRADE="false"
|
||||
AUDIO_PROMPT_VOLUME="50"
|
||||
ENABLE_MP4_WRITE="false"
|
||||
NIGHT_DROP_DISABLE="false"
|
||||
DISABLE_MOTOR="false"
|
||||
ENABLE_FSCK_ON_BOOT="false"
|
||||
|
||||
#####DEBUG#####
|
||||
#drops you to a shell via serial, doesn't load app_init.sh
|
||||
|
||||
Reference in New Issue
Block a user