Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optware/Entware Support #542

Closed
AustinSaintAubin opened this issue Jul 2, 2018 · 9 comments
Closed

Optware/Entware Support #542

AustinSaintAubin opened this issue Jul 2, 2018 · 9 comments

Comments

@AustinSaintAubin
Copy link

AustinSaintAubin commented Jul 2, 2018

I am having some issues getting Optware/Entware installed.
The main issue I have right now is that the kernel does not support any of the file systems I need. Mainly I need to be able to mountext3.

I have partitioned my SD card to have a ext3 partition (see pic)
screen shot 2018-07-02 at 12 20 40 am

You will get the following error message if you try yo mount a file system that the kernel does not support.

[root@wyze-cam-v2:~]# mount /dev/mmcblk0p2 /opt
mount: mounting /dev/mmcblk0p2 on /opt failed: Invalid argument

The problem is the the file system does not support... and of the common partition types.

https://www.cyberciti.biz/tips/tell-what-filesystems-linux-kernel-can-handle.html
# List Supported File Systems ( cat /proc/filesystems )
[root@wyze-cam-v2:~]# cat /proc/filesystems
nodev	sysfs
nodev	rootfs
nodev	bdev
nodev	proc
nodev	cgroup
nodev	tmpfs
nodev	debugfs
nodev	sockfs
nodev	pipefs
nodev	anon_inodefs
nodev	rpc_pipefs
nodev	configfs
nodev	devpts
	squashfs
nodev	ramfs
	vfat
	msdos
nodev	nfs
nodev	jffs2
nodev	mtd_inodefs

I have found a work around to do some testing with Optware/Entware by mounting it into the temp directory.
This is NOT a permanent solution, just allows for testing.

Entware

Entware is a more current version of Optware with more features. Its recommended as a replacement for Optware.

#Mount /opt into TEMP Directory
mkdir "/tmp/opt-tmp"
mount -o noatime -t ext3 -o bind "/tmp/opt-tmp" /opt

# Install Entware
wget -O - http://pkg.entware.net/binaries/mipsel/installer/installer.sh | sh

# Load Entware Profile (Sets new bin path, you can add this to your .profile)
. /opt/etc/profile

# Add Entware Profile to User Profile.
cat >> /etc/profile <<"EOF"
# Load Entware Profile
. /opt/etc/profile
EOF

# Update Entware
opkg update

# List [Packages](https://pkg.entware.net/binaries/mipsel/Packages.html)
opkg list

# Install some packages
opkg install htop nano mc

Optware

#Mount /opt into TEMP Directory
mkdir "/tmp/opt-tmp"
mount -o noatime -t ext3 -o bind "/tmp/opt-tmp" /opt

# Install Optware
wget -O - http://ipkg.nslu2-linux.org/optware-ng/bootstrap/buildroot-mipsel-ng-bootstrap.sh | sh

# Set new bin path, you can add this to your .profile
export PATH=$PATH:/opt/bin:/opt/sbin

# Update Optware
ipkg update

# List Packages
ipkg list

# Install some packages
ipkg install nano mc

NOTE: All installed packages will be lost on reboot... because this is mounted to /tmp, and not a persistent storage location... like ext2/ext3/ext4 partition on the SD card.

Any help would be appreciated.

@EliasKotlyar
Copy link
Owner

You can try to compile and boot a new kernel for the camera. Then you can include all the filesystems you need.

@AustinSaintAubin
Copy link
Author

I have tried to follow the documentation related to hacking the firmware, and documenation related to compiling software and the kernel... but keep running into issues.
I really have no idea where to start. I just need the ext3 file system kernel module.

It seems like the issue is really that the kernel modules are not being included... or the soft link is broken.
screen shot 2018-07-02 at 5 56 09 pm


Compared to some other firmwares like OpenWRT.
screen shot 2018-07-02 at 5 51 41 pm

@unmotivatedgene
Copy link

I too am having similar issues related to getting optware working and would greatly appreciate a guide on how to customize and compile the kernel. Honestly if someone could just screen record the full process for this setup I'd be happy with that to start.

@EliasKotlyar
Copy link
Owner

First , you need to download this repository:
https://github.com/Dafang-Hacks/Main
It includes everything which you may need. Then go into kernel folder, and compile it normally using a generic kernel compiling instruction. Something like https://www.thegeekstuff.com/2013/06/compile-linux-kernel/ should to the trick.

@jmtatsch
Copy link
Collaborator

Also test #575 that will make optware easier.

@AustinSaintAubin AustinSaintAubin changed the title Optware Support Optware/Entware Support Jul 16, 2018
@AustinSaintAubin
Copy link
Author

AustinSaintAubin commented Jul 16, 2018

Entware Install Guide

This guide shoes how to install Entware onto the SD card.
Spacial thanks to @nik0 & @unmotivagedgene with help on Main #16

Preparations

SD Card Preperation & Setup

Be sure to edit: DRIVE-HERE & DRIVE-PARTITION-HERE

