http://midge.vlad.org.ua/wiki/FAQ
Configuration
Q: How can i use all ethernet ports like a switch with one network interface?
A: Edit /etc/midge.conf and change
VLAN_MX="0x41,0x42,0x44,0x48,0x50,0x60"
to
VLAN_MX="0x5F,0,0,0,0,0"

Q: And how can i get standart Edimax layout (1 port-WAN, 2-5 port-LAN) ?
A: Edit /etc/midge.conf and change
VLAN_MX="0x41,0x42,0x44,0x48,0x50,0x60"
to
VLAN_MX="0x5E,0x41,0,0,0,0"


To create a file in RAM on the Sweex that can be used by the web server pages

mkdir /var/www/ramdisk
mount -o size=2M -t tmpfs tmpfs /var/www/ramdisk


TIME
synchronise to a UK time server
rdate -s ntp2a.mcc.ac.uk (a,b,or c)
gives MST
subtract 2 hours for winter time (UTC?)

command date give full date and time
midge# date
Tue Jan 9 17:10:56 MST 2007
midge#

If the time is wrong change the number in /etc/TZ - (just experiment!)


To reboot from midge telnet session- type
reboot



To stop a process
If I start led_app and want to close it
ps -aux---------shows a list of running processes
kill 253---------stops process 253 (the number on the left of the listing) -


telnet 192.168.0.3

lcd_out

lcd_out_4x20

Test dl4huf driver on bottom right led

make line output
echo "led switch 1" > /dev/gpio20
make line input
echo "led switch 0" > /dev/gpio20

echo "led off" > /dev/gpio20
echo "led on" > /dev/gpio20
echo "led blink 1000" > /dev/gpio20
cat /dev/gpio10
cat /dev/gpio22

cat /proc/driver/led

echo "led switch 0" > /dev/gpio8 set gpio8 to input
echo "led switch 1" > /dev/gpio10 set gpio10 to output
echo "led switch 9" > /dev/gpio9 set gpio9 to LINK_ACT
echo "led switch 13" > /dev/gpio17 set gpio17 to FLASH, the
hardware-blink-mode
- all gpio's can set to the software blink if in output mode with
echo "led blink 1000" > /dev/gpio12 blinks gpio12 with 1s pulse

 

gpio0 = power-led
gpio1 = unused ( used with i2c yet )
gpio2 = Reset-switch
gpio3 = unused ( used with i2c yet !! used with 4MB-flash mod also !! )
gpio4 .. gpio7 not available because of PLCC-chip
gpio8 = LED D3 \
gpio9 = LED D4 > switch port 0 (wan)
gpio10 = unused /
gpio11 = LED D5 \
gpio12 = LED D6 > switch port 1 (lan)
gpio13 = unused /
gpio14 = LED D7 \
gpio15 = LED D8 > switch port 2 (lan)
gpio16 = unused /
gpio17 = LED D9 \
gpio18 = LED D10 > switch port 3 (lan)
gpio19 = unused /
gpio20 = LED D11 \
gpio21 = LED D12 > switch port 4 (lan)
gpio22 = unused /


 

lcd_out_4x20 "alias bg break cd chdir command continue eval exec exit export"

lcd_out_4x20 "fred"

lcd_out_4x20 -i

 


To uncompress

tar zxvf bob.tgz

tar xvf bob.tar


 

midge# date
Tue Jan 16 16:23:40 MST 2007
midge# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 119.1M 8.9M 104.0M 8% /
tmpfs 2.0M 0 2.0M 0% /var/www/ramdisk
midge# free
total used free shared buffers
Mem: 14300 8048 6252 0 256
Swap: 0 0 0
Total: 14300 8048 6252
midge# pwd
/var/www/cgi-bin/rs232ws
midge# uptime
16:24:02 up 4:55, load average: 0.00, 0.00, 0.00
midge# help

lsmod - lists modules running
Built-in commands:
-------------------
. : alias bg break cd chdir command continue eval exec exit export
false fg getopts hash help jobs kill let local pwd read readonly
return set shift times trap true type ulimit umask unalias unset
wait
midge#

