move kernel stuff to modules, rndis support, cdc_ncm

This commit is contained in:
Alfonso Gamboa 2022-04-30 02:01:45 -07:00
parent a021a9d88d
commit 2db8df1c19
33 changed files with 282 additions and 27 deletions

View File

@ -6,7 +6,7 @@ Run whatever firmware you want on your v3/PANv2 and have root access to the devi
**Do not contact the manufacturer for information or support, they will not be able to assist or advise you!**
## Important matters related to security
Using this project can potentially expose your device to the open internet depending on the configuration of your network. You alone are reponsible for the configuration and security of your network, make sure you are aware of the risks involved before using.
Using this project can potentially expose your device to the open internet depending on the configuration of your network. You alone are responsible for the configuration and security of your network, make sure you are aware of the risks involved before using.
## Related Projects:
* wz_mini_debian: run full debian in a chroot, on the camera!
@ -30,12 +30,14 @@ Using this project can potentially expose your device to the open internet depen
* Works on ANY firmware release (so far!)
* DNS Spoofing or Telnet mod are *not* required prior to installation
* RTSP Server included, stream video and or audio over LAN
* Tethering to android phones via RNDIS
* USB Mass storage enabled, mount USB SSD/HDD/flash drives
* CIFS Supported
* Inspired by HclX and WyzeHacks! Bless you for all your work! You are the master!
## Coming Soon
* Enable tethering to android phones (RNDIS)
* ???
## How you can help!
* RTSP Server: Live view in the app doesn't work when set to "HD" or "SD", need to check libcallback sources to see why this happens, if you can help with this, check it out.
@ -78,11 +80,18 @@ Using this project can potentially expose your device to the open internet depen
Edit run_mmc.sh, this is a script stored on the micro sd card that is run when the camera boots. You can change the hostname of the camera, mount NFS, add ping commands, anything you like.
---
Wireguard support is compiled into the kernel. Use the command ```wg``` to setup. See [https://www.wireguard.com/quickstart/](https://www.wireguard.com/quickstart/) for more info.
Wireguard support is available as a kernel module:
```
ENABLE_WIREGUARD="false"
```
Use the command ```wg``` to setup. See [https://www.wireguard.com/quickstart/](https://www.wireguard.com/quickstart/) for more info.
---
To disable automatic firmware updates, edit run_mmc.sh in the wz_mini directory on your micro sd card,
change:
Disable automatic firmware updates:
```
DISABLE_FW_UPGRADE="false"
```
@ -93,8 +102,8 @@ When a firmware update is initiated, due to a bootloader bug, we intercept the u
---
To enable USB Ethernet Adapter support,
change:
USB Ethernet Adapter support:
```
ENABLE_USB_ETH="false"
```
@ -103,13 +112,8 @@ the next time you boot your camera, make sure your USB Ethernet Adapter is conne
---
To enable USB Direct Support:
USB Direct Support:
1. In "wz_mini" folder, there is another folder called "USB_DIRECT". Copy the file inside, named "factory_t31_ZMC6tiIDQN_USBDIRECT" to the root of your memory card and rename it to "factory_t31_ZMC6tiIDQN". This special kernel is required to enable USB Direct, the standard kernel does not work.
2. Edit run_mmc.sh:
change:
```
ENABLE_USB_DIRECT="false"
```
@ -119,6 +123,9 @@ the next time you boot your camera, make sure your USB cable is connected to the
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!
---
Remote Accessories:
When USB Direct connectivity is enabled, the camera will be unable to communicate with accessories. To enable remote spotlight accessory support, enable the following variable and set the IP Address of the host as follows:
```
REMOTE_SPOTLIGHT="true"
@ -133,6 +140,27 @@ socat TCP4-LISTEN:9000,reuseaddr,fork /dev/ttyUSB0,raw,echo=0
Change ```/dev/ttyUSB0``` to whatever path your spotlight enumerated to if necessary. The camera will now be able to control the spotlight.
---
USB Mass Storage Support:
```
ENABLE_USB_STORAGE="false"
```
If you would like to mount an EXT3/4 filesystem, also change:
```
ENABLE_EXT4="false"
```
---
CIFS is now supported:
```
ENABLE_CIFS="false"
```
---
__WARNING: RTSP support is experimental and I consider it to be broken. Use it only if you know what you are doing! The outdated stock RTSP firmware works much better at the moment.__
@ -155,7 +183,8 @@ __WARNING__: If using the wyze app to view the live stream, viewing in "HD" or
## Latest Updates
* 04-26-22: Add customizable PATH hook in v3_init.sh, and add audioplay_t31 binary for playing audio files before iCamera loads.
* 04-30-22: Move built-in kernel stuff to modules, usb_direct kernel no longer needed, modules now included. Added usb-storage support for usb hdd/ssd/flash drive, cifs support, and rndis support for tethering camera directly to a mobile device.
* 04-26-22: Add customization of PATH via hook in v3_init.sh, and add audioplay_t31 binary for playing audio files before iCamera loads.
* 04-21-22: Add authentication to rtsp server. use default password as unique device mac address.
* 04-21-22: Updated dropbear ssh, enabled public key authentication, disable password auth.
* 04-21-22: wz_mini/tmp folder was missing in git, preventing the camera from booting. Fixed.
@ -172,7 +201,7 @@ __WARNING__: If using the wyze app to view the live stream, viewing in "HD" or
## BYO
Build your own!!at the moment
Build your own!!
[https://github.com/mnakada/atomcam_tools](https://github.com/mnakada/atomcam_tools) has a great repo with docker images which include kernel sources, config, and a whole bunch of other stuff. Check it out.

Binary file not shown.

View File

@ -14,6 +14,8 @@ echo '
|______|
'
sleep 2
set -x
if [[ -e /opt/wz_mini/etc/.first_boot ]]; then
@ -33,7 +35,6 @@ mount --bind /opt/wz_mini/etc/profile /etc/profile
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
@ -46,6 +47,10 @@ mount --bind /opt/wz_mini/etc/fstab /etc/fstab
echo "mount workplace dir"
mount -t tmpfs /opt/wz_mini/tmp
echo "install busybox applets"
mkdir /opt/wz_mini/tmp/.bin
/opt/wz_mini/bin/busybox --install -s /opt/wz_mini/tmp/.bin
echo "create workspace directory"
mkdir /opt/wz_mini/tmp/.storage
@ -60,8 +65,8 @@ 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
#Custom PATH hooks
#sed -i '/^# Run init script.*/i#Hook Library PATH here\nexport LD_LIBRARY_PATH=/tmp/test/lib:$LD_LIBRARY_PATH\nexport' /opt/wz_mini/tmp/.storage/rcS
#sed -i '/^# Run init script.*/i#Hook system PATH here\nexport PATH=/tmp/test/bin:$PATH\nexport' /opt/wz_mini/tmp/.storage/rcS
#sed -i '/^# Run init script.*/i#Hook Library PATH here\nexport LD_LIBRARY_PATH=/tmp/test/lib:$LD_LIBRARY_PATH\n' /opt/wz_mini/tmp/.storage/rcS
#sed -i '/^# Run init script.*/i#Hook system PATH here\nexport PATH=/tmp/test/bin:$PATH\n' /opt/wz_mini/tmp/.storage/rcS
echo "replace stock password"
cp /opt/wz_mini/etc/shadow /opt/wz_mini/tmp/.storage/shadow

View File

@ -8,12 +8,13 @@ if [ "$PS1" ]; then
fi
# Set terminal env
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 PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH=/opt/wz_mini/tmp/.bin:/opt/wz_mini/bin:/system/bin:$PATH
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/opt/wz_mini/lib:/thirdlib:$LD_LIBRARY_PATH
export TERMINFO=/opt/wz_mini/usr/share/terminfo
export TERM=xterm-color
/opt/wz_mini/bin/busybox resize
#export TZ=UTC-8

View File

@ -0,0 +1,116 @@
kernel/arch/mips/xburst/soc-t31/chip-t31/isvp/common/keyboard_gpio.ko
kernel/arch/mips/xburst/soc-t31/chip-t31/isvp/common/i2c_bus.ko
kernel/arch/mips/xburst/soc-t31/chip-t31/isvp/common/spi_bus.ko
kernel/fs/binfmt_script.ko
kernel/fs/configfs/configfs.ko
kernel/fs/fat/fat.ko
kernel/fs/fat/vfat.ko
kernel/fs/jffs2/jffs2.ko
kernel/fs/lockd/lockd.ko
kernel/fs/nfs/nfs.ko
kernel/fs/nfs/nfsv2.ko
kernel/fs/nfs/nfsv3.ko
kernel/fs/nls/nls_base.ko
kernel/fs/nls/nls_cp437.ko
kernel/fs/nls/nls_ascii.ko
kernel/fs/nls/nls_iso8859-1.ko
kernel/fs/squashfs/squashfs.ko
kernel/crypto/crypto.ko
kernel/crypto/crypto_wq.ko
kernel/crypto/crypto_algapi.ko
kernel/crypto/aead.ko
kernel/crypto/crypto_blkcipher.ko
kernel/crypto/chainiv.ko
kernel/crypto/eseqiv.ko
kernel/crypto/crypto_hash.ko
kernel/crypto/pcompress.ko
kernel/crypto/cryptomgr.ko
kernel/crypto/hmac.ko
kernel/crypto/md5.ko
kernel/crypto/sha1_generic.ko
kernel/crypto/sha256_generic.ko
kernel/crypto/ecb.ko
kernel/crypto/cbc.ko
kernel/crypto/des_generic.ko
kernel/crypto/aes_generic.ko
kernel/crypto/arc4.ko
kernel/crypto/deflate.ko
kernel/crypto/michael_mic.ko
kernel/crypto/crc32c.ko
kernel/crypto/authenc.ko
kernel/crypto/authencesn.ko
kernel/crypto/rng.ko
kernel/crypto/krng.ko
kernel/block/cfq-iosched.ko
kernel/drivers/base/firmware_class.ko
kernel/drivers/block/brd.ko
kernel/drivers/block/loop.ko
kernel/drivers/block/zram/zram.ko
kernel/drivers/i2c/i2c-core.ko
kernel/drivers/i2c/algos/i2c-algo-bit.ko
kernel/drivers/i2c/busses/i2c-gpio.ko
kernel/drivers/i2c/busses/i2c-v12-jz.ko
kernel/drivers/input/input-core.ko
kernel/drivers/input/evdev.ko
kernel/drivers/input/keyboard/gpio_keys.ko
kernel/drivers/media/media.ko
kernel/drivers/media/v4l2-core/videodev.ko
kernel/drivers/media/v4l2-core/v4l2-int-device.ko
kernel/drivers/media/v4l2-core/v4l2-common.ko
kernel/drivers/media/v4l2-core/videobuf2-core.ko
kernel/drivers/media/v4l2-core/videobuf2-memops.ko
kernel/drivers/mfd/mfd-core.ko
kernel/drivers/mfd/jz_tcu.ko
kernel/drivers/misc/logger.ko
kernel/drivers/mmc/card/mmc_block.ko
kernel/drivers/mmc/core/mmc_core.ko
kernel/drivers/mmc/host/jzmmc_v12.ko
kernel/drivers/mtd/mtd.ko
kernel/drivers/mtd/cmdlinepart.ko
kernel/drivers/mtd/mtd_blkdevs.ko
kernel/drivers/mtd/mtdblock.ko
kernel/drivers/mtd/chips/chipreg.ko
kernel/drivers/mtd/devices/jz_sfc.ko
kernel/drivers/net/macvlan.ko
kernel/drivers/net/mii.ko
kernel/drivers/net/tun.ko
kernel/drivers/net/phy/libphy.ko
kernel/drivers/regulator/fixed.ko
kernel/drivers/switch/switch_class.ko
kernel/drivers/tty/serial/serial_core.ko
kernel/drivers/tty/serial/jz_uart.ko
kernel/drivers/usb/usb-common.ko
kernel/drivers/usb/core/usbcore.ko
kernel/drivers/usb/dwc2/dwc2.ko
kernel/drivers/usb/dwc2/dwc2_jz.ko
kernel/drivers/usb/gadget/udc-core.ko
kernel/drivers/watchdog/jz_wdt.ko
kernel/sound/soundcore.ko
kernel/sound/sound_firmware.ko
kernel/sound/core/snd.ko
kernel/sound/core/snd-timer.ko
kernel/sound/core/snd-pcm.ko
kernel/sound/core/snd-page-alloc.ko
kernel/sound/drivers/snd-aloop.ko
kernel/net/ipv4/esp4.ko
kernel/net/ipv4/inet_diag.ko
kernel/net/ipv4/tcp_diag.ko
kernel/net/ipv4/tcp_cubic.ko
kernel/net/ipv6/ipv6.ko
kernel/net/ipv6/inet6_hashtables.ko
kernel/net/mac80211/mac80211.ko
kernel/net/packet/af_packet.ko
kernel/net/sunrpc/sunrpc.ko
kernel/net/unix/unix.ko
kernel/net/wireless/cfg80211.ko
kernel/net/xfrm/xfrm_algo.ko
kernel/lib/bitrev.ko
kernel/lib/crc16.ko
kernel/lib/crc32.ko
kernel/lib/lz4/lz4_compress.ko
kernel/lib/lz4/lz4_decompress.ko
kernel/lib/lzo/lzo_compress.ko
kernel/lib/lzo/lzo_decompress.ko
kernel/lib/xz/xz_dec.ko
kernel/lib/zlib_deflate/zlib_deflate.ko
kernel/lib/zlib_inflate/zlib_inflate.ko

View File

@ -0,0 +1,24 @@
kernel/fs/mbcache.ko
kernel/fs/fscache/fscache.ko
kernel/fs/ext4/ext4.ko
kernel/fs/jbd2/jbd2.ko
kernel/fs/cifs/cifs.ko
kernel/crypto/md4.ko
kernel/drivers/net/usb/r8152.ko
kernel/drivers/net/usb/asix.ko
kernel/drivers/net/usb/ax88179_178a.ko
kernel/drivers/net/usb/cdc_ether.ko
kernel/drivers/net/usb/rndis_host.ko
kernel/drivers/net/usb/usbnet.ko
kernel/drivers/usb/storage/usb-storage.ko
kernel/drivers/usb/gadget/libcomposite.ko
kernel/drivers/usb/gadget/u_ether.ko
kernel/drivers/usb/gadget/usb_f_ncm.ko
kernel/drivers/usb/gadget/g_ncm.ko
kernel/drivers/scsi/scsi_mod.ko
kernel/drivers/scsi/sd_mod.ko
kernel/net/ipv4/ip_tunnel.ko
kernel/net/ipv4/tunnel4.ko
kernel/net/ipv6/sit.ko
kernel/net/wireguard/wireguard.ko
kernel/net/dns_resolver/dns_resolver.ko

View File

@ -6,22 +6,32 @@ DISABLE_FW_UPGRADE="false"
HOSTNAME="WCV3"
#####NETWORKING#####
ENABLE_USB_ETH="false"
ENABLE_USB_DIRECT="false"
USB_DIRECT_MAC_ADDR="02:01:02:03:04:08"
ENABLE_USB_RNDIS="false"
#####ACCESSORIES#####
REMOTE_SPOTLIGHT="false"
REMOTE_SPOTLIGHT_HOST="0.0.0.0"
#####VIDEO STREAM#####
RTSP_ENABLED="false"
RTSP_ENABLE_AUDIO="false"
RTSP_LOGIN="admin"
RTSP_PASSWORD=""
RTSP_PORT="8554"
#####GENERAL#####
ENABLE_IPV6="false"
ENABLE_USB_STORAGE="false"
ENABLE_WIREGUARD="false"
ENABLE_EXT4="false"
ENABLE_CIFS="false"
#####DEBUG#####
DEBUG_ENABLED="false"
#drops you to a shell via serial, doesn't load app_init.sh
@ -43,6 +53,60 @@ swap_enable() {
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
swap_enable
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"
fi
if [[ "$ENABLE_WIREGUARD" == "true" ]]; then
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv4/tunnel4.ko
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/ipv4/ip_tunnel.ko
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/net/wireguard/wireguard.ko
else
echo "wireguard disabled"
fi
if [[ "$ENABLE_CIFS" == "true" ]]; then
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/fs/cifs/cifs.ko
else
echo "cifs disabled"
fi
if [[ "$ENABLE_USB_STORAGE" == "true" ]]; then
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/scsi/scsi_mod.ko
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/scsi/sd_mod.ko
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/drivers/usb/storage/usb-storage.ko
else
echo "usb_storage disabled"
fi
if [[ "$ENABLE_EXT4" == "true" ]]; then
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/fs/jbd2/jbd2.ko
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/fs/mbcache.ko
insmod /opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__/kernel/fs/ext4/ext4.ko
else
echo "ext4 disabled"
fi
if [[ "$ENABLE_IPV6" == "true" ]]; then
echo "ipv6 enabled"
else
@ -54,6 +118,9 @@ 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
@ -71,7 +138,20 @@ if [[ "$ENABLE_USB_ETH" == "true" ]]; then
fi
if [[ "$ENABLE_USB_DIRECT" == "true" ]]; then
##ONLY WORKS WITH g_ethernet enabled kernel
#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

View File

@ -5,7 +5,7 @@ build kernel with initramfs
initramfs ```/etc/init``` runs ```exec busybox switch_root /v3 /opt/wz_mini/etc/init.d/v3_init.sh```
```/opt/wz_mini/etc/init.d/v3_init.sh```
within ```/opt/wz_mini/etc/init.d/v3_init.sh```:
bind replace ```/etc/init.d/inittab``` with our own version that has rcS located at ```/opt/wz_mini/tmp/.storage/rcS```
@ -23,7 +23,7 @@ create wz_mini's workplace directory at ```/opt/wz_mini/tmp```
copy the stock ```/etc/init.d/rcS``` to the workplace directory
modify the stock rcS, add ```set -x``` debug mode and inject the following script ```/opt/wz_mini/etc/init.d/v3_post.sh``` to run
modify the stock rcS, add ```set -x``` debug mode, inject the following script ```/opt/wz_mini/etc/init.d/v3_post.sh``` to run, and add a section to change PATH and LD_LIBRARY if desired
bind replace ```/etc/shadow``` to change the stock password
@ -60,4 +60,4 @@ Normally, ```iCamera``` downloads the firmware upgrade tar to ```/tmp/img```, re
```watch_up.sh``` will then proceed to flash the main partitions directly, instead of doing what the stock script does, which is to flash the images to backup partitions, and then let the bootloader flash the main partitions upon reboot, since this process is currently broken when using the loading the kernel from the micro sd card, which we do.
Once the partitions have been flashed, we reboot the camera.
Once the partitions have been flashed, we reboot the camera, and the FW upgrade is complete.