Routeur wifi La Fonera

De MicElectroLinGenMet.

(Retour Accueil ou Liste des articles)

Sommaire

Description

La Fonera est un routeur, composé d'un chipset Atheros (jusqu’à 54Mbits), d'une mémoire flash de 4Mo et d'une RAM de 16Mo, fonctionne grâce au système openwrt avec un noyau Linux 2.4. Il est vendu par FON pour créer une communauté d'accés wifi dans le monde.

Routeur La Fonera


La Fonera est surtout un sytème embarqué sous Linux pas cher qui permet de dévelloper ces propres applications grâce à OpenWrt.


Firmware FON

La version actuelle sur cette Fonera est la 0.7.2r3. Il existe plusieurs méthodes logiciels sur internet permattant d'accéder à une connexion ssh, mais celles-ci sont destinées a des versions de firmware plus anciennes.

L'autre méthode et de passer par le port série interne de la Fonera.



Port série de La Fonera

Voir documention sur OpenWrt: http://wiki.openwrt.org/OpenWrtDocs/Hardware/Fon/Fonera#head-c4ab9c9f1a25dfc0e2d53419e98033c2c61b16cd

Le port est configuré avec le format séri: 9600-8N1


Connecteur série

  • Brochage du port
+-------------------+
|GND| . |TXD|RXD| . |
|VCC| . | . | . | . |
+-------------------+
 
+-----+ +--------+    +---+
|Power| |Ethernet|    |Ant|
Connecteur série


Voir le site http://www.francofon.fr/mediawiki-index.title-Les_entrailles_de_la_Fonera-style-m.htm


Les signaux RXD and TXD sont sous (3.3V), non comptatible avec les niveaux RS232. Il faut une interface pour les adapter à un port série de PC.

Exemple d'interface de type Max3232 pour adapter les signaux TTL 3.3V aux signaux RS232 (-12V/+12V) d'un PC.



Max3232


Accés à la console de La Fonera

Un fois l'interface connectée entre la Fonera et un PC avec minicom sous Linux configuré en 9600-8N1.


Interface série TTL/RS232


Voici ce que l'on obtient au boot:

+PHY ID is 0022:5521
Ethernet eth0: MAC address 00:18:84:21:d5:30
IP: 192.168.0.111/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.0.210

RedBoot(tm) bootstrap and debug environment [ROMRAM]
Non-certified release, version v1.3.0 - built 16:57:58, Aug  7 2006

Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.

Board: ap51
RAM: 0x80000000-0x81000000, [0x80040450-0x80fe1000] available
FLASH: 0xa8000000 - 0xa87f0000, 128 blocks of 0x00010000 bytes each.
== Executing boot script in 10.000 seconds - enter ^C to abort				<= Accés REDBOOT
RedBoot> fis load -l vmlinux.bin.l7
Image loaded from 0x80041000-0x801ba000
RedBoot> exec
Now booting linux kernel:
 Base address 0x80030000 Entry 0x80041000
 Cmdline :
CPU revision is: 00019064
Primary instruction cache 16kB, physically tagged, 4-way, linesize 16 bytes.
Primary data cache 16kB, 4-way, linesize 16 bytes.
Linux version 2.4.32 (iurgi@ropero) (gcc version 3.4.6 (OpenWrt-2.0)) #9 jue nov 23 12:11:45 UTC 2006
Determined physical RAM map:
 memory: 01000000 @ 00000000 (usable)
On node 0 totalpages: 4096
zone(0): 4096 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: console=ttyS0,9600 rootfstype=squashfs,jffs2
Using 92.000 MHz high precision timer.
Calibrating delay loop... 183.50 BogoMIPS
Memory: 14188k/16384k available (1327k kernel code, 2196k reserved, 92k data, 68k init, 0k highmem)
Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)
Inode cache hash table entries: 1024 (order: 1, 8192 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 4096 (order: 2, 16384 bytes)
Checking for 'wait' instruction...  available.
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
squashfs: version 3.0 (2006/03/15) Phillip Lougher
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with no serial options enabled
ttyS00 at 0xb1100003 (irq = 37) is a 16550A
eth0: Dropping NETIF_F_SG since no checksum feature.
eth0: Atheros AR2313: 00:18:84:21:d5:30, irq 4
MTD driver for SPI flash.
spiflash: Probing for Serial flash ...
spiflash: Found SPI serial Flash.
8388608: size
Creating 8 MTD partitions on "spiflash":
0x00000000-0x00030000 : "RedBoot"
0x00030000-0x00720000 : "rootfs"
eth0: Configuring MAC for full duplex
0x001b0000-0x00720000 : "rootfs1"
0x00720000-0x00730000 : "config"
0x00730000-0x007e0000 : "vmlinux.bin.l7"
0x007e0000-0x007ef000 : "FIS directory"
mtd: partition "FIS directory" doesn't end on an erase block -- force read-only
0x007ef000-0x007f0000 : "RedBoot config"
mtd: partition "RedBoot config" doesn't start on an erase block boundary -- force read-only
0x007f0000-0x00800000 : "board_config"
Initializing Cryptographic API
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 1024 bind 2048)
ip_conntrack version 2.1 (5953 buckets, 5953 max) - 328 bytes per conntrack
ip_tables: (C) 2000-2002 Netfilter core team
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NET4: Ethernet Bridge 008 for NET4.0
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Mounted devfs on /dev
Freeing unused kernel memory: 68k freed
init started:  BusyBox v1.1.3 (2006.11.21-19:49+0000) multi-call binary
Algorithmics/MIPS FPU Emulator v1.5

