Versuche mit einem vorinstallierten Linux auf NGW100 ---------------------------------------------------- 2010-05-03, H. Hoegl Eine neuere NGW100 Platine (sparsame Siebdruck-Beschriftung, Brett "rt4") war mit dem Linux ausgestattet, das im folgenden beschrieben wird. Der U-Boot Bootloader wurde wahrscheinlich schon mal durch eine neuere Version erneuert. - U-Boot U-Boot 1.3.3-00248-gae9bc0c (Jul 23 2008 - 14:28:10) U-Boot code: 00000000 -> 00011360 data: 00017bf8 -> 0004e530 malloc: Using memory from 0x11f71000 to 0x11fb1000 DMA: Using memory from 0x11f6d000 to 0x11f71000 Flash: 8 MB at address 0x00000000 DRAM Configuration: Bank #0: 10000000 32 MB In: serial Out: serial Err: serial Net: macb0, macb1 Press SPACE to abort autoboot in 1 seconds U-Boot> printenv baudrate=115200 ethaddr=00:04:25:1C:54:E4 bootdelay=1 ethact=macb0 serverip=172.24.41.2 tftpip=172.24.41.2 eth1addr=00:04:25:1C:54:E5 bootcmd=mmcinit; ext2load mmc 0:1 0x10400000 /boot/uImage; bootm ba-mtd=console=ttyS0 root=/dev/mtdblock1 rootfstype=jffs2 bootargs=console=ttyS0 root=/dev/mmcblk0p1 rootfstype=ext2 rootwait stdin=serial stdout=serial stderr=serial Environment size: 366/65532 bytes - Originales Linux von Atmel im NOR Flash (mtd1): /media/mmcblk0p1 # uname -a Linux ngw.example.net 2.6.18-atngw #1 Fri Apr 27 13:45:58 CEST 2007 avr32 unknown - Zugang ueber ftp (pwd "roota"): hhoegl@gazelle:~$ ncftp -u root 10.11.12.2 - Ftp wird auf dem NGW100 ueber inetd gestartet: ~ # cat etc/inetd.conf ftp stream tcp nowait root.root /usr/sbin/ftpd ftpd #netbios-ssn stream tcp nowait root.root /usr/sbin/smbd smbd #netbios-ns dgram udp wait root.root /usr/sbin/nmbd nmbd swat stream tcp nowait.400 root.root /usr/sbin/swat swat - Aus Linux auf dem NGW100 die drei JFFS2 Partitionen mtd0, mtd1 und mtd2 in Dateien auf der MMC Karte sichern: /sbin # dd if=/dev/mtd0 of=/media/mmcblk0p1/mtd0.image /sbin # dd if=/dev/mtd1 of=/media/mmcblk0p1/mtd1.image /sbin # dd if=/dev/mtd2 of=/media/mmcblk0p1/mtd2.image ls -l /media/mmcblk0p1/*image: -rw-r--r-- 1 root root 131072 Jan 1 02:39 mtd0.image -rw-r--r-- 1 root root 8192000 Jan 1 01:38 mtd1.image -rw-r--r-- 1 root root 65536 Jan 1 02:39 mtd2.image - Ich kann alle drei MMC/SD Karten von Linux aus ansprechen: - Toshiba 128M - Hama 1G - Transcend 2G U-Boot kann nur die Toshiba 128M ansprechen. Probleme beim Booten, RootFS kann nicht gemountet werden. - HTTPD (in Busybox 1.4.2) ~ # cat /etc/httpd.conf ---- # Allow trafic from local LAN A: 10.0.0.0/24 # Deny all other trafic D: * .asp:text/html /cgi-bin/webif:root:roota /cgi-bin/webif:admin:roota ---- XXX To Do: Damit man sich mit http://10.11.12.2 verbinden kann, aendere auf "A: *", entferne "D: *". Voreingestellt ist die IP Adresse des NGW auf 10.0.0.1. Folgende Links gibt es: http://10.11.12.2 (Startseite) http://10.11.12.2/wiki/ (liegt unter /www/wiki/ auf mtd1) http://10.11.12.2/cgi-bin/webif.sh Samba Web Admin Tool (SWAT). Klappt nicht. http://10.11.12.2/cgi-bin/cgipio.cgi (GPIO Demo) Achtung: GPIO funktioniert noch mit dem veralteten gpio-dev! /www/cgi-bin # ls -l -rwxr-xr-x 1 root root 6254 Apr 23 2007 cgipio.cgi drwxr-xr-x 2 root root 0 Sep 21 2006 webif -rwxr-xr-x 1 root root 31 Sep 21 2006 webif.sh Die Datei cgipio.cgi ist eine ausfuehrbare Binaerdatei (siehe cgipio.c in misc/cgipio/). - MTD Partitionen ~ # cat /proc/mtd dev: size erasesize name mtd0: 00020000 00010000 "u-boot" mtd1: 007d0000 00010000 "root" mtd2: 00010000 00010000 "env" mtd3: 00840000 00000420 "spi0.0-AT45DB642x" - Mounts ~ # mount rootfs on / type rootfs (rw) /dev/root on / type jffs2 (rw) proc on /proc type proc (rw) sys on /sys type sysfs (rw) dev on /dev type tmpfs (rw) pts on /dev/pts type devpts (rw) config on /config type configfs (rw) tmp on /tmp type tmpfs (rw) run on /var/run type tmpfs (rw) samba on /var/lib/samba type tmpfs (rw) log on /var/log type tmpfs (rw) /dev/mtdblock3 on /usr type jffs2 (rw) /dev/mmcblk0p1 on /media/mmcblk0p1 type ext2 (rw,sync) - Root Filesystem ls -l: drwxr-xr-x 2 root root 0 Apr 17 2007 bin drwxr-xr-x 3 root root 0 Jan 1 00:00 config drwxrwxrwt 4 root root 880 Jan 1 00:17 dev drwxr-xr-x 8 root root 0 Sep 13 2006 etc -rw-r--r-- 1 root root 158 Jan 1 02:47 gedicht.txt drwxr-xr-x 3 root root 0 Dec 13 2006 home drwxr-xr-x 3 root root 0 Apr 23 2007 lib lrwxrwxrwx 1 root root 11 Apr 17 2007 linuxrc -> bin/busybox drwxr-xr-x 4 root root 0 Jan 1 00:17 media drwxr-xr-x 2 root root 0 Dec 13 2006 mnt dr-xr-xr-x 42 root root 0 Jan 1 00:00 proc drwxr-xr-x 2 root root 0 Apr 17 2007 sbin drwxr-xr-x 10 root root 0 Jan 1 00:00 sys drwxrwxrwt 3 root root 60 Jan 1 00:00 tmp -rw-r--r-- 1 root root 912671 Apr 27 2007 uImage drwxr-xr-x 8 root root 0 Jan 1 1970 usr drwxr-xr-x 7 root root 0 Jan 30 2007 var drwxr-xr-x 4 root root 0 Jan 30 2007 www - Free space (using a 128M Toshiba SD/MMC Card) ~ # df Filesystem 1k-blocks Used Available Use% Mounted on /dev/root 8000 6584 1416 82% / dev 15468 0 15468 0% /dev tmp 15468 0 15468 0% /tmp run 15468 24 15444 0% /var/run samba 15468 228 15240 1% /var/lib/samba log 15468 40 15428 0% /var/log /dev/mtdblock3 8448 8180 268 97% /usr /dev/mmcblk0p1 118983 19710 93124 17% /media/mmcblk0p1 - Prozesse ~ # ps PID Uid VmSize Stat Command 1 root 308 S init 2 root SWN [ksoftirqd/0] 3 root SW [watchdog/0] 4 root SW< [events/0] 5 root SW< [khelper] 6 root SW< [kthread] 27 root SW< [kblockd/0] 52 root SW [pdflush] 53 root SW [pdflush] 54 root SW< [kswapd0] 55 root SW< [aio/0] 73 root SW [mtdblockd] 95 root SWN [jffs2_gcd_mtd1] 165 root 204 S /sbin/syslogd 176 root 184 S /sbin/klogd 211 root SW [mmcqd] 227 root SWN [jffs2_gcd_mtd3] 254 root 164 S /usr/sbin/telnetd -l /bin/ash 277 root 244 S /usr/sbin/dnsmasq 298 root 232 S /usr/sbin/dropbear 305 root 224 S /usr/sbin/inetd 314 root 896 S /usr/sbin/nmbd -D 319 root 1428 S /usr/sbin/smbd -D 324 root 928 S /usr/sbin/smbd -D 325 root 876 S /usr/sbin/winbindd 329 root 820 S /usr/sbin/winbindd 334 root 176 S /usr/sbin/httpd -h /www -c /etc/httpd.conf 375 root 424 S -sh 506 root SW [mmcqd] 558 root 424 S /bin/ash ~ # dmesg Linux version 2.6.18-atngw (hcegtvedt@hcegtvedt) (gcc version 4.1.2-atmel.0.0.90) #1 Fri Apr 27 13:45:58 CEST 2007 CPU: AP7000 [01] revision 0 (AVR32B revision 1) CPU: MMU configuration: Shared TLB CPU: features: java perfctr ocd CPU: Running at 140.000 MHz Physical memory: 10000000 - 12000000 Reserved memory: Node 0: bdata = 90183da4, bdata->node_bootmem_map = 9018f000 Node 0: Kernel image 10000000 - 1018e378 Exception vectors start at 9000e000 CPU: Paging enabled Node 0: start_pfn = 0x10000, low = 0x12000 On node 0 totalpages: 8192 DMA zone: 8192 pages, LIFO batch:1 Node 0: mem_map starts at 90191000 Built 1 zonelists. Total pages: 8192 Kernel command line: console=ttyS0 root=/dev/mtdblock1 rootfstype=jffs2 PID hash table entries: 256 (order: 8, 1024 bytes) Before time_init: count=f80039f2, compare=ffffffff Cycle counter: mult=468114, shift=16 After time_init: count=00000009, compare=00088b80 Dentry cache hash table entries: 4096 (order: 2, 16384 bytes) Inode-cache hash table entries: 2048 (order: 1, 8192 bytes) Memory: 30864k/30884k available (1070k kernel code, 1884k reserved, 208k data, 56k init) Calibrating delay using timer specific routine.. 280.39 BogoMIPS (lpj=560783) Mount-cache hash table entries: 512 NET: Registered protocol family 16 pdc pdc.0: Atmel Peripheral DMA Controller enabled EIM: External Interrupt Module at 0xfff00000, IRQ 19 EIM: Handling 4 external IRQs, starting with IRQ 64 smc smc.0: Atmel Static Memory Controller at 0xfff03400 pio0: Atmel Port Multiplexer at 0xffe02800 (irq 13) pio0: Handling 32 external IRQs, starting with IRQ 96 pio1: Atmel Port Multiplexer at 0xffe02c00 (irq 14) pio1: Handling 32 external IRQs, starting with IRQ 128 pio2: Atmel Port Multiplexer at 0xffe03000 (irq 15) pio2: Handling 32 external IRQs, starting with IRQ 160 pio3: Atmel Port Multiplexer at 0xffe03400 (irq 16) pio3: Handling 32 external IRQs, starting with IRQ 192 pio4: Atmel Port Multiplexer at 0xffe03800 (irq 17) pio4: Handling 32 external IRQs, starting with IRQ 224 dmac0: DesignWare DMA controller at 0xff200000 irq 2 NET: Registered protocol family 2 IP route cache hash table entries: 256 (order: -2, 1024 bytes) TCP established hash table entries: 1024 (order: 0, 4096 bytes) TCP bind hash table entries: 512 (order: -1, 2048 bytes) TCP: Hash tables configured (established 1024 bind 512) TCP reno registered smc cs0: setup/00030001 pulse/06030504 cycle/00090009 mode/00001103 JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc. io scheduler noop registered io scheduler cfq registered (default) Serial: Atmel USART3 driver usart.1: ttyS0 at MMIO 0xffe01000 (irq = 7) is a USART3 loop: loaded (max 8 devices) eth0: Atmel MACB at 0xfff01800 irq 25 (00:04:25:1c:54:e4) eth1: Atmel MACB at 0xfff01c00 irq 26 (00:04:25:1c:54:e5) physmap platform flash device: 00800000 at 00000000 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank Amd/Fujitsu Extended Query Table at 0x0041 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 Using physmap partition information Creating 3 MTD partitions on "physmap-flash.0": 0x00000000-0x00020000 : "u-boot" 0x00020000-0x007f0000 : "root" 0x007f0000-0x00800000 : "env" atmel_spi atmel_spi.0: Atmel SPI Controller at 0xffe00000 (irq 3) mtd_dataflash spi0.0: AT45DB642x (8448 KBytes) ip_conntrack version 2.4 (256 buckets, 2048 max) - 204 bytes per conntrack ip_tables: (C) 2000-2006 Netfilter Core Team TCP bic registered NET: Registered protocol family 1 NET: Registered protocol family 17 Time: avr32 clocksource has been installed. VFS: Mounted root (jffs2 filesystem). Freeing init memory: 56K (90000000 - 9000e000) mmc0: Atmel MCI controller at 0xfff02400 irq 28 JFFS2 write-buffering enabled buffer (1056) erasesize (8448) mmcblk0: mmc0:272e SD128 123008KiB (ro) mmcblk0: p1 eth0: link down eth1: link down created gpio0 (pio0/0x00010000) as (254:0) created gpio1 (pio0/0x00080000) as (254:1) created gpio2 (pio4/0x00080000) as (254:2) eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1 usart0: Frame error usart0: Frame error mmcblk0: mmc0:272e SD128 123008KiB mmcblk0: p1 EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended ~ # ls /usr/bin/ [ find ntpdc tdbdump [[ findsmb ntpq tdbtool arping fold ntptime tee awk free ntptrace telnet basename gawk openvt test bunzip2 gawk-3.1.5 passwd tickadj bzcat haserl patch time cal head pdbedit top chvt hexdump pgawk tr cksum id pgawk-3.1.5 tty clear igawk readlink uniq cmp install renice unix2dos crontab killall reset unzip cut last rx uptime dbclient ldd setsid wc deallocvt less smbclient webif-page diff logger smbpasswd wget dirname md5sum smbstatus which dos2unix nmblookup smbtar who dropbearconvert nohup sntp whoami dropbearkey nslookup sort xargs du ntp-keygen strings yes eject ntp-wait sum env ntpd tail expr ntpdate tdbbackup ~ # ls /bin/ addgroup date fgrep login nice sed umount adduser dd getopt ls pidof sh uname ash delgroup grep mkdir ping sleep usleep busybox deluser gunzip mknod printenv stat vi cat df gzip mktemp ps su watch chgrp dmesg hostname more pwd sync which chmod echo ip mount rm tar zcat chown egrep kill mv rmdir touch cp false ln netstat run-parts true ~ # ls /etc/ asound.state ethers httpd.conf nsswitch.conf samba banner fb.modes inetd.conf ntp.conf services config fstab init.d passwd shells default group inittab printcap udhcpd.conf directfbrc hostname mdev.conf protocols dnsmasq.conf hosts modules release dropbear hosts.dnsmasq network resolv.conf - ~ # cat /etc/passwd root:$1$SfxLRnuj$CnodUhS0AIgBjioNN13Ay1:0:0:root:/:/bin/ash ftp::50:50:Anonymous FTP user:/home/ftp:/bin/ash www-data:x:51:51:www-data:/var/www:/bin/false dnsmasq:x:52:52:dnsmasq:/var/lib/dnsmasq:/bin/false sshd:x:110:65534:linux User,,,:/var/run/sshd:/bin/false nobody:x:65534:65534:nobody:/nonexistent:/bin/false user:x:500:100:Linux User,,,:/home/guest:/bin/sh - ~ # cat /etc/group root::0: ftp::50: www-data::51: users::100: audio::101: nogroup::65534 - Webif (http://10.11.12.2/cgi-bin/webif.sh) Router Info ___ ______ _________ _ _ ______ __ / \ \ / / _ \|___ /___ \ | \ | |/ ___\ \ / / / _ \ \ / /| |_) | |_ \ __) | | \| | | _ \ \ /\ / / / ___ \ V / | _ < ___) / __/ | |\ | |_| | \ V V / /_/ \_\_/ |_| \_\____/_____| |_| \_|\____| \_/\_/ AVR32 NGW (0.99999) ------------------------------------- * Network router * Network firewall * Webserver with dynamic scripting * DHCP Server * DNS Server * FTP Server * SSH Server * Mass-storage-device --------------------------------------------------------- Firmware Version AVR32 NGW (0.99999) Kernel Version Linux version 2.6.18-atngw (hcegtvedt@hcegtvedt) (gcc version 4.1.2-atmel.0.0.90) #1 Fri Apr 27 13:45:58 CEST 2007 Current Date/Time Thu Jan 1 03:26:33 UTC 2004 MAC Address 00:04:25:1C:54:E4 About: webif - NGW Administrative Console This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Copyright © 2005-2006 OpenWrt.org Contributions by: Philipp Kewisch Spectra Jeremy Collake Travis Kemen Markus Wigge SeDkY Ivoshiee arteqw silver71 Layout based on "Prosimii" by haran Connection StatusEthernet Physical Connections IP address HW type Flags HW address Mask Device 10.11.12.1 0x1 0x2 00:14:0B:60:1A:68 * eth0 STATUS Connections to the Router Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 10.11.12.2:23 10.11.12.1:51963 ESTABLISHED tcp 0 0 10.11.12.2:80 10.11.12.1:39062 ESTABLISHED tcp 0 0 10.11.12.2:80 10.11.12.1:39061 TIME_WAIT - /etc # cat fstab # device mount point type options dump pass /dev/mtdblock1 / jffs2 defaults 1 1 /dev/mtdblock3 /usr jffs2 defaults 1 1 proc /proc proc defaults 0 0 sys /sys sysfs defaults 0 0 dev /dev tmpfs defaults 0 0 pts /dev/pts devpts defaults 0 0 run /var/run tmpfs defaults 0 0 log /var/log tmpfs defaults 0 0 samba /var/lib/samba tmpfs defaults 0 0 tmp /tmp tmpfs defaults 0 0 config /config configfs defaults 0 0 * Booten vom NOR Flash U-Boot> set bootargs console=ttyS0 root=/dev/mtdblock1 rootfstype=jffs2 U-Boot> fsload uImage ### JFFS2 loading 'uImage' to 0x10400000 Scanning JFFS2 FS: ....... done. ### JFFS2 load complete: 912671 bytes loaded to 0x10400000 U-Boot> bootm ## Booting kernel from Legacy Image at 10400000 ... Image Name: Linux-2.6.18-atngw Image Type: AVR32 Linux Kernel Image (gzip compressed) Data Size: 912607 Bytes = 891.2 kB Load Address: 10000000 Entry Point: 90000000 Verifying Checksum ... OK Uncompressing Kernel Image ... OK Starting kernel at 90000000 (params at 11f71008)... pdc pdc.0: Atmel Peripheral DMA Controller enabled EIM: External Interrupt Module at 0xfff00000, IRQ 19 EIM: Handling 4 external IRQs, starting with IRQ 64 smc smc.0: Atmel Static Memory Controller at 0xfff03400 pio0: Atmel Port Multiplexer at 0xffe02800 (irq 13) pio0: Handling 32 external IRQs, starting with IRQ 96 pio1: Atmel Port Multiplexer at 0xffe02c00 (irq 14) pio1: Handling 32 external IRQs, starting with IRQ 128 pio2: Atmel Port Multiplexer at 0xffe03000 (irq 15) pio2: Handling 32 external IRQs, starting with IRQ 160 pio3: Atmel Port Multiplexer at 0xffe03400 (irq 16) pio3: Handling 32 external IRQs, starting with IRQ 192 pio4: Atmel Port Multiplexer at 0xffe03800 (irq 17) pio4: Handling 32 external IRQs, starting with IRQ 224 dmac0: DesignWare DMA controller at 0xff200000 irq 2 NET: Registered protocol family 2 IP route cache hash table entries: 256 (order: -2, 1024 bytes) TCP established hash table entries: 1024 (order: 0, 4096 bytes) TCP bind hash table entries: 512 (order: -1, 2048 bytes) TCP: Hash tables configured (established 1024 bind 512) TCP reno registered JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc. io scheduler noop registered io scheduler cfq registered (default) Serial: Atmel USART3 driver usart.1: ttyS0 at MMIO 0xffe01000 (irq = 7) is a USART3 loop: loaded (max 8 devices) eth0: Atmel MACB at 0xfff01800 irq 25 (00:04:25:1c:54:e4) eth1: Atmel MACB at 0xfff01c00 irq 26 (00:04:25:1c:54:e5) physmap platform flash device: 00800000 at 00000000 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank Amd/Fujitsu Extended Query Table at 0x0041 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 Using physmap partition information Creating 3 MTD partitions on "physmap-flash.0": 0x00000000-0x00020000 : "u-boot" 0x00020000-0x007f0000 : "root" 0x007f0000-0x00800000 : "env" atmel_spi atmel_spi.0: Atmel SPI Controller at 0xffe00000 (irq 3) mtd_dataflash spi0.0: AT45DB642x (8448 KBytes) ip_conntrack version 2.4 (256 buckets, 2048 max) - 204 bytes per conntrack ip_tables: (C) 2000-2006 Netfilter Core Team TCP bic registered NET: Registered protocol family 1 NET: Registered protocol family 17 Time: avr32 clocksource has been installed. VFS: Mounted root (jffs2 filesystem). Freeing init memory: 56K (90000000 - 9000e000) init started: BusyBox v1.4.2 (2007-04-17 15:34:55 CEST) multi-call binary * mounting virtual filesystems: /proc /sys /dev /dev/pts /config /tmp /var/run /var/lib/samba /var/log * set mdev hotplug ... [ OK ] * mdev ... [ OK ] * setting hostname ... 'ngw.example.net' * network loopback ... [ OK ] * starting syslogd ... [ OK ] * log messages to syslog ... [ OK ] * starting klogd ... [ OK ] * probing modules ... vfat loaded, mmc_block loaded, atmel-mci loaded, [ OK ] * mounting filesystems: /usr * setup eth0 ... [ STATIC ] (10.11.12.1) * setup eth1 ... [ OK ] * network ... [ OK ] * starting telnetd ... [ OK ] * enable ipv4 forwarding ... [ OK ] * iptables postrouting ... [ OK ] * iptables incoming trafic ... [ OK ] * iptables outgoung trafic ... [ OK ] * starting dnsmasq ... [ OK ] * running ntpdate ... [ FAILED ] * starting dropbear ... [ OK ] * starting inted ... [ OK ] * starting nmbd ... [ OK ] * starting smbd ... [ OK ] * starting winbindd ... [ OK ] * starting httpd ... [ OK ] * get board type for GPIO ... 'NGW' * setup GPIO boot LED ... [ OK ] * setup GPIO LED A ... [ OK ] * setup GPIO LED B ... [ OK ] Network Gateway ready BusyBox v1.4.2 (2007-04-17 15:34:55 CEST) Built-in shell (ash) Enter 'help' for a list of built-in commands. ~ #