More OpenWRT progress and a few more issues resolved.
One of the issues I run into was the microSD cards becoming write protected. Even after removing the cards they were write protected on every other device I tried to connect then too. With full size SD cards there was a small switch to enable write protect but not with the microSD cards. I did read a few tricks like using a microSD to SD card adapter then disabling the write protect and formatting the cards but this did not work for me. Not wanting to run into this issue again I have just replaced the microSD cards with USB memory sticks.
Installing OpenWRT to a MR3020n.
Ok I have reinstalled openWRT a few times now and almost have it down to a fine art. This is not a full walk through but the key steps to get openWRT installed and working with a USB memory device. I did connect a TTL serial cable to the router so I did not have to play around with the networking side of things too much.
- Format the USB drive with the EXT2 file system, under Windows you can use Free EaseUS® Partition Master 9.1.1 Home Edition
- Flash the base image to the router. You can use the web interface to upload the firmware update of if you have a console and the router connected to the web you can use these two commands
mtd -r write *mr3020*.bin firmware
- Now after the router reboots it will have the IP of 192.168.1.1
before able to SSH to the router you will need to Telnet to it and using the passwd command set a password.
- Configure the network settings. You will need to edit /etc/config/network using vi to match the settings of your network. For me that is just enable DHCP so the settings will look this
config interface 'loopback'
option ifname 'lo'
option proto 'static' option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan' option ifname 'eth0'
option type 'bridge'
option proto 'dhcp'
- Now you need to reboot and reconnect using the new settings. If using the DHCP and you are not sure what IP the router has you can connect to your DHCP server for the lease details. I cheated and just used the serial console.
- Now we need to start installing support for the USB drive and filesystem. We want to install as little as possible until we have the USB driver mounted.
This will download a list installable packages and needs to be done after every reboot.
opkg install kmod-usb-storage block-mount kmod-fs-ext4
This will download a list install the minimum kernel drivers and dependencies.
- Now to setup the overlay we need to copy the existing overlay files across. So we need to use the following commands
So we have somewhere to mount the drive
mount -t ext2 /dev/sda1 /mnt/usb -o rw,sync
To mount the drive
tar -C /overlay -cvf - . | tar -C /mnt/usb -xf -
To copy the data across
Now to update fstab to use the sda1 as the overlay
and should look like this
option target /overlay
option device /dev/sda1
option fstype ext2
option options rw,sync option enabled 1
option enabled_fsck 0
- If all when well if you df -h you should see that you have gone from just a few KB of free space to a few GB of space. Now we can install anything we want and not have to worry about space. So for most people the first thing to do is install and setup the web interface. Just type the following commands
opkg updateopkg install luci/etc/init.d/uhttpd enable/etc/init.d/uhttpd start
Now you should be able to open the web interface of the router.
- To install a webcam (Logitech c270) use the following command
opkg install kmod-video-core kmod-video-uvc mjpg-streamer
This will install the uvc camera driver which is supported by many different webcams and it will install mjpg-streamer which will allow you to stream the webcam.
To get mjpg-streamer start automatically you need to enable the service ether in the web interface or by running
You may also want to edit
I found that some resolutions like the default 640x480@5fps showed a lot of JPG corruption so I tried a few other resolutions and found 1280x720 worked nice but ended up settling on 720x350@10fps
After editing the settings you will need to stop/start/restart the service for the new settings to take effect
You should be able to view the webcam via