Please press Enter to activate this console. Registering mini_fo version $Id$
mini_fo: using base directory: /
mini_fo: using storage directory: /jffs
jffs2.bbc: SIZE compression mode activated.
wlan: 0.8.4.2 (0.9.0)
ath_hal: 0.9.17.1 (AR5212, AR5312, RF5112, RF2316, RF2317, TX_DESC_SWAP)
wlan: mac acl policy registered
ath_rate_sample: 1.2 (0.9.0)
ath_ahb: 0.9.4.5 (0.9.0)
ath_pci: switching rfkill capability off
wifi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
wifi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
wifi0: H/W encryption support: WEP AES AES_CCM TKIP
wifi0: mac 11.0 phy 4.8 radio 7.0
wifi0: Use hw queue 1 for WME_AC_BE traffic
wifi0: Use hw queue 0 for WME_AC_BK traffic
wifi0: Use hw queue 2 for WME_AC_VI traffic
wifi0: Use hw queue 3 for WME_AC_VO traffic
wifi0: Use hw queue 8 for CAB traffic
wifi0: Use hw queue 9 for beacons
wifi0: Atheros 2315 WiSoC: mem=0xb0000000, irq=3
Universal TUN/TAP device driver 1.5 (C)1999-2002 Maxim Krasnyansky
device eth0 entered promiscuous mode