midge# ping www.sunspot.co.uk
PING www.sunspot.co.uk (217.8.240.18): 56 data bytes
84 bytes from 217.8.240.18: icmp_seq=0 ttl=54 time=38.8 ms
84 bytes from 217.8.240.18: icmp_seq=1 ttl=54 time=41.3 ms
84 bytes from 217.8.240.18: icmp_seq=2 ttl=54 time=39.6 ms
control-z to stop it


svn co http://midge.vlad.org.ua/svn/trunk/openwrt-midge/
cd ./openwrt-midge
cp target/linux/adm5120-2.4/openwrt-config-midge-cirouter .config # for example
make menuconfig DEVELOPER=1
make V=99


2nd Hard disk

[root@localhost ~]# ls /proc/ide
drivers hda hdb hdc hdd ide0 ide1
[root@localhost ~]# fdisk -l /dev/hdc

Disk /dev/hdc: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 1 4865 39078081 83 Linux
[root@localhost ~]# mkdir /mnt/hdc1
[root@localhost ~]# mount /dev/hdc1 /mnt/hdc1
[root@localhost ~]# cd /mnt/hdc1
[root@localhost hdc1]# ls
lost+found plug-in Sweex
[root@localhost hdc1]# cd Sweex
bash: cd: Sweex: No such file or directory
[root@localhost hdc1]# cd

Adding a Second IDE Hard Drive To Your System

 

1. The physical mount.

Copy down the specs from the label on the drive.
Make sure it's jumpered as "slave".
Mount the drive in a spare drive bay, securing it with several screws.
Attach an IDE cable from the IDE port on the motherboard.

2. Update the BIOS with the info for the new drive.

It may autodetect, but don't count on it. Check the BIOS settings to make
certain. Setting the 'LBA' option not necessary.

3. Partitioning.

Boot up Linux and partition the new drive:
As root, fdisk /dev/hdb.
[primary partition, Linux native]

4. Format the new drive.

mke2fs -cv /dev/hdb1
[verbose output and check for bad blocks]

5. Create a mount point.

Decide where you will be mounting it and create a mount point.
For example, if you will mount it as /mnt/drive2, as root,
cd /mnt
mkdir drive2
chmod 777 drive 2
[makes the new drive accessible to ordinary users.]

6. Testing.

As root, mount -t ext2 /dev/hdb1 /mnt/drive2.
If no error messages, cd /mnt/drive2, and try creating a directory and
writing a couple of files.
If it works, hurray!
Continue to the final steps.

7. Modify /etc/fstab.

Add the following line to /etc/fstab:
/dev/hdb1 /mnt/drive2 ext2 defaults 1 2

8. Reboot and see if the new drive automounts.


electrickery

- To get /etc/init.d/S40network running:
mkdir /var/run

- To change IP address from 192.168.1.2 edit /etc/init.d/S47ifconfig:
ifconfig eth0 address 192.168.1.111
(eth0 is the active port connected to the internal hub,
the ip address has to match your sub-net but not collide with other hosts)

