14/05/2009
Installation
Un vieux modem/routeur Netgear DG834 trainait sur un coin de mon bureau. Un rapide tour sur http://oldwiki.openwrt.org/OpenWrtDocs(2f)Hardware.html m'apprend que ce matériel est supporté. Je vais donc décrire l'installation de Kamikaze 8.09.
Pas à pas
On commence par activer le telnet depuis l'interface html:
$ wget --user=admin --password=passord 'http://192.168.0.1/setup.cgi?todo=debug'
$ telnet 192.169.0.1
Petit tour du propriétaire:
# cat /proc/version
Linux version 2.4.17_mvl21-malta-mips_fp_le (root@Run-P4) (gcc version 2.95.3 20010315 (release/MontaVista)) #6 Wed Sep 7 16:50:05 CST 2005
# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 14757888 6991872 7766016 0 778240 2539520
Swap: 0 0 0
MemTotal: 14412 kB
MemFree: 7584 kB
MemShared: 0 kB
Buffers: 760 kB
Cached: 2480 kB
SwapCached: 0 kB
Active: 1008 kB
Inactive: 3232 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 14412 kB
LowFree: 7584 kB
SwapTotal: 0 kB
SwapFree: 0 kB
# cat /proc/ticfg/env
memsize 0x01000000
flashsize 0x00400000
modetty0 115200,n,8,1,hw
modetty1 115200,n,8,1,hw
bootserport tty0
cpufrequency 150000000
sysfrequency 125000000
bootloaderVersion 0.18.01
ProductID DG834
HWRevision Unknown
SerialNumber none
prompt DGB34
firstfreeaddress 0x9402e088
req_fullrate_freq 125000000
mtd0 0x900d0000,0x903e0000
mtd1 0x90020000,0x900d0000
mtd2 0x90000000,0x90020000
mtd3 0x903e0000,0x903f0000
autoload
maca 00:09:5b:9e:8e:be
macb 00:09:5b:9e:8e:bf
Bridge_MODE 0
mt_time 0
oam_lb_timeout 100
mtd4 0x903f0000,0x90400000
my_ipaddress 192.168.0.1
# cat /proc/mtd
dev: size erasesize name
mtd0: 00310000 00010000 "mtd0"
mtd1: 000b0000 00010000 "mtd1"
mtd2: 00020000 00010000 "mtd2"
mtd3: 00010000 00010000 "mtd3"
mtd4: 00010000 00010000 "mtd4"
La lecture de http://www.earth.li/~noodles/hardware-dg834g.html nous apprend qu'il faut modifier le firmware d'origine. Une version de mtd2.bin avec le bon md5 est disponible ici.
# cd /tmp
# wget http://download.bsdsx.fr/netgear/mtd2.bin
# dd if=/tmp/mtd2.bin of=/dev/mtdblock/2
# reboot
On réactive le telnet et on prépare l'installation d'OpenWrt:
# cd /proc/sys/dev/adam2
# echo "mtd5 0x90020000,0x903e0000" > environment
# reboot
C'est reparti pour un telnet et on passe aux choses sérieuses:
# wget http://downloads.openwrt.org/kamikaze/8.09/ar7/openwrt-ar7-squashfs.bin
# dd if=openwrt-ar7-squashfs.bin of=/dev/mtdblock/5
# reboot
Et là c'est le drame:
$ ping -c 1 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.0.115 icmp_seq=1 Destination Host Unreachable
--- 192.168.0.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
Console série USB
Pour cette recette, il nous faut:
- un dg834 qui ne répond plus
- un câble nokia data (DKU-5)
- un fer à souder
- un vieux lecteur ZIP IDE
- un vieux câble audio de cdrom
- une petite pince, idéalement à bec courbé
- explosez le lecteur IDE et récupérez les pinoches
- découpez le câble DKU-5
- explosez le connecteur du câble audio
- soudez les petits connecteurs du câble audio aux fils noir, blanc et bleu du DKU-5
- repérez le jumper j603 http://www.thinkbroadband.com/images/reviews/netgear-dg834/cap-19893.jpg
- soudez les pinoches sur le jumper j603 du dg834
Petit tip pour la soudure: maintenez simplement la pinoche sur la pastille d'étain à l'aide de la pince et faites chauffer le dessus de la pinoche. Appuyez vers le bas et la pinoche rentre toute seule.
Un petit schéma ascii:
j101
j603 [[o]] [o] [o] [o] [o] [o]
N B B
o l l
i a e
r n u
c
j100
Je suis une vrai quiche en électronique donc cette manipulation est vraiment à la portée du plus grand nombre.
Lève-toi et marche
$ cu -l /dev/ttyU0 -s 115200
ADAM2 Revision 0.18.01
(C) Copyright 1996-2003 Texas Instruments Inc. All Rights Reserved.
(C) Copyright 2003 Telogy Networks, Inc.
Usage: setmfreq [-d] [-s sys_freq, in MHz] [cpu_freq, in MHz]
Memory optimization Complete!
DGB34 >
Press any key to abort OS load, or wait 3 seconds for OS to boot...
DGB34 > help
Commands Description
-------- -----------
h/help Displays the commands supported
info Displays board information
memop Memory Optimization
setmfreq configures/dumps the system and cpu frequencies
dm Dump memory at <address>
erase Erase Flash except Adam2 Kernel and Env space
printenv Displays Env. Variables
setenv Sets Env. variable <var> with a value <val>
unsetenv Unsets the Env. variable <var>
fixenv Defragment for Env. space
go Loads the image starting at address <mtd1>
DGB34 > info
Monitor Revision 0.18.01
Monitor Compilation time Aug 1 2003, 14:43:32
Endianness Little
External Memory rate Full, 16 bit wide
CPU Frequency 150 MHz
DGB34 > printenv
memsize 0x01000000
flashsize 0x00400000
modetty0 115200,n,8,1,hw
modetty1 115200,n,8,1,hw
bootserport tty0
cpufrequency 150000000
sysfrequency 125000000
bootloaderVersion 0.18.01
ProductID DG834
HWRevision Unknown
SerialNumber none
prompt DGB34
firstfreeaddress 0x9402e088
req_fullrate_freq 125000000
mtd0 0x900d0000,0x903e0000
mtd1 0x90020000,0x900d0000
mtd2 0x90000000,0x90020000
mtd3 0x903e0000,0x903f0000
autoload
maca 00:09:5b:9e:8e:be
macb 00:09:5b:9e:8e:bf
Bridge_MODE 0
mt_time 0
oam_lb_timeout 100
mtd4 0x903f0000,0x90400000
my_ipaddress 192.168.0.1
mtd5 0x90020000,0x903e0000
DGB34 > go
checksum error
Linux version 2.6.26.5 (nbd@baustelle) (gcc version 4.1.2) #1 Mon Jan 5 05:57:36 CET 2009
console [early0] enabled
CPU revision is: 00018448 (MIPS 4KEc)
TI AR7 (TNETD7300), ID: 0x0005, Revision: 0x02
Determined physical RAM map:
memory: 01000000 @ 14000000 (usable)
Initrd not found or empty - disabling initrd
Zone PFN ranges:
Normal 81920 -> 86016
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 81920 -> 86016
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4064
Kernel command line: init=/etc/preinit rootfstype=squashfs,jffs2, console=ttyS0,115200n8
Primary instruction cache 16kB, VIPT, 4-way, linesize 16 bytes.
Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 16 bytes
PID hash table entries: 64 (order: 6, 256 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 12572k/16384k available (1988k kernel code, 3812k reserved, 422k data, 124k init, 0k highmem)
SLUB: Genslabs=6, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Mount-cache hash table entries: 512
net_namespace: 644 bytes
NET: Registered protocol family 16
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
NET: Registered protocol family 1
squashfs: version 3.0 (2006/03/15) Phillip Lougher
Registering mini_fo version $Id$
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
msgmni has been set to 24
io scheduler noop registered
io scheduler deadline registered (default)
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x8610e00 (irq = 15) is a TI-AR7
console handover: boot [early0] -> real [ttyS0]
serial8250: ttyS1 at MMIO 0x8610f00 (irq = 16) is a TI-AR7
Fixed MDIO Bus: probed
cpmac-mii: probed
cpmac: device eth0 (regs: 08612800, irq: 41, phy: , mac: 00:09:5b:9e:8e:bf)
cpmac: device eth1 (regs: 08610000, irq: 27, phy: , mac: 00:09:5b:9e:8e:be)
physmap platform flash device: 00800000 at 10000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
cmdlinepart partition parsing not available
RedBoot partition parsing not available
4 ar7part partitions found on MTD device physmap-flash.0
Creating 4 MTD partitions on "physmap-flash.0":
0x00000000-0x00010000 : "loader"
0x003f0000-0x00400000 : "config"
0x00020000-0x003f0000 : "linux"
0x000f0000-0x003f0000 : "rootfs"
mtd: partition "rootfs" set to be root filesystem
mtd: partition "rootfs_data" created automatically, ofs=220000, len=1D0000
0x00220000-0x003f0000 : "rootfs_data"
ar7_wdt: timer margin 59 seconds (prescale 65535, change 57180, freq 62500000)
Registered led device: ppp
Registered led device: status
Registered led device: adsl
Registered led device: wifi
Registered led device: power
vlynq0: regs 0x08611800, irq 29, mem 0x04000000
vlynq1: regs 0x08611c00, irq 33, mem 0x0c000000
TCP vegas registered
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: 124k freed
Please be patient, while OpenWrt loads ...
Algorithmics/MIPS FPU Emulator v1.5
- preinit -
Press CTRL-C for failsafe
switching to jffs2
mini_fo: using base directory: /
mini_fo: using storage directory: /jffs
- init -
Please press Enter to activate this console.
BusyBox v1.11.2 (2009-01-04 22:13:46 CET) 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 (8.09, r14511) ----------------------------
* 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:/# PHY: 0:10 - Link is Down
br-lan: Dropping NETIF_F_UFO since no NETIF_F_HW_CSUM feature.
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
ip_tables: (C) 2000-2006 Netfilter Core Team
br-lan: port 1(eth0) entering disabled state
br-lan: port 1(eth0) entering learning state
br-lan: topology change detected, propagating
br-lan: port 1(eth0) entering forwarding state
nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
root@OpenWrt:/# ifconfig
br-lan Link encap:Ethernet HWaddr 00:09:5B:9E:8E:BF
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 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:09:5B:9E:8E:BF
UP BROADCAST RUNNING MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:41
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:/#
Bon, je reconnais que j'aurais pu me passer de la partie fer à souder si j'avais pingué 192.168.1.1 au lieu de 192.168.0.1 . Cette ip est fixée en dur lors de la compilation d'OpenWrt.
Bonne nouvelle, j'ai maintenant accès au boot ADAM2. Pas suffisant pour flasher la bête en cas de problème comme on peut le lire sur http://www.seattlewireless.net/ADAM2 et mes tentatives de ftp se soldaient par des échecs. Mais maintenant que j'ai accè;s à la console, il est plus facile de détecter cette petite fenêtre où le bootloader accepte les connexions ftp: il suffit d'attendre le message "Press any key to abort OS load...".
Et maintenant
Et oui, c'est bien beau mais qu'est-ce que j'en fais de ce dg834 ? Mon FAI a un célèbre client prénommé Rodolphe qui a tout compris. Ce qui me chagrine:
le serveur DHCP
C'est quand même pénible de rebooter la box pour un simple ajout de bail permanent.
pas de serveur DNS cache
Un petit dnsmasq, c'est bonheur ! ping iphone classe non ?
pas de serveur de temps
toutes les machines à la bonne/même heure, c'est pas mieux ?
Quand on commence à avoir plusieurs machines, c'est le genre de services bien pratique. Et quand le tout est ipv6 compliant, pourquoi s'en priver ?
J'ai donc désactiver le dhcp de ma box et configuré dnsmasq. Pour vous éviter de perdre du temps, un extrait de la conf:
config dhcp lan
option interface lan
option start 100
option limit 150
option leasetime 48h
option dhcp_option '3,192.168.0.254' # gateway
Le dhcp_option m'a fait un peu tourné en bourrique mais maintenant "it works" !
Et demain
Petit tour du stock:
- 2x fon2100 (1 rj45 + 1 wifi)
- 1x fon2201 (2 rj45 + 1 wifi)
- 1x fon2202 (2 rj45 + 1 wifi + 1 usb)
- 1x dg834 (switch 4 ports rj45)
- 1x dg834g (switch 4 ports rj45 + 1 wifi)
- 1x livebox (switch 4 ports rj45 + 1 wifi + 1 bluetooth + 1 usb)
De quoi monter un cluster OpenWrt !
Pages : 1
Rss