BusyBox v1.1.3 (2006.11.21-19:49+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

 _______  _______  _______
|   ____||       ||   _   |
|   ____||   -   ||  | |  |
|  |    |_______||__| |__|
|___|

 Fonera Firmware (Version 0.7.2 rev 3) -------------
  *
  * Based on OpenWrt - http://openwrt.org
  * Powered by FON - http://www.fon.com
 --IPP2P v0.8.1_rc1 loading
-------------------------------------------------
root@OpenWrt:/#

Tour du proprietaire

root@OpenWrt:/# uname -a
Linux OpenWrt 2.4.32 #9 jue nov 23 12:11:45 UTC 2006 mips unknown
root@(none):/etc/init.d# ifconfig
ath1      Link encap:Ethernet  HWaddr 00:18:84:21:D5:32
          inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:2290  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:18:84:21:D5:30
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:30680 (29.9 KiB)
          Interrupt:4 Base address:0x1000

eth0:1    Link encap:Ethernet  HWaddr 00:18:84:21:D5:30
          inet addr:169.254.255.1  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          Interrupt:4 Base address:0x1000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wifi0     Link encap:Ethernet  HWaddr 00:18:84:21:D5:31
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:818 errors:0 dropped:0 overruns:0 frame:434
          TX packets:27 errors:2 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:199
          RX bytes:63725 (62.2 KiB)  TX bytes:1894 (1.8 KiB)
          Interrupt:3 Memory:b0000000-b00ffffc
root@(none):/etc/init.d# free
              total         used         free       shared      buffers
  Mem:        14256         9832         4424            0         1056
 Swap:            0            0            0
Total:        14256         9832         4424
root@(none):/etc/init.d# cat /proc/cpuinfo
system type             : Atheros AR531X_COBRA
processor               : 0
cpu model               : MIPS 4KEc V6.4
BogoMIPS                : 183.50
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 16
extra interrupt vector  : yes
hardware watchpoint     : no
VCED exceptions         : not available
VCEI exceptions         : not available
root@(none):/etc/init.d# df -h
Filesystem                Size      Used Available Use% Mounted on
none                      7.0M     24.0k      6.9M   0% /tmp
/dev/mtdblock/2           5.4M    576.0k      4.9M  10% /jffs
/                         1.5M      1.5M         0 100% /
root@OpenWrt:/# mount
/dev/root on /rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
none on /dev/pts type devpts (rw)
/dev/mtdblock/2 on /jffs type jffs2 (rw)
/ on / type mini_fo (rw)
root@OpenWrt:/# ipkg list
base-files-ar531x-2.4 - 8 -
bridge - 1.0.6-1 -
busybox - 1.1.3-1 -
chillispot-fon - 1.0-1 -
coova - 4-1 -
dnsmasq - 2.27-1 -
dnsmasq-fon - 2.38-1 -
dropbear - 0.48.1-1 -
foncheckrsa - 0.1-1 -
haserl - 0.8.0-1 -
hostapd-mini - 0.5.3-1 -
iptables - 1.3.5-1 -
iptables-mod-conntrack - 1.3.5-1 -
iptables-mod-extra - 1.3.5-1 -
iptables-mod-filter - 1.3.5-1 -
iptables-mod-imq - 1.3.5-1 -
iptables-mod-ipopt - 1.3.5-1 -
iptables-mod-nat - 1.3.5-1 -
kernel - 2.4.32-ar531x-1 -
kmod-ar531x-wdt - 2.4.32-ar531x-1 -
kmod-gre - 2.4.32-ar531x-1 -
kmod-imq - 2.4.32-ar531x-1 -
kmod-ipt-conntrack - 2.4.32-ar531x-1 -
kmod-ipt-extra - 2.4.32-ar531x-1 -
kmod-ipt-filter - 2.4.32-ar531x-1 -
kmod-ipt-ipopt - 2.4.32-ar531x-1 -
kmod-ipt-nat - 2.4.32-ar531x-1 -
kmod-madwifi - 2.4.32+0.9.0-ar531x-1 -
kmod-mini-fo - 2.4.32+0.6.2pre1-ar531x-1 -
kmod-ppp - 2.4.32-ar531x-1 -
kmod-pppoe - 2.4.32-ar531x-1 -
kmod-sched - 2.4.32-ar531x-1 -
libgcc - 3.4.6-8 -
mtd - 4 -
ntpclient - 2003_194-2 -
ppp - 2.4.3-7 -
ppp-mod-pppoe - 2.4.3-7 -
pptp - 1.6.0-3 -
qos-scripts - 0.9.1-1 -
tc - 2.6.15-060110-1 -
uclibc - 0.9.28-8 -
webif-fon - 0.2-1 -
wireless-tools - 28-1 -
Done.



Modification configuration FON


  • Automatiser le lancement du serveur SSH
# mv /etc/init.d/dropbear /etc/init.d/S50dropbear 


  • Ouvrir port ssh

Décommenter les deux lignes ci-dessous (enlever le « # »):

# vi /etc/firewall.user 

iptables -t nat -A prerouting_rule -i $WAN -p tcp --dport 22 -j ACCEPT
iptables        -A input_rule      -i $WAN -p tcp --dport 22 -j ACCEPT


  • Désactiver utilitaire FON en crontab

Commentez la ligne qui contient /bin/thinclient :

# crontab -e 

Commentez la derniere ligne de /bin/thinclient (optionnel):

# vi /bin/thinclient 
# . /tmp/.thinclient.sh 



Installation OpenWrt

Le mieux est encore de réinstaller un Linux plus polyvalent, c'est à dire OpenWrt complet.

Source:
http://wiki.openwrt.org/OpenWrtDocs/Hardware/Fon/Fonera#head-642136eeb4e795b147c302aae601183d0d26d1d8
Linux Mag n°95 (Juin 2007)



Accès par REDBOOT

Redboot est un bootloader.
En bootant sur la console, il faut taper un CTRL-C dés ce message ci-dessous pour accéder au prompt redboot.

== Executing boot script in 10.000 seconds - enter ^C to abort
^C
RedBoot> 


  • Affichage mémoire flash interne:
RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
rootfs            0xA8030000  0xA8030000  0x00700000  0x00000000
vmlinux.bin.l7    0xA8730000  0x80041000  0x000B0000  0x80041000
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000


  • Paramètres redboot:
RedBoot> fconfig -l -n
boot_script: true
boot_script_data:
.. fis load -l vmlinux.bin.l7
.. exec
boot_script_timeout: 1
bootp: false
bootp_my_gateway_ip: 0.0.0.0
bootp_my_ip: 0.0.0.0
bootp_my_ip_mask: 255.255.255.255
bootp_server_ip: 0.0.0.0
console_baud_rate: 9600					<= Débit console.
gdb_port: 9000
info_console_force: false
net_debug: false


  • Modification paramètre des variables réseau + timeout.
RedBoot> fconfig boot_script_timeout 10					<= Timeout accès redboot.
boot_script_timeout: Setting to 10
Update RedBoot non-volatile configuration - continue (y/n)? n
RedBoot> fconfig bootp_my_ip 192.168.0.111				<= @IP redboot
bootp_my_ip: Setting to 192.168.0.111
Update RedBoot non-volatile configuration - continue (y/n)? n
RedBoot> fconfig bootp_my_ip_mask 255.255.255.0
bootp_my_ip_mask: Setting to 255.255.255.0
Update RedBoot non-volatile configuration - continue (y/n)? n
RedBoot> fconfig bootp_server_ip 192.168.0.210				<= @IP serveur tftp
bootp_server_ip: Setting to 192.168.0.210
Update RedBoot non-volatile configuration - continue (y/n)? y
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .


  • Nouvelle config.
RedBoot> fconfig -l -n
boot_script: true
boot_script_data:
.. fis load -l vmlinux.bin.l7
.. exec
boot_script_timeout: 10
bootp: false
bootp_my_gateway_ip: 0.0.0.0
bootp_my_ip: 192.168.0.111
bootp_my_ip_mask: 255.255.255.0
bootp_server_ip: 192.168.0.210
console_baud_rate: 9600
gdb_port: 9000
info_console_force: false
net_debug: false


  • Test connexion réseau Redboot
dan@vesta:~$ arping -qf 192.168.0.111 ; telnet 192.168.0.111 9000
WARNING: interface is ignored: Operation not permitted
Trying 192.168.0.111...
?Invalid command
Connected to 192.168.0.111.
Escape character is '^]'.
== Executing boot script in 9.440 seconds - enter ^C to abort
^C										<= Problème pour générer CRTL-C
RedBoot>


Installation tftpd sur serveur


  • Packages Debian
# apt-get install tftpd-hpa
# apt-get install tftp-hpa

Activer deamon dans /etc/default/tftpd-hpa

# /etc/init.d/tftpd-hpa start


  • Téléchargé firmware OpenWrt
http://downloads.openwrt.org/kamikaze/7.09/atheros-2.6/openwrt-atheros-2.6-vmlinux.lzma
http://downloads.openwrt.org/kamikaze/7.09/atheros-2.6/openwrt-atheros-2.6-root.squashfs

les placer dans le répertoire tftp: /var/lib/tftpboot


Installing OpenWrt with RedBoot

Documentation: http://wiki.openwrt.org/OpenWrtDocs/Hardware/Fon/Fonera


  • Connexion telnet à redboot
telnet 192.168.0.111 9000
Trying 192.168.0.111...
?Invalid command
Connected to 192.168.0.111.
Escape character is '^]'.
== Executing boot script in 9.570 seconds - enter ^C to abort
^C
RedBoot>
RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
rootfs            0xA8030000  0xA8030000  0x00700000  0x00000000
vmlinux.bin.l7    0xA8730000  0x80041000  0x000B0000  0x80041000
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000
RedBoot>  


  • Suppression images existantes

Contrairement à la doc. sur OpenWrt, il faut supprimer les images existante à cause du noyau trop volumineux pour tenir dans 0x000B0000 octets

Information trouvée sur http://www.lefinnois.net/wp/index.php/2007/08/27/openwrt-kamikaze-707-et-la-fonera/#more-53

RedBoot> fis init -f
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xa8030000-0xa87e0000: ...........................................................................................................................
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot>  

RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000


  • Chargement et écriture de l'image root
RedBoot> load -r -b 0x80041000 openwrt-atheros-2.6-root.squashfs
Using default protocol (TFTP)
Raw file loaded 0x80041000-0x80160fff, assumed entry at 0x80041000
RedBoot> fis create -b 0x80041000 -f 0xA8030000 -l 0x006F0000 -e 0x00000000 rootfs
... Erase from 0xa8030000-0xa8720000: ...............................................................................................................
... Program from 0x80041000-0x80731000 at 0xa8030000:  ...............................................................................................................
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .

Taille rootfs réduite à 0x006F0000 octets.

RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
rootfs            0xA8030000  0xA8030000  0x006F0000  0x00000000
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000
RedBoot>  


  • Chargement et écriture de l'image kernel
RedBoot> load -r -b 0x80041000 openwrt-atheros-2.6-vmlinux.lzma
Using default protocol (TFTP)
Raw file loaded 0x80041000-0x80100fff, assumed entry at 0x80041000
RedBoot> fis create -r 0x80041000 -e 0x80041000 vmlinux.bin.l7
... Erase from 0xa8720000-0xa87e0000: ............
... Program from 0x80041000-0x80101000 at 0xa8720000: ............
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> fis list
Name              FLASH addr  Mem addr    Length      Entry point
RedBoot           0xA8000000  0xA8000000  0x00030000  0x00000000
rootfs            0xA8030000  0xA8030000  0x006F0000  0x00000000
vmlinux.bin.l7    0xA8720000  0x80041000  0x000C0000  0x80041000
FIS directory     0xA87E0000  0xA87E0000  0x0000F000  0x00000000
RedBoot config    0xA87EF000  0xA87EF000  0x00001000  0x00000000
RedBoot>        


  • Reboot
RedBoot>reset


Premier boot sous openwrt => KAMIKAZE (7.09)

Documentation OpenWrtDocs / KamikazeConfiguration: http://wiki.openwrt.org/OpenWrtDocs/KamikazeConfiguration


Première connection

--------------------------------------------
BusyBox v1.4.2 (2007-09-29 07:21:40 CEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (7.09) -----------------------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:/#


Nom de machine

root@OpenWrt:/# uname -a
Linux OpenWrt 2.6.21.5 #2 Sun Sep 30 20:16:16 CEST 2007 mips unknown


Mémoire

root@OpenWrt:/etc/init.d# free
              total         used         free       shared      buffers
  Mem:        13620         8208         5412            0          876
 Swap:            0            0            0
Total:        13620         8208         5412


Système de fichiers

root@OpenWrt:/etc/init.d# df -h
Filesystem                Size      Used Available Use% Mounted on
none                      6.6M     16.0k      6.6M   0% /tmp
tmpfs                   512.0k         0    512.0k   0% /dev
/dev/mtdblock2            5.9M    332.0k      5.6M   5% /jffs
mini_fo:/jffs             1.0M      1.0M         0 100% /


root@OpenWrt:/etc/init.d# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
tmpfs on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
/dev/mtdblock2 on /jffs type jffs2 (rw)
mini_fo:/jffs on / type mini_fo (rw)


Programmes (packages) installés

root@OpenWrt:/etc# ipkg list
base-files-atheros-2.6 - 10-9078 -
bridge - 1.0.6-1 -
busybox - 1.4.2-2 -
dnsmasq - 2.39-1 -
dropbear - 0.50-2 -
hotplug2 - 0.9+r102-2 -
iptables - 1.3.7-1 -
kernel - 2.6.21.5-atheros-1 -
kmod-madwifi - 2.6.21.5+r2568-20070710-atheros-2 -
kmod-ppp - 2.6.21.5-atheros-1 -
kmod-pppoe - 2.6.21.5-atheros-1 -
libgcc - 4.1.2-10 -
mtd - 5 -
ppp - 2.4.3-8 -
ppp-mod-pppoe - 2.4.3-8 -
uclibc - 0.9.28-10 -
udevtrigger - 106-1 -
wireless-tools - 29-1 -
Done.


Paramètres systèmes (nvram)

root@OpenWrt:/etc/init.d# uci show
dhcp.cfg1=dhcp
dhcp.cfg1.interface=lan
dhcp.cfg1.start=100
dhcp.cfg1.limit=150
dhcp.cfg1.leasetime=12h
dhcp.cfg2=dhcp
dhcp.cfg2.interface=wan
dhcp.cfg2.ignore=1
dropbear.cfg1=dropbear
dropbear.cfg1.TYPE=dropbear
dropbear.cfg1.PasswordAuth=on
dropbear.cfg1.Port=22
network.loopback=interface
network.loopback.ifname=lo
network.loopback.proto=static
network.loopback.ipaddr=127.0.0.1
network.loopback.netmask=255.0.0.0
network.lan=interface
network.lan.ifname=eth0
network.lan.type=bridge
network.lan.proto=static
network.lan.ipaddr=192.168.1.1			<= IP statique à l'install.
network.lan.netmask=255.255.255.0
system.cfg1=system
system.cfg1.TYPE=system
system.cfg1.hostname=OpenWrt
wireless.wifi0=wifi-device
wireless.wifi0.type=atheros
wireless.wifi0.channel=5
wireless.wifi0.disabled=1			<= Désactivé à l'install.
wireless.cfg2=wifi-iface
wireless.cfg2.TYPE=wifi-iface
wireless.cfg2.device=wifi0
wireless.cfg2.network=lan
wireless.cfg2.mode=ap
wireless.cfg2.ssid=OpenWrt
wireless.cfg2.encryption=none


dmesg

Linux version 2.6.21.5 (nbd@ds10) (gcc version 4.1.2) #2 Sun Sep 30 20:16:16 CEST 2007
CPU revision is: 00019064
Determined physical RAM map:
 memory: 01000000 @ 00000000 (usable)
Initrd not found or empty - disabling initrd
On node 0 totalpages: 4096
  DMA zone: 32 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 4064 pages, LIFO batch:0
  Normal zone: 0 pages used for memmap
Built 1 zonelists.  Total pages: 4064
Kernel command line: console=ttyS0,9600 rootfstype=squashfs,jffs2 init=/etc/preinit
Primary instruction cache 16kB, physically tagged, 4-way, linesize 16 bytes.
Primary data cache 16kB, 4-way, linesize 16 bytes.
Synthesized TLB refill handler (20 instructions).
Synthesized TLB load handler fastpath (32 instructions).
Synthesized TLB store handler fastpath (32 instructions).
Synthesized TLB modify handler fastpath (31 instructions).
PID hash table entries: 64 (order: 6, 256 bytes)
Using 92.000 MHz high precision timer.
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 13504k/16384k available (1955k kernel code, 2880k reserved, 292k data, 116k init, 0k highmem)
Calibrating delay loop... 183.50 BogoMIPS (lpj=917504)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Radio config found at offset 0xf8(0x1f8)
Time: MIPS clocksource has been installed.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP reno registered
squashfs: version 3.0 (2006/03/15) Phillip Lougher
Registering mini_fo version $Id$
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
Serial: 8250/16550 driver $Revision: 1.90 $ 1 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0xb1100003 (irq = 37) is a 16550A
eth0: Dropping NETIF_F_SG since no checksum feature.
eth0: Atheros AR231x: 00:18:84:21:d5:30, irq 4
cmdlinepart partition parsing not available
Searching for RedBoot partition table in spiflash at offset 0x7d0000
Searching for RedBoot partition table in spiflash at offset 0x7e0000
5 RedBoot partitions found on MTD device spiflash
Creating 5 MTD partitions on "spiflash":
0x00000000-0x00030000 : "RedBoot"
0x00030000-0x00720000 : "rootfs"
0x00130000-0x00720000 : "rootfs_data"
0x00720000-0x007e0000 : "vmlinux.bin.l7"
0x007e0000-0x007ef000 : "FIS directory"
0x007ef000-0x007f0000 : "RedBoot config"
nf_conntrack version 0.5.0 (128 buckets, 1024 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP vegas registered
NET: Registered protocol family 1
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Freeing unused kernel memory: 116k freed
eth0: Configuring MAC for full duplex
Warning: unable to open an initial console.
Algorithmics/MIPS FPU Emulator v1.5
mini_fo: using base directory: /
mini_fo: using storage directory: /jffs
device eth0 entered promiscuous mode
br-lan: port 1(eth0) entering learning state
br-lan: topology change detected, propagating
br-lan: port 1(eth0) entering forwarding state
PPP generic driver version 2.4.2
wlan: 0.8.4.2 (svn r2568)
ath_hal: module license 'Proprietary' taints kernel.
ath_hal: 0.9.30.13 (AR5212, AR5312, RF2316, TX_DESC_SWAP)
ath_rate_minstrel: Minstrel automatic rate control algorithm 1.2 (svn r2568)
ath_rate_minstrel: look around rate set to 10%
ath_rate_minstrel: EWMA rolloff level set to 75%
ath_rate_minstrel: max segment size in the mrr set to 6000 us
wlan: mac acl policy registered
ath_ahb: 0.9.4.5 (svn r2568)
ath_pci: switching rfkill capability off
ath_pci: switching per-packet transmit power control off
wifi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
wifi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
wifi0: H/W encryption support: WEP AES AES_CCM TKIP
wifi0: mac 11.0 phy 4.8 radio 7.0
wifi0: Use hw queue 1 for WME_AC_BE traffic
wifi0: Use hw queue 0 for WME_AC_BK traffic
wifi0: Use hw queue 2 for WME_AC_VI traffic
wifi0: Use hw queue 3 for WME_AC_VO traffic
wifi0: Use hw queue 8 for CAB traffic
wifi0: Use hw queue 9 for beacons
wifi0: Atheros 2315 WiSoC: mem=0xb0000000, irq=3


Configuration réseau

Le réseau est configuré en mode bridge mais le wifi est désactivé par defaut.

root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr 00:18:84:21:D5:30
          inet addr:192.168.0.110  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2663 (2.6 KiB)  TX bytes:650 (650.0 B)

eth0      Link encap:Ethernet  HWaddr 00:18:84:21:D5:30
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2887 (2.8 KiB)  TX bytes:1693 (1.6 KiB)
          Interrupt:4 Base address:0x1000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


root@OpenWrt:~# cat /etc/config/wireless
config wifi-device  wifi0
        option type     atheros
        option channel  5

        # REMOVE THIS LINE TO ENABLE WIFI:
        option disabled 1

config wifi-iface
        option device   wifi0
        option network  lan        # Briggé avec le réseau lan déclaré dans /etc/config/network
        option mode     ap
        option ssid     OpenWrt
        option encryption none


root@OpenWrt:~# cat /etc/config/network
# 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 type     bridge
        option proto    static
        option ipaddr   192.168.0.110
        option netmask  255.255.255.0


Activation du wifi

Modification de l'option disabled dans le fichier /etc/config/wireless

option disabled 0

Relancer le réseau:

# /etc/init.d/network restart

Nouvelle configuration:

root@OpenWrt:/# ifconfig
ath0      Link encap:Ethernet  HWaddr 00:18:84:21:D5:31  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:19 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:1283 (1.2 KiB)

br-lan    Link encap:Ethernet  HWaddr 00:18:84:21:D5:30  
          inet addr:192.168.0.110  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:531 errors:0 dropped:0 overruns:0 frame:0
          TX packets:495 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:36006 (35.1 KiB)  TX bytes:77573 (75.7 KiB)

eth0      Link encap:Ethernet  HWaddr 00:18:84:21:D5:30  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:531 errors:0 dropped:0 overruns:0 frame:0
          TX packets:496 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:43440 (42.4 KiB)  TX bytes:78616 (76.7 KiB)
          Interrupt:4 Base address:0x1000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wifi0     Link encap:Ethernet  HWaddr 00:18:84:21:D5:31  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:193 errors:0 dropped:0 overruns:0 frame:13211
          TX packets:25 errors:2 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:199 
          RX bytes:12289 (12.0 KiB)  TX bytes:2783 (2.7 KiB)
          Interrupt:3 Memory:b0000000-b00ffffc 

La Fonera connectée sur le routeur par son interface eth0 se comporte bien comme un pont wifi.
Les clients wifi se connectent sur la Fonera mais se trouve bien sur le même réseau 192.168.0.0.


Modfication du système


Activer ssh

root@OpenWrt:~# passwd root
Changing password for root
New password:
Retype password:

=> telnet désactivé.

Avec clef ssh du serveur Debian copié sur La Fonera:

dan@vesta:~$ scp .ssh/authorized_keys.client root@fonera:/tmp
root@fonera's password:
authorized_keys.client                                              100%  990     1.0KB/s   00:00
cp /tmp/authorized_keys.client /etc/dropbear/authorized_keys


Arrét du firewall

La Fonera sera utilisée en réseau local.

root@OpenWrt:~# chmod a-x /etc/init.d/firewall


Arrét du serveur DHCP

root@OpenWrt:~# chmod a-x /etc/init.d/dnsmasq


Config. réseau

wifi désactivé par defaut.

root@OpenWrt:~# vi /etc/config/network
# 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 type     bridge
        option proto    static
        option ipaddr   192.168.1.1	=> 192.168.0.110
        option netmask  255.255.255.0



Syslog vers serveur Debian

root@OpenWrt:~# vi /etc/config/system
config system
        option hostname OpenWrt				=> Modification hostname en fonera.
	option log_ip vesta				=> ligne rajoutée pour syslogd vers vesta (syslogd -C16 -L -R vesta)
root@OpenWrt:~# uci get system.cfg1.log_ip		=> Paramètre pris en dynamique aprés modif. fichier.
vesta


Fichier hosts

root@OpenWrt:~# vi /etc/hosts
127.0.0.1 localhost.
192.168.0.4     vesta.homelinux.net     vesta		=> Rajoutée


Mise à l'heure

  • Script rdate
root@OpenWrt:~# vi /etc/init.d/rdate			=> Fichier à créer
#!/bin/sh
sleep 2						=> Attend cause dhcpc
if ! /usr/sbin/rdate -s vesta
then
        /usr/sbin/rdate -s ntp.unice.fr
fi
  • Lien vers le script
/etc/rc.d/S99rdate -> /etc/init.d/rdate		=> Lien à créer
   
  • Ajout crontab root
5 0 * * * /etc/init.d/rdate
  • Modification timezone

Il faut aussi déclarer la "timezone" pour que l'heure corresponde au lieu du Wrt54gl. Soit créer le fichier /etc/TZ file avec la zone de temps de Paris par exemple.

root@OpenWrt:~# echo "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00" > /etc/TZ


Alias

root@OpenWrt:~# vi /etc/profile

Rajout lignes:

alias l='ls -lhF'
alias log='logread'
alias logf='logread -f'



Configuration mode client wifi


Script d'installation

Script http://fon.testbox.dk/packages/NEW/LEGEND4.5/clientscript/
Ce script modifie automatiquement les fichiers de configuration.

root@OpenWrt:~# tar xvzf clientpackage* && copyop
Done, run clientmode... run aprestore later to undo clientmode changes."



Configuration modifiée

Connexion Wifi sur l'AP Netgear DG834G
Interface ethernet configurée en 192.168.1.2 en statique.

root@fonera:~# cat /etc/config/network
# 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 wan
        option ifname   ath0
        option proto    dhcp

config interface lan
        option ifname   eth0
        option proto static
        option ipaddr  192.168.1.2
        option netmask 255.255.255.0

config interface wlan
        option ifname eth0
        option proto    static
        option ipaddr  192.168.1.2
        option netmask 255.255.255.0


root@fonera:~# cat /etc/config/wireless
config wifi-device  wifi0
        option type     atheros
  option channel  2
  option diversity 0
  option txantenna 1
  option rxantenna 1
# option distance  2000
  option disabled 0				=> A mettre à 1 pour désactiver le wifi (connexion avec 192.168.1.2).

config wifi-iface
        option device   wifi0
        option network  wan
        option mode     sta
        option ssid     GWVESTA
        option nosbeacon 1
        option hidden   0
        option txpower  16
#       option bgscan   0
        option encryption       wep	       => psk pour wpa avec package wpa-supplicant installé
        option key XXXXXXXXXXXXXXXXXXXXXXXXXX  => wep ou wpa


Script pour [des]activer le wifi

Les commandes uci modifie automatique les fichiers de conf. dans /etc/config.
Sera aussi valable au reboot.

root@fonera:~# cat /jffs/bin/wifidisable.sh 
#!/bin/sh
if [ "$1" = "" ]
then
       echo "Usage: $0 0|1"
       exit 1
fi
uci set wireless.wifi0.disabled=$1
uci commit wireless && wifi


Commandes wifi

root@fonera:~#  iwconfig ath0
ath0      IEEE 802.11g  ESSID:"GWVESTA"  Nickname:""
         Mode:Managed  Frequency:2.417 GHz  Access Point: 00:09:5B:CE:31:BE   
         Bit Rate:36 Mb/s   Tx-Power=16 dBm   Sensitivity=1/1  
         Retry:off   RTS thr:off   Fragment thr:off
         Encryption key:XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX   Security mode:restricted
         Power Management:off
         Link Quality=36/70  Signal level=-58 dBm  Noise level=-94 dBm
         Rx invalid nwid:1159  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:0   Missed beacon:0
root@fonera:~# iwlist ath0 tx
ath0      8 available transmit-powers :
         0 dBm         (1 mW)
         6 dBm         (3 mW)
         8 dBm         (6 mW)
         10 dBm        (10 mW)
         12 dBm        (15 mW)
         14 dBm        (25 mW)
         16 dBm        (39 mW)
         18 dBm        (63 mW)
         Current Tx-Power=16 dBm       (39 mW)
root@fonera:~# iwlist ath0 scanning
ath0      Scan completed :
         Cell 01 - Address: 00:17:33:XX:XX:XX
                   ESSID:"Neuf WiFi"
                   Mode:Master
                   Frequency:2.462 GHz (Channel 11)
                   Quality=5/70  Signal level=-90 dBm  Noise level=-95 dBm
                   Encryption key:off
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                             24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
                             12 Mb/s; 48 Mb/s
                   Extra:bcn_int=100
         Cell 02 - Address: 00:09:5B:XX:XX:XX
                   ESSID:"GWVESTA"
                   Mode:Master
                   Frequency:2.417 GHz (Channel 2)
                   Quality=37/70  Signal level=-58 dBm  Noise level=-95 dBm
                   Encryption key:on
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 22 Mb/s
                             6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
                             36 Mb/s; 48 Mb/s; 54 Mb/s
                   Extra:bcn_int=100
         Cell 03 - Address: 4E:33:C8:XX:XX:XX
                   ESSID:""
                   Mode:Master
                   Frequency:2.462 GHz (Channel 11)
                   Quality=9/70  Signal level=-86 dBm  Noise level=-95 dBm
                   Encryption key:on
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                             48 Mb/s; 54 Mb/s
                   Extra:bcn_int=100
                   IE: IEEE 802.11i/WPA2 Version 1
                       Group Cipher : CCMP
                       Pairwise Ciphers (1) : CCMP
                       Authentication Suites (1) : PSK
                   Extra:wme_ie=dd180050f2020101000003a4000027a4000042435e0062322f00
         Cell 04 - Address: 4E:33:C8:XX:XX:XX
                   ESSID:""
                   Mode:Master
                   Frequency:2.462 GHz (Channel 11)
                   Quality=9/70  Signal level=-86 dBm  Noise level=-95 dBm
                   Encryption key:on
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                             48 Mb/s; 54 Mb/s
                   Extra:bcn_int=100
                   IE: IEEE 802.11i/WPA2 Version 1
                       Group Cipher : CCMP
                       Pairwise Ciphers (1) : CCMP
                       Authentication Suites (1) : PSK
                   Extra:wme_ie=dd180050f2020101000003a4000027a4000042435e0062322f00
         Cell 05 - Address: 00:16:41:XX:XX:XX
                   ESSID:"Livebox-cc08"
                   Mode:Master
                   Frequency:2.457 GHz (Channel 10)
                   Quality=1/70  Signal level=-94 dBm  Noise level=-95 dBm
                   Encryption key:on
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                             48 Mb/s; 54 Mb/s
                   Extra:bcn_int=100
         Cell 06 - Address: 00:16:CE:XX:XX:XX
                   ESSID:"WANADOO-7DC0"
                   Mode:Master
                   Frequency:2.412 GHz (Channel 1)
                   Quality=8/70  Signal level=-87 dBm  Noise level=-95 dBm
                   Encryption key:on
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                             24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
                             12 Mb/s; 48 Mb/s
                   Extra:bcn_int=100
                   IE: WPA Version 1
                       Group Cipher : TKIP
                       Pairwise Ciphers (1) : TKIP
                       Authentication Suites (1) : PSK
                   Extra:wme_ie=dd180050f2020101800003a4000027a4000042435e0062322f00
         Cell 07 - Address: 00:17:33:XX:XX:XX
                   ESSID:"NEUF_1E98"
                   Mode:Master
                   Frequency:2.462 GHz (Channel 11)
                   Quality=4/70  Signal level=-91 dBm  Noise level=-95 dBm
                   Encryption key:on
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
                             24 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 9 Mb/s
                             12 Mb/s; 48 Mb/s
                   Extra:bcn_int=100
                   IE: WPA Version 1
                       Group Cipher : TKIP
                       Pairwise Ciphers (2) : CCMP TKIP
                       Authentication Suites (1) : PSK
         Cell 08 - Address: 4E:33:C8:XX:XX:XX
                   ESSID:"freephonie"
                   Mode:Master
                   Frequency:2.462 GHz (Channel 11)
                   Quality=9/70  Signal level=-86 dBm  Noise level=-95 dBm
                   Encryption key:on
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                             48 Mb/s; 54 Mb/s
                   Extra:bcn_int=100
                   IE: WPA Version 1
                       Group Cipher : TKIP
                       Pairwise Ciphers (2) : TKIP CCMP
                       Authentication Suites (1) : PSK
         Cell 09 - Address: 4E:33:C8:XX:XX:XX
                   ESSID:"freephonie"
                   Mode:Master
                   Frequency:2.462 GHz (Channel 11)
                   Quality=9/70  Signal level=-86 dBm  Noise level=-95 dBm
                   Encryption key:on
                   Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                             9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
                             48 Mb/s; 54 Mb/s
                   Extra:bcn_int=100
                   IE: WPA Version 1
                       Group Cipher : TKIP
                       Pairwise Ciphers (1) : TKIP
                       Authentication Suites (1) : 802.1x
                   Extra:wme_ie=dd180050f2020101000003a4000027a4000042435e0062322f00



Developper des programmes pour La Fonera

Contruire OpenWrt à partir de sources

http://forum.openwrt.org/viewtopic.php?pid=45838

  • Télécharger les sources
svn co https://svn.openwrt.org/openwrt/trunk/
svn co https://svn.openwrt.org/openwrt/packages/ trunk/feeds/packages/
cd trunk/
make package/symlinks
 
  • Configure Kamikaze (select target system) and the packages (a full build with all packages selected requires about 9GB of free disk space)
make menuconfig
  • If you select extra packages it's a good idea to check if you have all prerequisites installed. Check with:
make prereq

TIP: To find the missing packages search at http://packages.ubuntu.com/

  • Finally build Kamikaze (to download all packages at once use 'make download world')
make world
  • After the build finished, ready to use images can be found in $(TOPDIR)/bin


Targets for 'make'

download

   download all source tarballs (from the selected packages and it's dependencies) at once before starting the build

prereq

   checks if you have all prerequisites installed on the host-system for building the selected packages

world

   build everything

tools/install toolchain/install

   only build the tools and the toolchain

clean

   cleans the packages (NOT the tools and toolchain)

distclean

   cleans up everything expect $(TOPDIR)/.config and $(TOPDIR)/dl/

package/<package_name>-{clean,compile}

   rebuild a single package

package/index

   updates $(TOPDIR)/bin/packages/Packages

V=99

   turns on debugging

make kernel_menuconfig

   If you want, you can also modify the kernel config for the selected target system. Simply run "make kernel_menuconfig"
   and the build system will unpack the kernel sources (if necessary), run menuconfig inside of the kernel tree, and then
   copy the kernel config to target/linux/<platform>/config so that it is preserved over "make clean" call. 


SDK

L'environnement de développement permet construire les outils:

OpenWrt Image Builder
OpenWrt SDK (environnement de cross-compilation)


GPIO de La FONERA

Ces sont les ports d'entrées/sorties du routeur. Certains sont libres d'utilisation.


Utiliser les entrées sorties GPIO sur la Fonera

=> http://www.equinoxefr.org/index.php/post/2007/11/11/Jouer-avec-les-entrees-sorties-GPIO-sur-la-Fonera

Cablage GPIO


Source du module proc_gpio

Un module kernel a été créé pour donner accès au GPIO.

Celui-ci est disponible sur ce lien: http://fghhgh.150m.com/ et en mirroir ici: gpio.tgz


GPIO Description

Bit		Fonctions
0		TP3	
1		pin 5 of SW1
2		WLAN LED
3		pin 1 of SW1
4		pin 2 of SW1
5		RESET (!)
6		RESET button
7		pin 6 of SW1


Utilisation

Lancement du module:

# insmod proc_gpio.ko
# lsmod
Module                  Size  Used by
proc_gpio               2704  0

Etat des entrées/sorties:

# cat /proc/gpio/info
GPIO_IN   0X7FFF20
GPIO_OUT  0X000020
GPIO_DIR  0X000020

Test en dés/activant la led WAN:

# echo 1 > /proc/gpio/2_dir
# echo 1 > /proc/gpio/2_out
=> WLAN LED on
# echo 0 > /proc/gpio/2
=> WLAN LED off

Pin 1 of SW1 en sortie:

# echo 1 > /proc/gpio/3_dir
# echo 1 > /proc/gpio/3_out        => Pin 1 à 3.3V
# echo 0 > /proc/gpio/3_out        => Pin 1 à 0V

Pin 1 of SW1 en entrée:

# echo 0 > /proc/gpio/3_dir
# cat /proc/gpio/3_in             => 0: Pin 1 à 0V, 1: Pin 1 à 3.3V


Test des entrées/sorties libres pour utilisation:

Test du cablage


Bus i2c pour La Fonera

  • Source

http://www.lefinnois.net/wp/index.php/2007/05/05/un-bus-i2c-pour-la-fonera/


  • Shéma remis en forme

Image:La_Fonera_I2C_sch.png

Packages dispo. sur http://www.lefinnois.net/fonerai2c/7.07/atheros-2.6/packages/
Dispo. aussi ici: i2c_lefinnois.tgz


Version kernel identique que sous OpenWrt 7.09.

Name						Last Modified		Size
i2cdetect_0.1-1_mips.ipk			2007-Sep-05 21:54:07	7.1K
kmod-i2c-algos_2.6.21.5-atheros-1_mips.ipk	2007-Sep-05 21:54:07	6.1K
kmod-i2c-core_2.6.21.5-atheros-1_mips.ipk	2007-Sep-05 21:54:08	14.4K
kmod-i2cgpio_2.6.21.5-atheros-1_mips.ipk	2007-Sep-05 21:54:08	2.3K                      


Attention le nom des modules différe de l'affichage dans lsmod (un '-' au lieu d'un '_'):

root@fonera:~# l /lib/modules/2.6.21.5/ | grep i2c
-rw-r--r--    1 root     root        13.8k Sep  5  2007 i2c-algo-bit.ko
-rw-r--r--    1 root     root        25.5k Sep  5  2007 i2c-core.ko
-rw-r--r--    1 root     root        10.8k Sep  5  2007 i2c-dev.ko
-rw-r--r--    1 root     root         4.6k Sep  5  2007 i2c-gpio.ko
root@fonera:~# lsmod|grep i2c
i2c_gpio                1552  0 
i2c_algo_bit            7152  1 i2c_gpio
i2c_dev                 4976  0 
i2c_core               13776  3 i2c_gpio,i2c_algo_bit,i2c_dev


Pour les "charger":

root@fonera:~# insmod i2c-core
root@fonera:~# insmod i2c-dev
root@fonera:~# insmod i2c-algo-bit i2c_debug=3 bit_test=1
root@fonera:~# insmod i2c-gpio inverted=1

Mais pour les "décharger":

root@fonera:~# rmmod i2c_gpio


Correspondance connecteur SW1 / Bits GPIO / I2C

SW1	GPIO	I2C		Connecteur Plaque
		Gnd		Noir
1 <	Bit 3	SDA out		Marron
2 	Bit 4	SDA in		Rouge
3
4
5	Bit 1	SCL out		Orange
6	Bit 7	SCL in		Jaune


Config. GPIO pour l'I2C (à faire seulement pour vérifier le fonctionnement du 74HC05 en statique):

root@fonera:~# echo 1 > /proc/gpio/3_dir
root@fonera:~# echo 1 > /proc/gpio/1_dir
root@fonera:~# echo 0 > /proc/gpio/7_dir
root@fonera:~# echo 0 > /proc/gpio/4_dir


Interface I2C en test


Utilisation

  • Détection de l'interface logiciel.
root@fonera:~# i2cdetect -l
i2c-0   i2c             GPIO adapter                            Algorithm unavailable
  • Détection des composants i2c
root@fonera:~# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] 
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          XX XX XX XX XX XX XX XX XX XX XX XX XX 
10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 
20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 
30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 
40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 4f
50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 
60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX 
70: XX XX XX XX XX XX XX XX                         

=> DS1621 en 0x4F (0x9E/0x9F)

Test du cablage


Programme de test d'un DS1621

  • Source du programme

Programme personnel pour piloté un circuit DS1621: Thermomètre/thermostat i2c.
Source complète dispo. ici: Fonera_ds1621.tgz

A "détarer" dans le répertoire package du SDK.


  • Utilisation du SDK pour compiler le programme
dan@vesta:OpenWrt-SDK-atheros-for-Linux-i686$ make
 make[1] world
 make[2] package/compile
 make[3] -C package/ds1621 compile
 make[2] package/index
dan@vesta:OpenWrt-SDK-atheros-for-Linux-i686$ find . -name "ds1621*"
./build_dir/linux-atheros/ds1621
./build_dir/linux-atheros/ds1621/ds1621.o
./build_dir/linux-atheros/ds1621/ds1621.c~
./build_dir/linux-atheros/ds1621/ipkg/ds1621
./build_dir/linux-atheros/ds1621/ipkg/ds1621/usr/bin/ds1621
./build_dir/linux-atheros/ds1621/ds1621_fonera_1.c
./build_dir/linux-atheros/ds1621/ds1621					<= Binaire du programme.
./build_dir/linux-atheros/ds1621/ds1621.c
./package/ds1621
./package/ds1621/src/ds1621.c~
./package/ds1621/src/ds1621.c
./bin/packages/ds1621_1_mips.ipk					<= Package du programme.


  • Transfert du binaire sur La Fonera:
dan@vesta:OpenWrt-SDK-atheros-for-Linux-i686$ scp ./build_dir/linux-atheros/ds1621/ds1621 root@fonera-s:
ds1621                                                                     100% 8348     8.2KB/s   00:00
  • Test
root@fonera:~# ./ds1621
24.6°


root@fonera:~# while sleep 10
> do 
> logger -t ds1621 -p local1.info $(./ds1621)
> done


Autre exemple avec un Max128

Voir page Acquisition senseurs I2C Fonera par messages xPL



18/3/2008