found the solution for the not working LAN1-4:
Make in /etc/midge.conf
'VLAN_MX="0x5F,0,0,0,0,0" # 1 ethernet iface (5LAN)'
active (remove the # and put it on the other VLAN=... line)
and reboot.
(from http://midge.vlad.org.ua/wiki/faq)

 

anon

> Q=/home/graham/kamikaze-200602050443/trunk/openwrt/staging_dir_mipsel/bin/m
>ipsel-linux-uclibc-
>CC=${Q}gcc
>LD=${Q}ld
>
>-----is shorthand for what I actually did - or am I missing some trick from
>ignorance? did not need "ld" - more to learn about linking.
>
>
Can act as a shorthand, for example if you put these lines into a file
(for ex: mipselenv)
than after you have typed "source mipselenv", you can just type "${Q}gcc
-o prog prog.c".

>The other area is to have serial data go into the Sweex and be displayed on
>a web page.
>
>
March issue of Elektor is an example of how to do it (jeroen's
application in fact).

to know it's state:
cat < /dev/led0
to set it's state:
echo "LED ON" > /dev/ledO # turns it on, well, there is a
bug (see forums), it turns it off.
echo "LED OFF" > /dev/led0 # turns it on
echo "LED BLINK 200" > /dev/led0 # makes it blink, number in milliseconds
but
ls -l /dev/led*
shows only 4 leds....., what about the others ???

You should look on Internet for openWrt/Midge and /dev/ledX where X is
0,1,2,3, .....
I saw in /etc/init.d/S99heart_led how one can bring led0 to blink.
Maybe the ledX devices can be controlled with some commands like on and

The baudrates of ttyS0 and ttyS1 are "hard set" in the serial.c file,
and the command to change it (stty) doesn't
work due to missing stuff (or bugs ?) in this serial.c file. (see on
midge's forum ...). I changed the midge file
in order to switch second port from 115200 bps to 9600 bps. And for me
it works.... Are you sure about you
second port hardware ?, did you connect it to a pc ? what do you get
when doing "echo 1234 > /dev/ttyS1",
in a Hyperterminal for example ?.
What does the command "stty -F /dev/ttyS1" say ?.

 

Ok, for now, do "man stty" than telnet into the router, and do:
stty -F /dev/ttyS0 -a
than
stty -F /dev/ttyS0 9600
this should set the port to the correct baudrate

Derek

http://www.dbzoo.com/wiki/cybiko/ideas

Maarko

Netcat is better than telnet.
Netcat is on your router.
Look at /usr/bin.
The name is nc.
Type:
nc --help
Look at
http://www.vulnwatch.org/netcat/readme.html
http://www.jfranken.de/homepages/johannes/vortraege/netcat.en.html
Netcat is available for windows and linux(google netcat).
If you want transfer data
Login first on Router and type:
nc -l -p "port">"file"
Type then on PC
cat "file" | nc "xx.xx.xx.xx" "port""xx.xx.xx.xx" is ip of router
"port" must be enabled
http://de.wikipedia.org/wiki/Netcat

The serial port of the router is /dev/ttyS0.
Connect the router with serial cable to the PC.
Start terminal program.( Com1 115200 baud).
Press enter and login.
Telnet to your router and login.
Type:
echo "Hello from router">/dev/ttyS0
Do you see it on terminal screen?

 

Ruud

You can use wget.
Place the html and other files (jpeg, gif) on your pc.
Start on your pc a webserver (freeware) and place
the files under the web directory (htdocs).
Go in the sweex to the directory www (if there
is a webserver installed, is possible via ipkg),
start on the sweex the command wget with the
a link, like wget http://ip-adress/filename .
Wget downloads the file and will place it on the
directory. The last thing to do is chmod for the files.

WATCH

Phill

I'm currently working on a build of Midge/Kamikaze that can:-
After being flashed via the serial port,
With no ipkg updates, or settings changes
mount a VFAT/Fat32 formatted usb hard drive or Flash Key,

 

mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt

 

FAQ

I once had trouble with mounting and unmounting the stick in Fedora. If the
> stick does not unmount properly it can fail with the router. Wait till the
> stick light stops flashing
>
> Try reformat and decompress the image again - all in the command line. The
> GUI can do odd things - Linux writers think the GUI is for wimps and do not
> test it!!
>
> What is the board and are the resistors actually soldered in for BOTH USB
> ports?

 

> >> You must use the USB port farthest from the Ethernet sockets.

------------------------------------
Examples how to set cron:

If you have installed a cgi script in your cgi-bin directory called members.cgi and wanted to run this program each night as 11.30 PM as in above example.

You would setup the following crontab line:

30 23 * * * /home/username/www/cgi-bin/members.cgi

30--represents the minute of cron work
23--represents the hour of the day
The * represent every day, month, and weekday.

If you want to set the cron job every sunday at midnight 11.30 PM then it would be like:

30 23 * * 0 /home/username/www/cgi-bin/members.cgi
0--represents the Sunday.

If you want the cron job to run at 1:00 and 2:00 A.M then you can set it like:

* 1,2 * * * /home/username/www/cgi-bin/members.cgi

This runs your cron at 1 and 2 A.M every day, every month and every week.

If you want to run the above task only from Monday to Friday then set it like:

* 1,2 * * 1-5 /home/username/www/cgi-bin/members.cgi


 

If a CGI page gives a 404 be sure it is in unix format not DOS


.html files cannot be linked to and seen on a browser if in a cgi_bin folder or sub-folder
- but a cgi or sh script can cat a file ending in html - and Dreamweaver can work on them and see the structure as though in a browser





Commands

Most people are scared of linux because of the archeic image of it as text only and comand line based. Hopefully this website has shown you that linux now has a lot more to offer than just comand lines. However, linux comands are very powerful and once you get started you will soon see how quick and useful these comands are.

If you have never used a terminal or comand line before then check out the starting section. If you're up for something more complicated check out the sections on more complicated commands or the section on bash scripting

Top tip: hold down control and c when things all go wrong to stop whatever crazy comand you started

chmod -- (change access modes)

This changes the permissions on the file/folder to determine who can access it.

$ chmod 755 thisfile.txt

This changes the permissions of thisfile.txt so that it can be read and executed by everyone but only the "user" (you) can change it.

The type of permission can either be written in numbers or letters.

Some useful numbers are:
755 - user reads writes and executse, groups read and write
777 - this is dangerous as it means anyone can do anything to the file

$ chmod -R 755 *

This is a handy comand. It chances the permissions to 755 recursively for everything in that directory ie all the files in that directory and all the files in all the folders in that directory and all the files in all the folders in all the folders in that directory ......

chown -- (change owner)

$ chown fred word.txt
$ chown -R michelle *

Chown is very useful, particularly when you have copied stuff off a cd as root by accident. It chances the "owner" of the files ie who can access them.

The first word is the user who you want to assign access to and the second word (or the star for all files) is the thing you want to let them access.

-R is useful as it does the operation recursively ie to all the files in all the folders in the directories below.

cp -- (copy)

cp copies a file from one location to another.

$ cp mog.gif /images/cat/mog1.gif

This copies the file mog.gif to the folder /cat in the folder /images and makes the name of the copied file mog1.gif

killall

The killall comand stops programs working when they break/crash. I seem to have a nack for crashing things in linux which most other people find virtually impossible. It means I am an excellent software tester!!!

$ killall -9 nameofprogram

The -9 part is useful when the plane old killall comand doesn't work.

locate -- (locate files)

A quick way of finding files/folders on your system.

$ locate memo.txt
$ locate *.doc

lpq -- (lists print queue)

This lists the docuements etc which are lined up to be printed.

$lpq
PSC-2350 is ready
no entries

This shows that there is nothing in the print queue waiting to be printed.

lpr -- (send to printer)

This comand sends things to the printer to be printed.

lprm -- (removes things from print queue)

This is a useful comand which remove things from the queue of things to be printed.

$ lprm -
This is a handy version of the command which allows you to delete all the things in the printer que which are owned by you the user.

ls -- (list)

This lists all the files in the current directory.

mkdir -- (makes directory)

This makes a new directory (or folder)

$ mkdir /home/files

This makes a new folder called files in the folder /home (which already exists!)

mv -- (move)

Moves stuff but also note that this is how to change the name of a file/folder.

$ mv /home/address.txt /addressbook/address01.txt

This moves the file address.txt into the folder /addressbook and also renames it to address01.txt

rm -- (remove)

Removes or deletes files.

$ rm badpicture.jpg

Deletes the file badpicture.jpg

rm -dir -- (removes directory)

Deletes a directory/folder (which must be empty already)

$ rm images

deletes the folder /images

rm -r -- (removes recursively)

This removes a folder AND all its contents.

Do not type this in unless you know what you are doing as you could quite easily delete ALL of the stuff on your hard disc (i speak from rather embarased experience).

This comand is all the more reason to maintain uptodate backups of all your files and very uptodate backups of anything that is important to you. I would strongly recomend this anyway as having decent backups means that you will explore your computer and what you can do with it much more freely as you do not learn anything new without taking a risk.

scp -- (secure copy program)

This alows you to copy files from one location ie your computer to another ie an external server.

$ scp /images/red/redcar.jpg vaxhal.com:images/cars/

This copies the file redcar.jpg from the folder red in the folder images on your computer to the server vaxhal.com and puts it in the folder cars in the folder images.

ssh -- (secure shell)

This connects you to an external server.

$ scp vaxhall.com:images/cars

this connects you to the server vaxhall.com
and into the folder /images and its subfolder /cars
you will probably then be prompted to enter a password

Top tip: remeber that colon in between the server name and the location on the server - it's a killer when you forget it!