mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-12-23 04:33:36 +00:00
improve ability to hook stock system
This commit is contained in:
parent
f9cf541305
commit
3f1c819276
7
SD_ROOT/wz_mini/bin/factorycheck
Executable file
7
SD_ROOT/wz_mini/bin/factorycheck
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
echo [FC] mount tfcard finish!
|
||||
echo [FC] Test.tar no exist
|
||||
echo [FC] umount tfcard finish!
|
||||
echo [FC] In [user] mode!
|
||||
|
||||
touch /tmp/usrflag
|
9
SD_ROOT/wz_mini/etc/fstab
Normal file
9
SD_ROOT/wz_mini/etc/fstab
Normal file
@ -0,0 +1,9 @@
|
||||
# <file system> <mount pt> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
devpts /dev/pts devpts defaults,gid=5,mode=620 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
|
||||
media /media tmpfs mode=1777 0 0
|
||||
tmpfs /opt/wz_mini/tmp tmpfs mode=1777 0 0
|
@ -16,40 +16,42 @@ echo '
|
||||
|
||||
set -x
|
||||
|
||||
echo "mounting tempfs for workspace"
|
||||
mount -t tmpfs /tmp
|
||||
mount -t tmpfs /run
|
||||
|
||||
echo "create workspace directory"
|
||||
mkdir /run/.storage
|
||||
|
||||
if [[ $(cat /opt/wz_mini/run_mmc.sh | grep "RTSP_ENABLED\=") == "RTSP_ENABLED\=\"true\"" ]]; then
|
||||
cp /etc/init.d/rcS /run/.storage/rcS
|
||||
sed -i '/^".*/aset -x' /run/.storage/rcS
|
||||
sed -i '/^# Mount configs.*/i cp /system/bin/iCamera /run/.storage/\nmount -o ro,bind /opt/wz_mini/usr/bin/iCamera /system/bin/iCamera\n tail -f /system/bin/iCamera > /dev/null 2>&1 &' /run/.storage/rcS
|
||||
sed -i '/sbin:/s/$/:\/opt\/wz_mini\/bin/' /run/.storage/rcS
|
||||
sed -i '/system\/\lib/s/$/:\/opt\/wz_mini\/lib/' /run/.storage/rcS
|
||||
mount --bind /run/.storage/rcS /etc/init.d/rcS
|
||||
echo "load video loopback driver at video1"
|
||||
insmod /opt/wz_mini/lib/modules/v4l2loopback.ko video_nr=1
|
||||
fi
|
||||
|
||||
if [[ $(cat /opt/wz_mini/run_mmc.sh | grep "DEBUG_ENABLED\=") == "DEBUG_ENABLED\=\"true\"" ]]; then
|
||||
cp /etc/init.d/rcS /run/.storage/rcS
|
||||
sed -i '/app_init.sh/,+2d' /run/.storage/rcS
|
||||
sed -i '/^# Run init/i/bin/sh /etc/profile' /run/.storage/rcS
|
||||
mount --bind /run/.storage/rcS /etc/init.d/rcS
|
||||
fi
|
||||
|
||||
echo "replace stock password"
|
||||
cp /opt/wz_mini/etc/shadow /run/.storage/shadow
|
||||
mount --bind /run/.storage/shadow /etc/shadow
|
||||
chmod 400 /etc/shadow
|
||||
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
|
||||
|
||||
if [[ -f /opt/wz_mini/swap.gz ]]; then
|
||||
echo "mounting tempfs for workspace"
|
||||
mount -t tmpfs /tmp
|
||||
mount -t tmpfs /run
|
||||
|
||||
echo "mount system to replace factorycheck with dummy, to prevent bind unmount"
|
||||
mount /dev/mtdblock3 /system
|
||||
mount --bind /opt/wz_mini/bin/factorycheck /system/bin/factorycheck
|
||||
touch /tmp/usrflag
|
||||
|
||||
echo "replace stock fstab"
|
||||
mount --bind /opt/wz_mini/etc/fstab /etc/fstab
|
||||
|
||||
echo "mount workplace dir"
|
||||
mount -t tmpfs /opt/wz_mini/tmp
|
||||
|
||||
echo "create workspace directory"
|
||||
mkdir /opt/wz_mini/tmp/.storage
|
||||
|
||||
echo "copy stock rcS"
|
||||
cp /etc/init.d/rcS /opt/wz_mini/tmp/.storage/rcS
|
||||
|
||||
echo "add v3_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/v3_post.sh\n' /opt/wz_mini/tmp/.storage/rcS
|
||||
|
||||
echo "replace stock password"
|
||||
cp /opt/wz_mini/etc/shadow /opt/wz_mini/tmp/.storage/shadow
|
||||
mount --bind /opt/wz_mini/tmp/.storage/shadow /etc/shadow
|
||||
chmod 400 /etc/shadow
|
||||
|
||||
if [[ -e /opt/wz_mini/swap.gz ]]; then
|
||||
echo "swap archive present, extracting"
|
||||
gzip -d /opt/wz_mini/swap.gz
|
||||
mkswap /opt/wz_mini/swap
|
||||
@ -58,9 +60,6 @@ else
|
||||
echo "swap archive not present, not extracting"
|
||||
fi
|
||||
|
||||
echo "mount configs partition for dropbear"
|
||||
mount -t jffs2 /dev/mtdblock6 /configs
|
||||
|
||||
if [[ -d /opt/wz_mini/usr/share/terminfo ]]; then
|
||||
echo "terminfo already present"
|
||||
else
|
||||
@ -69,6 +68,9 @@ else
|
||||
|
||||
fi
|
||||
|
||||
echo "mount configs partition for dropbear"
|
||||
mount -t jffs2 /dev/mtdblock6 /configs
|
||||
|
||||
if [[ -d /configs/.ssh ]]; then
|
||||
echo "dropbear ssh config dir present"
|
||||
umount /configs
|
||||
@ -81,6 +83,17 @@ fi
|
||||
echo "Run dropbear ssh server"
|
||||
/opt/wz_mini/bin/dropbearmulti dropbear -R -m
|
||||
|
||||
{ sleep 30; /media/mmc/wz_mini/run_mmc.sh 2> /media/mmc/wz_mini/log/wz_mini_hacks.log; } &
|
||||
if [[ $(cat /opt/wz_mini/run_mmc.sh | grep "DEBUG_ENABLED\=") == "DEBUG_ENABLED\=\"true\"" ]]; then
|
||||
sed -i '/app_init.sh/,+2d' /opt/wz_mini/tmp/.storage/rcS
|
||||
sed -i '/^# Run init/i/bin/sh /etc/profile' /opt/wz_mini/tmp/.storage/rcS
|
||||
touch /tmp/dbgflag
|
||||
fi
|
||||
|
||||
if ! [[ -e /tmp/dbgflag ]]; then
|
||||
{ sleep 30; /media/mmc/wz_mini/run_mmc.sh 2> /media/mmc/wz_mini/log/wz_mini_hacks.log; } &
|
||||
else
|
||||
echo "debug enabled, ignore run_mmc.sh"
|
||||
fi
|
||||
|
||||
|
||||
/linuxrc
|
||||
|
16
SD_ROOT/wz_mini/etc/init.d/v3_post.sh
Executable file
16
SD_ROOT/wz_mini/etc/init.d/v3_post.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
echo "v3_post.sh"
|
||||
|
||||
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
|
||||
|
||||
if [[ $(cat /opt/wz_mini/run_mmc.sh | grep "RTSP_ENABLED\=") == "RTSP_ENABLED\=\"true\"" ]] && ! [[ -e /tmp/dbgflag ]]; then
|
||||
cp /system/bin/iCamera /opt/wz_mini/tmp/.storage/
|
||||
mount -o ro,bind /opt/wz_mini/usr/bin/iCamera /system/bin/iCamera
|
||||
echo "load video loopback driver at video1"
|
||||
insmod /opt/wz_mini/lib/modules/v4l2loopback.ko video_nr=1
|
||||
fi
|
||||
|
34
SD_ROOT/wz_mini/etc/inittab
Normal file
34
SD_ROOT/wz_mini/etc/inittab
Normal file
@ -0,0 +1,34 @@
|
||||
# /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:/sbin/swapoff -a
|
||||
::sysinit:/bin/mount -t tmpfs tmpfs /dev
|
||||
::sysinit:/bin/mkdir -p /dev/pts
|
||||
::sysinit:/bin/mkdir -p /dev/shm
|
||||
::sysinit:/bin/mount -a
|
||||
::sysinit:/bin/hostname -F /etc/hostname
|
||||
|
||||
# now run any rc scripts
|
||||
::sysinit:/opt/wz_mini/tmp/.storage/rcS
|
||||
|
||||
# Put a getty on the serial port
|
||||
console::respawn:/sbin/getty -L console 115200 vt100 # GENERIC_SERIAL
|
||||
|
||||
# Stuff to do for the 3-finger salute
|
||||
#::ctrlaltdel:/sbin/reboot
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::shutdown:/bin/umount -a -r
|
@ -12,6 +12,9 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/wz_mini/bin
|
||||
export PATH=/system/bin:$PATH
|
||||
export LD_LIBRARY_PATH=/system/lib:/opt/wz_mini/lib
|
||||
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
|
||||
export TERMINFO=/opt/wz_mini/usr/share/terminfo
|
||||
/opt/wz_mini/bin/busybox resize
|
||||
|
||||
#export TZ=UTC-8
|
||||
|
||||
# Set directoty and file default create permission
|
||||
|
@ -21,6 +21,7 @@ RTSP_ENABLE_AUDIO="false"
|
||||
ENABLE_IPV6="false"
|
||||
|
||||
DEBUG_ENABLED="false"
|
||||
#drops you to a shell via serial, doesn't load app_init.sh
|
||||
|
||||
#####################################
|
||||
##########CONFIG END#################
|
||||
@ -29,7 +30,7 @@ DEBUG_ENABLED="false"
|
||||
echo "run_mmc.sh start" > /dev/kmsg
|
||||
|
||||
swap_enable() {
|
||||
if [[ -f /media/mmc/wz_mini/swap ]]; then
|
||||
if [[ -e /media/mmc/wz_mini/swap ]]; then
|
||||
echo "swap exists, enable"
|
||||
swapon /media/mmc/wz_mini/swap
|
||||
else
|
||||
@ -112,9 +113,6 @@ fi
|
||||
echo "set hostname"
|
||||
hostname $HOSTNAME
|
||||
|
||||
echo "clean up tail"
|
||||
pkill tail
|
||||
|
||||
sleep 3
|
||||
|
||||
#################################################
|
||||
|
@ -1,5 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
echo "inject callback library and run"
|
||||
LD_PRELOAD='libcallback.so:libtinyalsa.so.2.0.0:libsetunbuf.so' /run/.storage/iCamera
|
||||
|
||||
export LD_LIBRARY_PATH='/thirdlib:/system/lib:/opt/wz_mini/lib'
|
||||
|
||||
LD_PRELOAD='libcallback.so:libtinyalsa.so.2.0.0:libsetunbuf.so' /opt/wz_mini/tmp/.storage/iCamera
|
||||
|
Loading…
Reference in New Issue
Block a user