mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-11-22 13:37:19 +00:00
iptables/nfsv4 support
This commit is contained in:
parent
26af3aa7bc
commit
57fd177328
50
README.md
50
README.md
@ -34,6 +34,7 @@ Using this project can potentially expose your device to the open internet depen
|
||||
* USB Mass storage enabled, mount USB SSD/HDD/flash drives
|
||||
* CIFS Supported
|
||||
* Play .WAV files using "aplay <file> <vol>" command
|
||||
* iptables included
|
||||
|
||||
* Inspired by HclX and WyzeHacks! Bless you for all your work! You are the master!
|
||||
|
||||
@ -81,28 +82,29 @@ Edit run_mmc.sh, this is a script stored on the micro sd card that is run when t
|
||||
Wireguard support is available as a kernel module:
|
||||
|
||||
```
|
||||
ENABLE_WIREGUARD="false"
|
||||
ENABLE_WIREGUARD="true"
|
||||
```
|
||||
|
||||
Use the command ```wg``` to setup. See [https://www.wireguard.com/quickstart/](https://www.wireguard.com/quickstart/) for more info.
|
||||
|
||||
Some users have asked about tailscale support, I have tested and it works. See the issue #30 for further information.
|
||||
---
|
||||
Disable automatic firmware updates:
|
||||
|
||||
```
|
||||
DISABLE_FW_UPGRADE="false"
|
||||
DISABLE_FW_UPGRADE="true"
|
||||
```
|
||||
|
||||
If a remote or app update is initiated, the camera will reboot due to the failure of the update. The firmware update should not proceed again for some time, or at all.
|
||||
|
||||
When a firmware update is initiated, due to a bootloader bug, we intercept the update process and flash it manually. This should now result in a successful update, if it doesn't, please restore the unit's firmware manually using demo_wcv3.bin on the micro sd card.
|
||||
When a firmware update is initiated, due to a bootloader issue (bug?), we intercept the update process and flash it manually. This should now result in a successful update, if it doesn't, please restore the unit's firmware manually using demo_wcv3.bin on the micro sd card.
|
||||
|
||||
---
|
||||
|
||||
USB Ethernet Adapter support:
|
||||
|
||||
```
|
||||
ENABLE_USB_ETH="false"
|
||||
ENABLE_USB_ETH="true"
|
||||
```
|
||||
|
||||
the next time you boot your camera, make sure your USB Ethernet Adapter is connected to the camera and ethernet. The camera has to be setup initially with Wi-Fi for this to work. After setup, Wi-Fi is no longer needed, as long as you are using the USB Ethernet Adapter. Note that using USB Ethernet disables the onboard Wi-Fi.
|
||||
@ -112,13 +114,15 @@ the next time you boot your camera, make sure your USB Ethernet Adapter is conne
|
||||
USB Direct Support:
|
||||
|
||||
```
|
||||
ENABLE_USB_DIRECT="false"
|
||||
ENABLE_USB_DIRECT="true"
|
||||
```
|
||||
|
||||
the next time you boot your camera, make sure your USB cable is connected to the router. Remember, the camera has to be setup initially with Wi-Fi for this to work. After setup, Wi-Fi is no longer needed. Note that using USB Direct disables the onboard Wi-Fi. Change the MAC Address if you desire via USB_DIRECT_MAC_ADDR variable.
|
||||
|
||||
Connectivity is supported using a direct USB connection only... this means a single cable from the camera, to a supported host (An OpenWRT router, for example) that supports the usb-cdc-ncm specification. (NCM, not ECM) If you have an OpenWrt based router, install the ```kmod-usb-net-cdc-ncm``` package. The camera should automatically pull the IP from the router with most configurations. You can also use any modern linux distro to provide internet to the camera, provided it supports CDC_NCM. enjoy!
|
||||
|
||||
Note: In my testing, the micro-usb cables included with the various cameras do not pass data, so they will not work. Make sure you have a micro-usb cable that passes data!
|
||||
|
||||
---
|
||||
|
||||
Remote Accessories:
|
||||
@ -142,12 +146,12 @@ Change ```/dev/ttyUSB0``` to whatever path your spotlight enumerated to if neces
|
||||
USB Mass Storage Support:
|
||||
|
||||
```
|
||||
ENABLE_USB_STORAGE="false"
|
||||
ENABLE_USB_STORAGE="true"
|
||||
```
|
||||
If you would like to mount an EXT3/4 filesystem, also change:
|
||||
|
||||
```
|
||||
ENABLE_EXT4="false"
|
||||
ENABLE_EXT4="true"
|
||||
```
|
||||
|
||||
---
|
||||
@ -155,27 +159,47 @@ ENABLE_EXT4="false"
|
||||
CIFS is now supported:
|
||||
|
||||
```
|
||||
ENABLE_CIFS="false"
|
||||
ENABLE_CIFS="true"
|
||||
```
|
||||
|
||||
---
|
||||
To enable RTSP streaming, change the following lines, you can choose to enable or disable audio. Set your login credentials here, you can also change the port the server listens on.
|
||||
|
||||
iptables (ipv4 and ipv6) is available:
|
||||
|
||||
```
|
||||
RTSP_ENABLED="false"
|
||||
RTSP_ENABLE_AUDIO="false"
|
||||
ENABLE_IPTABLES="true"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
NFSv4 support is available:
|
||||
|
||||
```
|
||||
ENABLE_NFSv4="true"
|
||||
```
|
||||
|
||||
---
|
||||
RTSP streaming:
|
||||
You can choose to enable or disable audio. Set your login credentials here, you can also change the port the server listens on.
|
||||
|
||||
```
|
||||
RTSP_ENABLED="true"
|
||||
RTSP_ENABLE_AUDIO="true"
|
||||
RTSP_LOGIN="admin"
|
||||
RTSP_PASSWORD=""
|
||||
RTSP_PORT="8554"
|
||||
```
|
||||
the stream will be located at ```rtsp://login:password@IP_ADDRESS:8554/unicast```
|
||||
|
||||
Note: If you don't set the password, then the password will be the unique MAC address of the camera, in all uppercase, including the colons... for example:. AA:BB:CC:00:11:22. It's typically printed on the camera. VLC seems to work fine for playback, ffmpeg and others have severe artifacts in the stream during playback. Huge credit to @mnakada for his libcallback library: [https://github.com/mnakada/atomcam_tools](https://github.com/mnakada/atomcam_tools)
|
||||
Notes: If you don't set the password, then the password will be the unique MAC address of the camera, in all uppercase, including the colons... for example:. AA:BB:CC:00:11:22. It's typically printed on the camera. VLC seems to work fine for playback, ffmpeg and others have severe artifacts in the stream during playback.
|
||||
|
||||
Huge credit to @mnakada for his libcallback library: [https://github.com/mnakada/atomcam_tools](https://github.com/mnakada/atomcam_tools)
|
||||
|
||||
---
|
||||
|
||||
## Latest Updates
|
||||
|
||||
* 05-08-22: Include iptables and NFSv4 kernel modules, enable swap ON by default.
|
||||
* 05-07-22: RTSP Server fixed, ported latest full libcallback from @mnakada with modifications.
|
||||
* 05-01-22: Removed dropbearmulti, replaced with individual binaries. dropbear dbclient dropbearkey dropbearconvert scp now included.
|
||||
* 04-30-22: Recompiled uClibc with LD_DEBUG enabled. Enable in v3_post.sh, for debugging.
|
||||
@ -192,7 +216,7 @@ Note: If you don't set the password, then the password will be the unique MAC a
|
||||
* 04-14-22: Possible memory leak with some USB adapters used, added 128MB swap file and logic as workaround to prevent oom killing
|
||||
* 04-13-22: Firmware updates are disabled by default, there is a bug in the bootloader that corrupts the kernel partition requiring the re-flash of the camera if an update is processed and the memory card is removed before next boot. The bootloader proceeds to copy the partitions and the system will not boot unless re-flashed. pending investigation.
|
||||
* 04-12-22: Updated, custom kernel loads all required items from micro sd card. System modification no longer needed.
|
||||
* 04-05-22: Update readme to indicate that telnet mod nor DNS spoofing is required for installation, and add per-requisites section.
|
||||
* 04-05-22: Update readme to indicate that telnet mod nor DNS spoofing is required for installation, and add pre-requisites section.
|
||||
* 04-02-22: Update to automatic install method, remove manual install.
|
||||
|
||||
## BYO
|
||||
|
Binary file not shown.
BIN
SD_ROOT/wz_mini/bin/bash
Executable file
BIN
SD_ROOT/wz_mini/bin/bash
Executable file
Binary file not shown.
0
SD_ROOT/wz_mini/bin/busybox
Normal file → Executable file
0
SD_ROOT/wz_mini/bin/busybox
Normal file → Executable file
@ -1,2 +1,15 @@
|
||||
#!/bin/sh
|
||||
echo "$*" | /opt/wz_mini/bin/busybox nc localhost 4000
|
||||
|
||||
if [ "$1" == "" ]; then
|
||||
echo -e "welcome to: cmd <arg>\n"
|
||||
echo -e "arg can be:"
|
||||
echo -e "jpeg (will dump raw jpeg to stdout)"
|
||||
echo -e "video on or off"
|
||||
echo -e "audio on or off"
|
||||
echo -e "move"
|
||||
echo -e "waitMotion <timeout>"
|
||||
echo -e "irled on or off"
|
||||
echo -e "aplay <file path> <volume 1-100>"
|
||||
else
|
||||
echo "$*" | /opt/wz_mini/bin/busybox nc localhost 4000
|
||||
fi
|
||||
|
2
SD_ROOT/wz_mini/bin/ip6tables
Executable file
2
SD_ROOT/wz_mini/bin/ip6tables
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
/opt/wz_mini/bin/xtables-multi ip6tables $@
|
2
SD_ROOT/wz_mini/bin/iptables
Executable file
2
SD_ROOT/wz_mini/bin/iptables
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
/opt/wz_mini/bin/xtables-multi iptables $@
|
0
SD_ROOT/wz_mini/bin/iwconfig.sh
Normal file → Executable file
0
SD_ROOT/wz_mini/bin/iwconfig.sh
Normal file → Executable file
0
SD_ROOT/wz_mini/bin/wg
Normal file → Executable file
0
SD_ROOT/wz_mini/bin/wg
Normal file → Executable file
0
SD_ROOT/wz_mini/bin/wpa_cli.sh
Normal file → Executable file
0
SD_ROOT/wz_mini/bin/wpa_cli.sh
Normal file → Executable file
BIN
SD_ROOT/wz_mini/bin/xtables-multi
Executable file
BIN
SD_ROOT/wz_mini/bin/xtables-multi
Executable file
Binary file not shown.
@ -3,6 +3,11 @@
|
||||
###DO NOT MODIFY UNLESS YOU KNOW WHAT YOU ARE DOING
|
||||
###
|
||||
|
||||
exec 1> /opt/wz_mini/log/v3_init.log 2>&1
|
||||
|
||||
echo "welcome to v3_init.sh"
|
||||
echo "PID $$"
|
||||
|
||||
echo '
|
||||
__ ________ __ __ _____ _ _ _____
|
||||
\ \ / |___ / | \/ |_ _| \ | |_ _|
|
||||
@ -43,7 +48,7 @@ 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 tempfs for workspace"
|
||||
echo "mounting tmpfs"
|
||||
mount -t tmpfs /tmp
|
||||
|
||||
echo "mount system to replace factorycheck with dummy, to prevent bind unmount"
|
||||
@ -83,6 +88,9 @@ 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
|
||||
|
||||
echo "mount kernel modules"
|
||||
mount --bind /opt/wz_mini/lib/modules /lib/modules
|
||||
|
||||
if [[ -e /opt/wz_mini/swap.gz ]]; then
|
||||
insmod /opt/wz_mini/lib/modules/audio.ko spk_gpio=$GPIO alc_mode=0 mic_gain=0
|
||||
/opt/wz_mini/bin/audioplay_t31 /opt/wz_mini/usr/share/audio/swap.wav 50
|
||||
@ -90,7 +98,7 @@ 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
|
||||
sync;echo 3 > /proc/sys/vm/drop_caches;free
|
||||
sync;echo 3 > /proc/sys/vm/drop_caches
|
||||
else
|
||||
echo "swap archive not present, not extracting"
|
||||
fi
|
||||
@ -113,7 +121,7 @@ if [[ $(cat /opt/wz_mini/run_mmc.sh | grep "DEBUG_ENABLED\=") == "DEBUG_ENABLED\
|
||||
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; } &
|
||||
/opt/wz_mini/run_mmc.sh &
|
||||
else
|
||||
echo "debug enabled, ignore run_mmc.sh"
|
||||
fi
|
||||
|
@ -2,6 +2,11 @@
|
||||
|
||||
##THIS FILE IS CALLED BY rcS, EXECUTED BEFORE app_init.sh IS RUN.
|
||||
|
||||
exec 1> /opt/wz_mini/log/v3_post.log 2>&1
|
||||
|
||||
echo "welcome to v3_post.sh"
|
||||
echo "PID $$"
|
||||
|
||||
set -x
|
||||
|
||||
echo "v3_post.sh exec"
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
SD_ROOT/wz_mini/mnt/.gitignore
vendored
Normal file
0
SD_ROOT/wz_mini/mnt/.gitignore
vendored
Normal file
0
SD_ROOT/wz_mini/root/.gitignore
vendored
Normal file
0
SD_ROOT/wz_mini/root/.gitignore
vendored
Normal file
@ -1,5 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec 1> /opt/wz_mini/log/run_mmc.log 2>&1
|
||||
|
||||
echo "welcome to run_mmc.sh"
|
||||
echo "PID $$"
|
||||
|
||||
set -x
|
||||
|
||||
HOSTNAME="WCV3"
|
||||
@ -16,6 +21,10 @@ ENABLE_IPV6="false"
|
||||
|
||||
ENABLE_WIREGUARD="false"
|
||||
|
||||
ENABLE_IPTABLES="false"
|
||||
|
||||
ENABLE_NFSv4="false"
|
||||
|
||||
#####ACCESSORIES#####
|
||||
REMOTE_SPOTLIGHT="false"
|
||||
REMOTE_SPOTLIGHT_HOST="0.0.0.0"
|
||||
@ -28,6 +37,7 @@ RTSP_PASSWORD=""
|
||||
RTSP_PORT="8554"
|
||||
|
||||
#####GENERAL#####
|
||||
ENABLE_SWAP="true"
|
||||
ENABLE_USB_STORAGE="false"
|
||||
ENABLE_EXT4="false"
|
||||
ENABLE_CIFS="false"
|
||||
@ -43,40 +53,243 @@ DEBUG_ENABLED="false"
|
||||
|
||||
echo "run_mmc.sh start" > /dev/kmsg
|
||||
|
||||
echo "store original mac"
|
||||
cat /sys/class/net/wlan0/address | tr '[:lower:]' '[:upper:]' > /opt/wz_mini/tmp/wlan0_mac
|
||||
hostname_set() {
|
||||
echo "set hostname"
|
||||
hostname $HOSTNAME
|
||||
}
|
||||
|
||||
swap_enable() {
|
||||
if [[ -e /media/mmc/wz_mini/swap ]]; then
|
||||
echo "swap exists, enable"
|
||||
swapon /media/mmc/wz_mini/swap
|
||||
else
|
||||
echo "swap missing, system stability with usb potentially comprimised"
|
||||
first_run_check() {
|
||||
if [[ -e /opt/wz_mini/tmp/.run_mmc_firstrun ]]; then
|
||||
echo "run_mmc.sh already run once, exit."
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
wait_sdroot() {
|
||||
##Stall execution if the micro-sd card isn't mounted yet, iCamera controls this internally.
|
||||
while true
|
||||
do
|
||||
if [[ -d /media/mmc/wz_mini ]]; then
|
||||
echo "sd card ready"
|
||||
break
|
||||
fi
|
||||
echo "sdcard not ready yet..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
wait_wlan() {
|
||||
##Check if the driver has been loaded for the onboard wlan0, store the MAC.
|
||||
while true
|
||||
do
|
||||
if ifconfig wlan0 | grep "inet addr";
|
||||
then
|
||||
echo "store original mac"
|
||||
cat /sys/class/net/wlan0/address | tr '[:lower:]' '[:upper:]' > /opt/wz_mini/tmp/wlan0_mac
|
||||
break
|
||||
elif [[ "$ENABLE_USB_ETH" == "true" || "$ENABLE_USB_DIRECT" == "true" ]]; then
|
||||
break
|
||||
fi
|
||||
echo " wlan0 not ready yet..."
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
rename_interface() {
|
||||
##Fool iCamera by renaming the hardline interface to wlan0
|
||||
echo "renaming interfaces"
|
||||
ifconfig $1 down
|
||||
ifconfig wlan0 down
|
||||
/media/mmc/wz_mini/bin/busybox ip link set wlan0 name wlanold
|
||||
/media/mmc/wz_mini/bin/busybox ip addr flush dev wlanold
|
||||
/media/mmc/wz_mini/bin/busybox ip link set $1 name wlan0
|
||||
eth_wlan_up
|
||||
}
|
||||
|
||||
eth_wlan_up() {
|
||||
##Run DHCP client, and bind mount our fake wpa_cli.sh to fool iCamera
|
||||
if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
|
||||
/media/mmc/wz_mini/bin/busybox ip link set wlan0 address $USB_DIRECT_MAC_ADDR
|
||||
fi
|
||||
ifconfig wlan0 up
|
||||
pkill udhcpc
|
||||
udhcpc -i wlan0 -x hostname:$HOSTNAME -p /var/run/udhcpc.pid -b
|
||||
mount -o bind /media/mmc/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
|
||||
break
|
||||
}
|
||||
|
||||
wpa_check() {
|
||||
#Check if wpa_supplicant has been created by iCamera
|
||||
if [[ -e /tmp/wpa_supplicant.conf ]]; then
|
||||
echo "wpa_supplicant.conf ready"
|
||||
wlanold_check $1
|
||||
else
|
||||
echo "wpa_supplicant.conf not ready, wait some time for creation."
|
||||
COUNT=0
|
||||
ATTEMPTS=15
|
||||
until [[ -e /tmp/wpa_supplicant.conf ]] || [[ $COUNT -eq $ATTEMPTS ]]; do
|
||||
echo -e "$(( COUNT++ ))... \c"
|
||||
sleep 5
|
||||
done
|
||||
[[ $COUNT -eq $ATTEMPTS ]] && echo "time exceeded waiting for iCamera, continue potentially broken condition without network." && wlanold_check $1
|
||||
fi
|
||||
}
|
||||
|
||||
wlanold_check() {
|
||||
#Have we renamed interfaces yet?
|
||||
if [[ -d /sys/class/net/wlanold ]]; then
|
||||
echo "wlanold exist"
|
||||
eth_wlan_up
|
||||
else
|
||||
echo "wlanold doesn't exist"
|
||||
rename_interface $1
|
||||
fi
|
||||
}
|
||||
|
||||
netloop() {
|
||||
##While loop for check
|
||||
while true
|
||||
do
|
||||
wpa_check $1
|
||||
echo "wlan0 not ready yet..."
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
swap_enable() {
|
||||
if [[ -e /media/mmc/wz_mini/swap ]]; then
|
||||
echo "Swap exists, enable"
|
||||
swapon /media/mmc/wz_mini/swap
|
||||
else
|
||||
echo "Swap file missing!"
|
||||
fi
|
||||
}
|
||||
|
||||
first_run_check
|
||||
hostname_set
|
||||
wait_sdroot
|
||||
wait_wlan
|
||||
|
||||
|
||||
if [[ "$ENABLE_SWAP" == "true" ]]; then
|
||||
if cat /proc/swaps | grep "mini" ; then
|
||||
echo "Swap is already enabled"
|
||||
else
|
||||
echo "Swap not enabled, enabling"
|
||||
swap_enable
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_IPV6" == "true" ]]; then
|
||||
echo "ipv6 enabled"
|
||||
else
|
||||
echo "ipv6 disabled"
|
||||
sysctl -w net.ipv6.conf.all.disable_ipv6=1
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_NFSv4" == "true" ]]; then
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/lib/oid_registry.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/dns_resolver/dns_resolver.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/fs/nfs/nfsv4.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko
|
||||
echo nfsv4 enabled
|
||||
else
|
||||
echo nfsv4 disabled
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_IPTABLES" == "true" ]]; then
|
||||
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/netfilter/x_tables.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv4/netfilter/ip_tables.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv4/netfilter/ipt_REJECT.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv4/netfilter/iptable_filter.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv4/netfilter/iptable_mangle.ko
|
||||
echo "iptables ipv4 enabled"
|
||||
|
||||
if [[ "$ENABLE_IPV6" == "true" ]]; then
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv6/netfilter/ip6_tables.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv6/netfilter/ip6t_REJECT.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv6/netfilter/ip6table_filter.ko
|
||||
insmod /lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv6/netfilter/ip6table_mangle.ko
|
||||
echo "iptables ipv6 enabled"
|
||||
fi
|
||||
else
|
||||
echo "iptables disabled"
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_USB_ETH" == "true" ]]; then
|
||||
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/net/usb/usbnet.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/net/usb/asix.ko
|
||||
|
||||
if [[ "$ENABLE_SWAP" == "true" ]]; then
|
||||
echo "swap already enabled"
|
||||
else
|
||||
swap_enable
|
||||
fi
|
||||
|
||||
netloop eth0
|
||||
|
||||
else
|
||||
echo "usb ethernet disabled"
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
|
||||
|
||||
#Set dwc2 ID_PIN driver memory
|
||||
devmem 0x13500000 32 0x001100cc
|
||||
devmem 0x10000040 32 0x0b000096
|
||||
#wipe the bits to set the ID_PIN
|
||||
devmem 0x10000040 32 0x0b000FFF
|
||||
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/libcomposite.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/u_ether.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/usb_f_ncm.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/g_ncm.ko iManufacturer=wz_mini_ncm
|
||||
|
||||
sleep 1
|
||||
|
||||
if [[ "$ENABLE_SWAP" == "true" ]]; then
|
||||
echo "swap already enabled"
|
||||
else
|
||||
swap_enable
|
||||
fi
|
||||
|
||||
#loop begin
|
||||
while true
|
||||
do
|
||||
wpa_check usb0
|
||||
echo "wlan0 not ready yet..."
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
echo "usb direct disabled"
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_USB_RNDIS" == "true" ]]; then
|
||||
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/net/usb/usbnet.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/net/usb/cdc_ether.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/net/usb/rndis_host.ko
|
||||
|
||||
sleep 1
|
||||
|
||||
if [[ "$ENABLE_SWAP" == "true" ]]; then
|
||||
echo "swap already enabled"
|
||||
else
|
||||
swap_enable
|
||||
fi
|
||||
|
||||
ifconfig usb0 down
|
||||
ifconfig wlan0 down
|
||||
|
||||
/media/mmc/wz_mini/bin/busybox ip link set wlan0 name wlanold
|
||||
/media/mmc/wz_mini/bin/busybox ip addr flush dev wlanold
|
||||
/media/mmc/wz_mini/bin/busybox ip link set usb0 name wlan0
|
||||
|
||||
ifconfig wlan0 up
|
||||
pkill udhcpc
|
||||
udhcpc -i wlan0 -x hostname:$HOSTNAME -p /var/run/udhcpc.pid -b
|
||||
# sleep 5
|
||||
mount -o bind /media/mmc/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
|
||||
|
||||
else
|
||||
echo "rndis disabled"
|
||||
#loop begin
|
||||
while true
|
||||
do
|
||||
wpa_check usb0
|
||||
echo "wlan0 not ready yet..."
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
echo "usb direct disabled"
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_WIREGUARD" == "true" ]]; then
|
||||
@ -109,67 +322,6 @@ else
|
||||
echo "ext4 disabled"
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_IPV6" == "true" ]]; then
|
||||
echo "ipv6 enabled"
|
||||
else
|
||||
echo "ipv6 disabled"
|
||||
sysctl -w net.ipv6.conf.all.disable_ipv6=1
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_USB_ETH" == "true" ]]; then
|
||||
|
||||
swap_enable
|
||||
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/net/usb/usbnet.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/net/usb/asix.ko
|
||||
|
||||
ifconfig eth0 down
|
||||
ifconfig wlan0 down
|
||||
|
||||
/media/mmc/wz_mini/bin/busybox ip link set wlan0 name wlanold
|
||||
/media/mmc/wz_mini/bin/busybox ip addr flush dev wlanold
|
||||
/media/mmc/wz_mini/bin/busybox ip link set eth0 name wlan0
|
||||
|
||||
ifconfig wlan0 up
|
||||
pkill udhcpc
|
||||
udhcpc -i wlan0 -x hostname:$HOSTNAME -p /var/run/udhcpc.pid -b
|
||||
# sleep 5
|
||||
mount -o bind /media/mmc/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
|
||||
else
|
||||
echo "usb ethernet disabled"
|
||||
fi
|
||||
|
||||
if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
|
||||
|
||||
#Set dwc2 ID_PIN driver memory
|
||||
devmem 0x13500000 32 0x001100cc
|
||||
devmem 0x10000040 32 0x0b000096
|
||||
#wipe the bits to set the ID_PIN
|
||||
devmem 0x10000040 32 0x0b000FFF
|
||||
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/libcomposite.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/u_ether.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/usb_f_ncm.ko
|
||||
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/gadget/g_ncm.ko iManufacturer=wz_mini_ncm
|
||||
|
||||
sleep 1
|
||||
|
||||
ifconfig usb0 down
|
||||
ifconfig wlan0 down
|
||||
/media/mmc/wz_mini/bin/busybox ip link set wlan0 name wlanold
|
||||
/media/mmc/wz_mini/bin/busybox ip addr flush dev wlanold
|
||||
/media/mmc/wz_mini/bin/busybox ip link set usb0 name wlan0
|
||||
/media/mmc/wz_mini/bin/busybox ip link set wlan0 address $USB_DIRECT_MAC_ADDR
|
||||
|
||||
ifconfig wlan0 up
|
||||
pkill udhcpc
|
||||
udhcpc -i wlan0 -x hostname:$HOSTNAME -p /var/run/udhcpc.pid -b
|
||||
sleep 5
|
||||
mount -o bind /media/mmc/wz_mini/bin/wpa_cli.sh /bin/wpa_cli
|
||||
else
|
||||
echo "usb direct disabled"
|
||||
fi
|
||||
|
||||
if [[ "$DISABLE_FW_UPGRADE" == "true" ]]; then
|
||||
mkdir /tmp/Upgrade
|
||||
mount -t tmpfs -o size=1,nr_inodes=1 none /tmp/Upgrade
|
||||
@ -181,17 +333,26 @@ else
|
||||
fi
|
||||
|
||||
if [[ "$REMOTE_SPOTLIGHT" == "true" ]]; then
|
||||
{ sleep 10; /media/mmc/wz_mini/bin/socat pty,link=/dev/ttyUSB0,raw tcp:$REMOTE_SPOTLIGHT_HOST:9000; } &
|
||||
|
||||
/media/mmc/wz_mini/bin/socat pty,link=/dev/ttyUSB0,raw tcp:$REMOTE_SPOTLIGHT_HOST:9000 &
|
||||
echo "remote accessory enabled"
|
||||
else
|
||||
echo "remote accessory disabled"
|
||||
fi
|
||||
|
||||
if [[ "$RTSP_ENABLED" == "true" ]]; then
|
||||
|
||||
if [[ "$ENABLE_SWAP" == "true" ]]; then
|
||||
echo "swap already enabled"
|
||||
else
|
||||
swap_enable
|
||||
fi
|
||||
|
||||
mkdir /tmp/alsa
|
||||
cp /media/mmc/wz_mini/etc/alsa.conf /tmp/alsa
|
||||
/opt/wz_mini/bin/cmd video on
|
||||
/opt/wz_mini/bin/cmd audio on
|
||||
|
||||
|
||||
if [[ "$RTSP_PASSWORD" = "" ]]; then
|
||||
RTSP_PASSWORD=$(cat /opt/wz_mini/tmp/wlan0_mac)
|
||||
fi
|
||||
@ -206,9 +367,8 @@ if [[ "$RTSP_ENABLED" == "true" ]]; then
|
||||
echo "rtsp disabled"
|
||||
fi
|
||||
|
||||
echo "set hostname"
|
||||
hostname $HOSTNAME
|
||||
|
||||
touch /opt/wz_mini/tmp/.run_mmc_firstrun
|
||||
sync;echo 3 > /proc/sys/vm/drop_caches
|
||||
sleep 3
|
||||
|
||||
#################################################
|
||||
|
Loading…
Reference in New Issue
Block a user