Misc. Notes
some more notes for my bad memory
Objective
Make a Slug boot up again on its own when the power is connected
(essential for any home automation application)
I followed the advice here (14 Dec 06)
On the underside of the circuit board connect a wire between -
1)
the centre pin of the 5V connector (the one furthest from the edge of the board)
and
2) pin 1 of the nearest USB - the pin nearest to the 5V connector, next to the marking "R94"
The Slug boots up as soon as the 5V plug is connected and also if the power goes off for an instant.
Then the first push of the power button makes Debian close down.
On my Slug
in this down state the Ready/Status light then flashes on off Orange/Green and the DISK 1 and Ethernet lights stay on.
A second push makes it reboot and when running the Ready/Status light flashes long green/short orange/short orange.
I also connected a short wire between the pads of the absent ferrite bead, FB12, to provide power to the DISK 2 USB socket.
Note that the USB devices can now use as much power as the main supply can provide - BUT the main supply must be a stable 5V supply!
This also makes OpenWrt reboot on switch-on.
Setting up OpenWrt after my own compile - some notes for if I have to do it again
Set Slug for upgrade - hold reset and power push buttons then apply power (if using mod above)
count 10 to 14 seconds - see Ready/status flashing between 2 colours - release reset and power push buttons
upslug2 --image="image_name.bin"
wait 5 minutes
using serial link
ipkg update
ipkg install vsftpd
passwd
After first use of telnet - give it a password - then this Slug uses
ssh root@192.168.0.53
ipkg install vsftpd
/etc/vsftpd.conf (default is OK)
background=YES
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
check_shell=NO
#dirmessage_enable=YES
#ftpd_banner=Welcome to blah FTP service.
session_support=NO
#syslog_enable=YES
#userlist_enable=YES
#userlist_deny=NO
#userlist_file=/etc/vsftpd.users
#xferlog_enable=YES
#xferlog_file=/var/log/vsftpd.log
#xferlog_std_format=YES
NB!!!
Make a link in /etc/rc.d to the file /etc/init.d/vsftpd (created by the install process)
- otherwise vsftpd will not be present after boot
ln -s /etc/init.d/vsftpd /etc/rc.d/S50vsftpd
(use ftp not sftp in Fetch)
/etc/config/network
# Network configuration file
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 proto static
option ipaddr '192.168.0.52' <---NB
option netmask '255.255.0.0'
option gateway '192.168.0.230'
option dns '192.168.0.230'
option hostname Slug_52 <---NB
/etc/config/system
config system
option hostname Slug_52 <<--NEW
Mount a USB drive
Use QTParted on Fedora7 to format the USB drive as ext3 - unmount cleanly !!!
(I spent ages messing with a USB drive that seemed OK
- it mounted manually but would not mount using a boot script
Perhaps it was Ext2 ???)
Once only do -
mkdir -p /mnt/usbdrive
/etc/init.d/usbdrive contains -
#!/bin/sh /etc/rc.common
START=99
STOP=40
start()
{
echo -n "Testing USB Partition: "
e2fsck -p /dev/sda1 &
sleep 5
echo -n "Mounting USB drive: "
mount -t ext3 -o noatime /dev/sda1 /mnt/usbdrive
echo "Done."
}
stop()
{
echo -n "Umounting USB drive: "
sync
sync
umount /dev/sda1
echo "Done."
}
restart()
{
stop
start
}
Use the USB drive for program storage
Add the following line in /etc/ipkg.conf
dest usbdrive /mnt/usbdrive
In /etc/profile,
modify the line that reads -
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
to read -
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/mnt/usbdrive/bin:/mnt/usbdrive/sbin:/mnt/usbdrive/usr/bin:/mnt/usbdrive/usr/sbin
- and add the following line -
export LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/usbdrive/lib:/mnt/usbdrive/usr/lib
To install packages to the external drive use the -d option
ipkg -d usbdrive install samba-client
Add a USB sound card
ipkg -d usbdrive install alsa-lib
ipkg -d usbdrive install alsa-utils
ipkg -d usbdrive install madplay
That did not run - after much experimenting I added the following -
find these in the toolchain and place in /lib/modules/2.6.21.6/
snd-hwdep
snd-rawmidi
these were there before - I think....
snd-usb-lib
snd-usb-audio
then
add these into /etc/modules.d/60usbaudio
snd-hwdep
snd-rawmidi
These were present anyway -
snd-usb-lib
snd-usb-audio
then
cd /mnt/usbdrive/music
madplay Pretty_Woman.mp3
It WORKS (only took 6 hours....Macs rule... )
Using the readymade bin files from http://johnarthur.wordpress.com/2008/03/25/a-high-resolution-ip-webcam/
Notes for next time ....
I used openwrt-nslu2-uvc-webcam3.bin.zip (Google for s download )
This is the third file from the johnarthur site and runs well with Firefox - it is the time lapse camera version but defaults to 1 or 2 cameras if no USD memory stick is present.
I find it more stable as a camera host than Debian.
I want a simple website so need httpd from busybox. It is present in the busybox that was used in openwrt-nslu2-uvc-webcam1.bin.zip so I took it from there
to make the system use httpd etc from the new busybox I did -
cd /bin
ln -s /bin/busybox cut
ln -s /bin/busybox httpd
ln -s /bin/busybox killall
modify the path to httpd in /etc/init.d/httpd
httpd port number
Changed 80 to 8051 in /etc/init.d/httpd but the port stayed at 80
then found -
/etc/config/httpd
so made that -
config 'httpd'
option 'port' '8051'
option 'home' '/www'
STILL FAILS!
try /etc/httpd.conf
config 'httpd'
option 'port' '8051'
option 'home' '/www'
That works!
==============================
For fixed address also use for /etc/config/
# Copyright (C) 2006 OpenWrt.org
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 proto static
option ipaddr 192.168.0.50
option netmask 255.255.0.0
option gateway 192.168.0.230
option dns 192.168.0.230
==============================