# List Supported File Systems
cat /proc/filesystems

# Load EXT4 Kernel Modules (adds ext4 support)
cd /system/sdcard/driver
insmod mbcache.ko
insmod jbd2.ko
insmod crc16.ko
insmod ext4.ko

# List Drives & Partitions
fdisk -l

# Partition Disk
# https://www.itechlounge.net/2012/01/linux-partition-and-format-external-hard-drive-as-ext3-filesystem/
# https://www.howtogeek.com/106873/how-to-use-fdisk-to-manage-partitions-on-linux/
# https://wiki.dd-wrt.com/wiki/index.php/How_to_-_Format_and_Partition_External_Storage_Device
# https://access.redhat.com/articles/1190213
#fdisk /dev/DRIVE-HERE
fdisk /dev/mmcblk0
# See guides above, backup evrything off the drive before doing this.
# You could also do this with GParted from a computer.

# Formate Partition EXT4, without Journaling
#mke2fs -F -O ^has_journal -T ext4 -L "Optware" /dev/DRIVE-PARTITION-HERE
mke2fs -F -O ^has_journal -T ext4 -L "Optware" /dev/mmcblk0p2

# Mount Linux Filesystem to Optware
#mount -o noatime -t ext4 /dev/DRIVE-PARTITION-HERE /opt
mount -o noatime -t ext4 /dev/mmcblk0p2 /opt

Install Entware

# Install Entware
wget -O - http://pkg.entware.net/binaries/mipsel/installer/installer.sh | sh

# Load Entware Profile (Sets new bin path, you can add this to your .profile)
. /opt/etc/profile

# Update Entware
opkg update

# List [Packages](https://pkg.entware.net/binaries/mipsel/Packages.html)
opkg list

# Install some packages
opkg install htop nano mc

Setup Autostart

Be sure to edit: DRIVE-PARTITION-HERE

# Entware Autostart
cat > /system/sdcard/config/autostart/entware.sh <<"EOF"
#!/bin/sh

# Load EXT4 Kernel Modules (adds ext4 support)
cd /system/sdcard/driver
insmod mbcache.ko
insmod jbd2.ko
insmod crc16.ko
insmod ext4.ko

# Mount/Start Entware
mkdir -p /opt
#mount -o noatime -t ext4 /dev/DRIVE-PARTITION-HERE /opt
mount -o noatime -t ext4 /dev/mmcblk0p2 /opt

# Start Optware Background processes
/opt/etc/init.d/rc.unslung start

# Add Entware Profile in Global Profile
if grep  -qF  '/opt/etc/profile' /etc/profile; then
	echo "Confirmed: Entware Profile in Global Profile"
else
	echo "Adding: Entware Profile in Global Profile"
	# http://www.guguncube.com/2140/unix-set-a-multi-line-text-to-a-string-variable-or-file-in-bash
	echo '
# Load Entware Profile
. /opt/etc/profile
' >> /etc/profile
fi
EOF

@gabest11
Copy link

gabest11 commented Jul 17, 2018

Thank you for listing the steps needed to installed Entware. I managed to do it, but already put all the init stuff at the end of run.sh before reading the last section, works just as good.

Nice thing about Entware, that I could finally get my hands on ffmpeg to do segmented recording, as most cams do.

This is the command line I am currently running. 15 fps, 1000 kbps, about 8MB/min/file.

/system/sdcard/bin/v4l2rtspserver-master -W1280 -H720 -E MP3:16000:16000 -r 2 -U root:ismart12 -P 8554
ffmpeg -rtsp_transport udp -y -i rtsp://root:[email protected]:8554/unicast -vcodec copy -c:a copy -map 0 -f segment -strftime 1 -segment_time 60 -segment_atclocktime 1 -segment_format mp4 /system/sdcard/DCIM/201807/%Y%m%d-%H%M.mp4

TCP does not work, ffmpeg just waits at the start and does nothing.

Played a bit with recording options, while monitoring the CPU usage. The rtsp server is very demanding. Scales up with resolution, from lowest to full hd between 30-60%. Also enabling mp3 adds another 10-15%. There is not much room for ffmpeg to do anything other than writing out as-is, it just crashes itself and the server if I try it avutil style (-c:a aac). I think it is a bad idea, best is to let the server output mp3 and save it into mp4, which is also a valid audio format there.

Segmenting needs a bit more work, there is a patch for ffmpeg to auto-create directories according to the date string template, but not compiled into this version. Also, background job to delete old files, move files where motion detection kicked in into a separate folder, sync to a samba share. I think that's all to make it work like the original :)

@PotatoCider
Copy link

Installing from http://pkg.entware.net/binaries/mipsel/installer/installer.sh gave me Segmentation Faults when running packages from opkg.

Using wget -O - http://bin.entware.net/mipselsf-k3.4/installer/generic.sh | sh solved the problem for me and I can run packages such as nano.

@stale
Copy link

stale bot commented May 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants