Do a build using one of the working configuration files. It appears that binutils 2.17 and gcc 4.1.2 work, and it's plausible that some of the problems we've had are related to using other toolchain versions -- beware of them, is my advice. Some configurations are attached for your convenience. Revision 9382 works, we cannot swear to anything later...and a build log for it is attached as well.
Thanks to Xavier Duret, in recent OpenWRT configurations you can build all the necessary kernel modules up front. Just select kmod-ide-aec62xx and kmod-ide-core under Kernel modules, Block Devices,
In order to recognize the hard disk, you have to get it spinning. This doesn't happen by default on the WL-700gE; the disk is physically activated using GPIO pins 3 or 6. OpenWRT does this during device initialization from userspace, by insmodding a kernel module "diag.ko" that comes from the broadcom-diag openwrt package. There's no real reason I can see that this shouldn't happen at boot time, but that's not how OpenWRT does it so we might as well follow suit.root:/lib/modules/2.6.23.16nb4/kernel/misc# insmod diag.koSleep for a few extra seconds after loading diag so that the hard disk can complete its spinup. (diag waits for five seconds, which is not quite long enough.) dmesg should report:
diag: Detected 'ASUS WL-700gE' diag: Spinning up HDD and enabling leds
After booting, before you load the aec62xx module, you must enable the IDE interface, which is PCI device 1191 (vendor), 0008 (device). That shows up as /sys/devices/pci0000:00/0000:00:02.0 on my box. You might as well enable all the PCI devices at once, though, with:
cd /sys/devices/pci0000:00
for FILE in */enable
do
echo -n 1 > $FILE
done
For me, the first device (the PCI to SSB bridge) fails with a resource conflict error. Huh. As long as it enables 02.0, you're doing OK.
Sleep for a few seconds after enabling the PCI devices.
Grab the following kernel modules -- you can wget them from the freesa box console prompt over the wired network. Of course you have to have networking turned on. At 9382, random was able to turn on networking by doing:
ifconfig eth0.0 down ifconfig eth0.0 192.168.236.150/24 up
The modules you need are:
ide-core.ko ide-disk.ko aec62xx.ko
insmod them in the order given above, sleeping for a couple of seconds after each one.
ide-core.ko should say something like:
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
ide-disk.ko will not say anything until you load the aec62xx driver, but unless ide-disk.ko is loaded, the disk won't be recognized.
aec62xx.ko should say something like:
AEC6280: IDE controller at PCI slot 0000:00:02.0
AEC6280: chipset revision 16
AEC6280: ROM enabled at 0x40000000
AEC6280: 100% native mode on irq 6
ide2: BM-DMA at 0x0180-0x0187, BIOS settings: hde:pio, hdf:pio
ide3: BM-DMA at 0x0188-0x018f, BIOS settings: hdg:pio, hdh:pio
hde: HDT722516DLAT80, ATA DISK drive
hde: host side 80-wire cable detection failed, limiting max speed to UDMA33
ide2 at 0x100-0x107,0x10a on irq 6
hde: max request size: 512KiB
hde: 321672960 sectors (164696 MB) w/7674KiB Cache, CHS=20023/255/63, UDMA(33)
hde: cache flushes supported
hde: hde1 hde2 hde3 hde4
Of course, you won't have hde1..4 until you partition the disk. The last four lines are actually from ide-disk.ko.
Now it is time to drink a kamikaze, and dance the dance of geek victory.
----Device Boot Start End Blocks Id System /dev/hde1 1 20023 160834747 5 Extended /dev/hde5 1 13 104421+ 83 Linux /dev/hde6 14 257 1959929+ 82 Linux swap / Solaris /dev/hde7 258 501 1959929+ 82 Linux swap / Solaris /dev/hde8 502 988 3911827 83 Linux /dev/hde9 989 1718 5863724+ 83 Linux /dev/hde10 1719 10871 73521472 83 Linux /dev/hde11 10872 20023 73513439+ 83 Linux
This is a place to put in odds and ends that we think we may want to include in the book.
FreeSA book should mention that since we are building for MIPS this really highlights the need for no dependency upon upstream x86 binaries
... Like will it be possible to build Java on MIPS? ....
Part of what we like about moving to new platforms is that it really forces questions about "how from source is this stuff?" and hopefully clearly exposes otherwise non-obvious binary dependencies
h2. mount and dfroot:/# rm /etc/mtab root:/# ln -s /proc/mounts /etc/mtab
Or, "What do you mean, './hello: No such file or directory'?"
A compiler built using $SYSROOT will not produce a functional binary for hello world, unless we include the -static option to gcc
bob:/tmp$ mipsel-unknown-linux-uclibc-gcc hello.c -o hello bob:/tmp$ ./hello -su: ./hello: No such file or directory bob:/tmp$
What? It's right there:
bob:/tmp$ ls -l hell* -rwxrwxr-x 1 bob bob 5783 Dec 12 16:38 hello -rw-rw-r-- 1 bob bob 75 Dec 12 16:35 hello.c bob:/tmp$
But, that isn't what it means. This is a dynamic linking problem.
bob:/tmp$ file ./hello
./hello: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), not stripped
bob:/tmp$ readelf -a hello | grep lib
[Requesting program interpreter: /lib/ld-uClibc.so.0]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.0]
14: 00400840 0 FUNC GLOBAL DEFAULT UND +uClibc_main
55: 00400840 0 FUNC GLOBAL DEFAULT UND +uClibc_main
000000: Version: 1 File: libgcc_s.so.1 Cnt: 1
Note the /lib/ld-uClibc.so.0 and that only exists in our sysroot. bob:/tmp$ find / -name ld-uClibc.so.0 /opt/uclibc/sysroot/lib/ld-uClibc.so.0 /opt/uclibc_build/uclibc/lib/ld-uClibc.so.0 bob:/tmp$
However, static linking in GCC is a snap:
bob:/tmp$ mipsel-unknown-linux-uclibc-gcc -static hello.c -o hello bob:/tmp$ ./hello Hello World! bob:/tmp$
There! That did what we wanted.
And we can see that it's statically linked:bob:/tmp$ file ./hello ./hello: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, not stripped
(You can run it, too, but it's kind of boring.)
man watch watch - execute a program periodically, showing output fullscreen
watch might be a better alternative than this sort of while-true-sleep loop:while true; do sleep 5; clear; ls -ltr /opt/uclibc_build/Logs; tail /opt/uclibc_build/Logs/$(ls -tr /opt/uclibc_build/Logs | tail -n1); done
$ screen ctrl-A, :, multiuser on <CR> ctrl-A, :, addacl [login of person 2]
$ screen -ls [person 1]/
There is a suitable screen on:
9734.freesa (Multi, attached)
$ screen -r [person 1]/9734.freesa
ln -fs sgidefs.h ./include/ LD libuClibc-0.9.29.so libc/libc_so.a(libc_pthread_init.oS): In function `testandset': libc_pthread_init.c:(.text+0x0): multiple definition of `testandset' libc/libc_so.a(forward.oS):forward.c:(.text+0x0): first defined here libc/libc_so.a(libc_pthread_init.oS): In function `__compare_and_swap': libc_pthread_init.c:(.text+0x24): multiple definition of `__compare_and_swap' libc/libc_so.a(forward.oS):forward.c:(.text+0x24): first defined here make[1]: *** [lib/libc.so] Error 1 make: *** [lib/libc.so.0] Error 2
Resolved with Freesa/patches/uclibc-0.9.29-fix-pthread-mips-build-1.patch
make oldconfig starting with a perfectly functional 0.9.29 .config:AR util-linux/volume_id/lib.a LINK busybox_unstripped Trying libraries: crypt m Failed: -Wl,--start-group -lcrypt -lm -Wl,--end-group Output of: mipsel-unknown-linux-uclibc-gcc -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -Os -static -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--gc-sections -Wl,--start-group applets/built-in.o archival/lib.a archival/libunarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libunarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group -lcrypt -lm -Wl,--end-group ========== /opt/uclibc/lib/gcc/mipsel-unknown-linux-uclibc/4.3.2/../../../../mipsel-unknown-linux-uclibc/bin/ld: cannot find -lcrypt collect2: ld returned 1 exit status make: *** [busybox_unstripped] Error 1 bob:/opt/bbox/busybox-1.13.1$First looking at the host system we see:
root:/usr/lib# ldconfig -p | grep crypt
libcrypto.so.0.9.8 (libc6) => /usr/lib/libcrypto.so.0.9.8
libcrypto.so (libc6) => /usr/lib/libcrypto.so
libcrypt.so.1 (libc6, OS ABI: Linux 2.6.0) => /lib/libcrypt.so.1
libcrypt.so (libc6, OS ABI: Linux 2.6.0) => /usr/lib/libcrypt.so
root:/usr/lib# ls -l *crypt*so*
lrwxrwxrwx 1 glibc glibc 23 May 18 2008 libcrypt.so -> ../../lib/libcrypt.so.1
lrwxrwxrwx 1 openssl openssl 18 Aug 6 07:38 libcrypto.so -> libcrypto.so.0.9.8
-r-xr-xr-x 1 openssl openssl 1792211 Aug 6 07:38 libcrypto.so.0.9.8
root:/usr/lib#
root:/usr/lib# ls -l ../../lib/libcrypt.so.1
lrwxrwxrwx 1 glibc glibc 15 May 18 2008 ../../lib/libcrypt.so.1 -> libcrypt-2.7.so
root:/usr/lib# ls -l ../../lib/libcrypt-2.7.so
-rwxr-xr-x 1 glibc glibc 44072 Aug 4 19:44 ../../lib/libcrypt-2.7.so
root:/usr/lib#
$SYSROOT we see the libraries are missing:/opt/uclibc/bin:/tmp/bob/bin:/bin:/usr/bin bob:/opt/bbox/busybox-1.13.1$ find /opt -name "*crypt*so*" bob:/opt/bbox/busybox-1.13.1$
$ grep crypt * step03.txt: CLEAN libcrypt step03.txt:# Remove crypt.h since libcrypt was disabled upon request step03.txt:rm -f /opt/uclibc/sysroot/usr/include/crypt.h step05.txt:# Remove crypt.h since libcrypt was disabled upon request step05.txt:rm -f /opt/uclibc/sysroot/usr/include/crypt.h step07.txt:# Remove crypt.h since libcrypt was disabled upon request step07.txt:rm -f /opt/uclibc/sysroot/usr/include/crypt.h
.config we see# UCLIBC_HAS_CRYPT_IMPL is not set
# UCLIBC_HAS_SYSLOG is not set.
CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: ¥| 12¤ë 29 20:36:58 CST 2005 (root@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
Initializing Arena
Initializing Devices.
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.23.0
rndis0: Broadcom USB RNDIS Network Adapter (P-t-P)
CPU type 0x29006: 264MHz
Total memory: 67108864 KBytes
Total memory used by CFE: 0x80800000 - 0x8089BA00 (637440)
Initialized Data: 0x80831B70 - 0x80834250 (9952)
BSS Area: 0x80834250 - 0x80835A00 (6064)
Local Heap: 0x80835A00 - 0x80899A00 (409600)
Stack Area: 0x80899A00 - 0x8089BA00 (8192)
Text (code) segment: 0x80800000 - 0x80831B70 (203632)
Boot area (physical): 0x0089C000 - 0x008DC000
Relocation Factor: I:00000000 - D:00000000
Device eth0: hwaddr 00-17-31-2A-90-0B, ipaddr 192.168.1.1, mask 255.255.255.0
gateway not set, nameserver not set
Null Rescue Flag.
Null Rescue Flag.
10 seconds to Rescue mode...
Null Rescue Flag.
9 seconds to Rescue mode...
Null Rescue Flag.
8 seconds to Rescue mode...
Null Rescue Flag.
7 seconds to Rescue mode...
Null Rescue Flag.
6 seconds to Rescue mode...
Null Rescue Flag.
5 seconds to Rescue mode...
Null Rescue Flag.
4 seconds to Rescue mode...
Null Rescue Flag.
3 seconds to Rescue mode...
Null Rescue Flag.
2 seconds to Rescue mode...
Null Rescue Flag.
1 seconds to Rescue mode...
Null Rescue Flag.
Hello!! Enter Rescue Mode: (by Force)
Failed.: Timeout occured
Reading :: TFTP Server.
Failed.: Timeout occured
Reading :: TFTP Server.
TFTP_BLKLEN!!
Done. 1597440 bytes read
Download of 0x186000 bytes completed
Write kernel and filesystem binary to FLASH (0xbfc40000)
flash device 'flash1.trx'
Programming...
done. 1597440 bytes written
CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: ¥| 12¤ë 29 20:36:58 CST 2005 (root@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
Initializing Arena
Initializing Devices.
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.23.0
rndis0: Broadcom USB RNDIS Network Adapter (P-t-P)
CPU type 0x29006: 264MHz
Total memory: 67108864 KBytes
Total memory used by CFE: 0x80800000 - 0x8089BA00 (637440)
Initialized Data: 0x80831B70 - 0x80834250 (9952)
BSS Area: 0x80834250 - 0x80835A00 (6064)
Local Heap: 0x80835A00 - 0x80899A00 (409600)
Stack Area: 0x80899A00 - 0x8089BA00 (8192)
Text (code) segment: 0x80800000 - 0x80831B70 (203632)
Boot area (physical): 0x0089C000 - 0x008DC000
Relocation Factor: I:00000000 - D:00000000
Device eth0: hwaddr 00-17-31-2A-90-0B, ipaddr 192.168.1.1, mask 255.255.255.0
gateway not set, nameserver not set
Null Rescue Flag.
Null Restore Flag.
set pivot_wait = 0
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: .. 3788 bytes read
Entry at 0x80001000
Closing network.
Starting program at 0x80001000
[ 0.000000] Linux version 3.0.12 (random@digad) (gcc version 4.5.4 20110808 (prerelease) (Linaro GCC 4.5-2011.08) ) #1 Thu Dec 8 14:46:21 CET 2011
[ 0.000000] CPU revision is: 00029006 (Broadcom BMIPS3300)
[ 0.000000] bcm47xx: using ssb bus
[ 0.000000] ssb: chipcommon status is 0x0
[ 0.000000] ssb: Initializing MIPS core...
[ 0.000000] ssb: set_irq: core 0x0806, irq 4 => 4
[ 0.000000] ssb: set_irq: core 0x0806, irq 5 => 5
[ 0.000000] ssb: set_irq: core 0x0808, irq 6 => 2
[ 0.000000] ssb: set_irq: core 0x0804, irq 2 => 6
[ 0.000000] ssb: after irq reconfiguration
[ 0.000000] ssb: core 0x0800, irq : 2(S) 3* 4 5 6 D I
[ 0.000000] ssb: core 0x0806, irq : 2(S) 3 4* 5 6 D I
[ 0.000000] ssb: core 0x0806, irq : 2(S) 3 4 5* 6 D I
[ 0.000000] ssb: core 0x0808, irq : 2(S)* 3 4 5 6 D I
[ 0.000000] ssb: core 0x0804, irq : 2(S) 3 4 5 6* D I
[ 0.000000] ssb: core 0x0816, irq : 2(S)* 3 4 5 6 D I
[ 0.000000] ssb: core 0x0807, irq : 2(S)* 3 4 5 6 D I
[ 0.000000] ssb: core 0x080b, irq : 2(S)* 3 4 5 6 D I
[ 0.000000] ssb: core 0x080f, irq : 2(S) 3 4 5 6 D I*
[ 0.000000] found parallel flash.
[ 0.000000] ssb: Sonics Silicon Backplane found at address 0x18000000
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 04000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone PFN ranges:
[ 0.000000] Normal 0x00000000 -> 0x00004000
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[1] active PFN ranges
[ 0.000000] 0: 0x00000000 -> 0x00004000
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Primary instruction cache 16kB, VIPT, 2-way, linesize 16 bytes.
[ 0.000000] Primary data cache 16kB, 2-way, VIPT, cache aliases, linesize 16 bytes
[ 0.000000] Memory: 61364k/65536k available (2252k kernel code, 4172k reserved, 337k data, 832k init, 0k highmem)
[ 0.000000] NR_IRQS:128
[ 0.000000] console [ttyS0] enabled
[ 0.004000] Calibrating delay loop... 262.14 BogoMIPS (lpj=524288)
[ 0.048000] pid_max: default: 32768 minimum: 301
[ 0.052000] Mount-cache hash table entries: 512
[ 0.060000] NET: Registered protocol family 16
[ 0.080000] bio: create slab <bio-0> at 0
[ 0.092000] Switching to clocksource MIPS
[ 0.100000] Switched to NOHz mode on CPU #0
[ 0.108000] ssb: PCIcore in host mode found
[ 0.416000] PCI: Fixing up bridge 0000:00:00.0
[ 0.420000] PCI: Fixing up device 0000:00:00.0
[ 0.428000] PCI: Fixing latency timer of device 0000:00:00.0 to 168
[ 0.440000] pci 0000:00:02.0: BAR 6: assigned [mem 0x40000000-0x4000ffff pref]
[ 0.448000] pci 0000:00:01.0: BAR 0: assigned [mem 0x40010000-0x40011fff]
[ 0.456000] pci 0000:00:01.0: BAR 0: set to [mem 0x40010000-0x40011fff] (PCI address [0x40010000-0x40011fff])
[ 0.468000] pci 0000:00:02.0: BAR 5: assigned [mem 0x40012000-0x40012fff]
[ 0.472000] pci 0000:00:02.0: BAR 5: set to [mem 0x40012000-0x40012fff] (PCI address [0x40012000-0x40012fff])
[ 0.484000] pci 0000:00:03.2: BAR 0: assigned [mem 0x40013000-0x400130ff]
[ 0.492000] pci 0000:00:03.2: BAR 0: set to [mem 0x40013000-0x400130ff] (PCI address [0x40013000-0x400130ff])
[ 0.500000] pci 0000:00:02.0: BAR 4: assigned [io 0x0400-0x047f]
[ 0.508000] pci 0000:00:02.0: BAR 4: set to [io 0x0400-0x047f] (PCI address [0x400-0x47f])
[ 0.516000] pci 0000:00:03.0: BAR 4: assigned [io 0x0480-0x049f]
[ 0.520000] pci 0000:00:03.0: BAR 4: set to [io 0x0480-0x049f] (PCI address [0x480-0x49f])
[ 0.532000] pci 0000:00:03.1: BAR 4: assigned [io 0x04a0-0x04bf]
[ 0.536000] pci 0000:00:03.1: BAR 4: set to [io 0x04a0-0x04bf] (PCI address [0x4a0-0x4bf])
[ 0.544000] pci 0000:00:02.0: BAR 0: assigned [io 0x04c0-0x04c7]
[ 0.552000] pci 0000:00:02.0: BAR 0: set to [io 0x04c0-0x04c7] (PCI address [0x4c0-0x4c7])
[ 0.560000] pci 0000:00:02.0: BAR 2: assigned [io 0x04c8-0x04cf]
[ 0.568000] pci 0000:00:02.0: BAR 2: set to [io 0x04c8-0x04cf] (PCI address [0x4c8-0x4cf])
[ 0.576000] pci 0000:00:02.0: BAR 1: assigned [io 0x04d0-0x04d3]
[ 0.580000] pci 0000:00:02.0: BAR 1: set to [io 0x04d0-0x04d3] (PCI address [0x4d0-0x4d3])
[ 0.588000] pci 0000:00:02.0: BAR 3: assigned [io 0x04d4-0x04d7]
[ 0.596000] pci 0000:00:02.0: BAR 3: set to [io 0x04d4-0x04d7] (PCI address [0x4d4-0x4d7])
[ 0.608000] PCI: Enabling device 0000:00:01.0 (0000 -> 0002)
[ 0.616000] PCI: Fixing up device 0000:00:01.0
[ 0.660000] ssb: chipcommon status is 0x0
[ 0.664000] ssb: SPROM offset is 0x1000
[ 0.688000] ssb: Sonics Silicon Backplane found on PCI device 0000:00:01.0
[ 0.696000] NET: Registered protocol family 2
[ 0.704000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.712000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.720000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.724000] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.732000] TCP reno registered
[ 0.736000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.740000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.748000] NET: Registered protocol family 1
[ 2.972000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 2.980000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 2.992000] msgmni has been set to 119
[ 2.996000] io scheduler noop registered
[ 3.000000] io scheduler deadline registered (default)
[ 3.004000] Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
[ 3.032000] serial8250: ttyS0 at MMIO 0xb8000300 (irq = 3) is a 16550A
[ 3.060000] serial8250: ttyS1 at MMIO 0xb8000400 (irq = 3) is a 16550A
[ 3.088000] serial8250.0: ttyS0 at MMIO 0xb8000300 (irq = 3) is a 16550A
[ 3.120000] serial8250.0: ttyS1 at MMIO 0xb8000400 (irq = 3) is a 16550A
[ 3.132000] bcm47xx_pflash: flash init: 0x1c000000 0x02000000
[ 3.136000] Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x0000c2 Chip ID 0x0022c4
[ 3.148000] Amd/Fujitsu Extended Query Table at 0x0040
[ 3.156000] Amd/Fujitsu Extended Query version 1.0.
[ 3.160000] Physically mapped flash: JEDEC Device ID is 0x22C4. Assuming broken CFI table.
[ 3.168000] Physically mapped flash: Swapping erase regions for top-boot CFI table.
[ 3.176000] number of CFI chips: 1
[ 3.180000] bcm47xx_pflash: Flash device: 0x2000000 at 0x1fc00000
[ 3.188000] bcm47xx_part: bootloader size: 262144
[ 3.192000] bcm47xx_part: Looking for dual image
[ 3.196000] bcm47xx_part: TRX offset : 0
[ 3.212000] bcm47xx_part: Updating TRX offsets and length:
[ 3.216000] bcm47xx_part: old trx = [0x0000001c, 0x00000968, 0x00000000], len=0x00186000 crc32=0x3ede74b3
[ 3.228000] bcm47xx_part: new trx = [0x0000001c, 0x00000968, 0x00000000], len=0x00000968 crc32=0x7f11ff65
[ 4.468000] bcm47xx_part: Done
[ 4.468000] 4 bcm47xx partitions found on MTD device Physically mapped flash
[ 4.476000] Creating 4 MTD partitions on "Physically mapped flash":
[ 4.484000] 0x000000000000-0x000000040000 : "cfe"
[ 4.492000] 0x000000040000-0x0000001f0000 : "linux"
[ 4.504000] 0x000000040968-0x0000001f0000 : "rootfs"
[ 4.508000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 4.524000] mtd: partition "rootfs" set to be root filesystem
[ 4.532000] split_squashfs: no squashfs found in "Physically mapped flash"
[ 4.540000] 0x0000001f0000-0x000000200000 : "nvram"
[ 4.552000] bcm47xx_sflash: error registering platform driver: -19
[ 4.560000] b44: b44.c:v2.0
[ 4.564000] b44 ssb0:0: eth0: Broadcom 44xx/47xx 10/100BaseT Ethernet 00:17:31:2a:90:0b
[ 4.576000] b44 ssb0:1: eth1: PHY Reset would not complete
[ 4.580000] b44 ssb0:1: eth1: Broadcom 44xx/47xx 10/100BaseT Ethernet 40:10:18:00:00:2c
[ 4.588000] BCM47xx Watchdog Timer enabled (30 seconds, nowayout)
[ 4.596000] TCP westwood registered
[ 4.600000] NET: Registered protocol family 17
[ 4.608000] 802.1Q VLAN Support v1.8
[ 4.628000] Freeing unused kernel memory: 832k freed
[ 5.708000] diag: Detected 'ASUS WL-700gE'
[ 5.712000] diag: Spinning up HDD and enabling leds
[ 10.756000] b44 ssb0:0: eth0: Link is up at 100 Mbps, full duplex
[ 10.764000] b44 ssb0:0: eth0: Flow control is off for TX and off for RX
[ 11.900000] roboswitch: Probing device eth0: found a 5325! It's a 5350.
- preinit -
Press the [f] key and hit [enter] to enter failsafe mode
- regular preinit -
[ 19.064000] b44 ssb0:0: eth0: powering down PHY
- init -
Please press Enter to activate this console. [ 20.264000] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 20.520000] nf_conntrack version 0.5.0 (971 buckets, 3884 max)
[ 22.564000] b44 ssb0:0: eth0: Link is up at 100 Mbps, full duplex
[ 22.572000] b44 ssb0:0: eth0: Flow control is off for TX and off for RX
[ 24.036000] device eth0.0 entered promiscuous mode
[ 24.040000] device eth0 entered promiscuous mode
[ 24.112000] br-lan: port 1(eth0.0) entering forwarding state
[ 24.120000] br-lan: port 1(eth0.0) entering forwarding state
BusyBox v1.19.3 (2011-12-08 14:33:50 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
ATTITUDE ADJUSTMENT (bleeding edge, r29473) ----------
* 1/4 oz Vodka Pour all ingredients into mixing
* 1/4 oz Gin tin with ice, strain into glass.
* 1/4 oz Amaretto
* 1/4 oz Triple sec
* 1/4 oz Peach schnapps
* 1/4 oz Sour mix
* 1 splash Cranberry juice
-----------------------------------------------------
root@OpenWrt:/#
Boot of OpenWRT around SVN revision 29463 on trunk.
Built on 5 Dec 2011. A few bits of line noise on the serial console were replaced with "[NOISE]" in the log below...
CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: ¥| 12¤ë 29 20:36:58 CST 2005 (root@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
Initializing Arena
Initializing Devices.
eº0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.23.0
rndis0: Broadcom USB RNDIS Network Adapter (P-t-P)
CPU type 0x29006: 264MHz
Total memory: 67108864 KBytes
Total memory used by CFE: 0x80800000 - 0x8089BA00 (637440)
Initkalized Data: 0x80831B70 - 0x80834250 (9952)
BSS Area: 0x80834250 - 0x80835A00 (6064)
Local Heap: 0x80835A00 - 0x80899A00 (409600)
Stack Area: 0x80899A00 - 0x8089BA00 (8192)
Text (code) segment: 0x80800000 - 0x80831B70 (203632)
Boot area (physical): 0x0089C000 - 0x008DC000
Relocation Factor: I:00000000 - D:00000000
Device eth0: hwaddr 00-17-31-2A-90-0B, ipaddr 192.168.1.1, mask 255.255.255.0
gateway not set, nameserver not set
Null Rescue Flag.
Null Restore Flag.
set pivot_wait = 0
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: .. 3788 bytes read
Entry at 0x80001000
Closing network.
Starting program at 0x80001000
[ 0.000000] Linux version 3.0.9 (random@digad) (gcc version 4.5.4 20110808 (prerelease) (Lknaro GCC 4.5-2011.08) ) #1 Mon Dec 5 16:50:32 CST 2011
[ 0.000000] CPU revision is: 00029006 (Broadcom BMIPS3300)
[ 0.000000] bcm47xx: using ssb bus
[ 0.000000] ssb: chipcommon status is 0x0
[ 0.000000] ssb: Initializing MIPS core...
[ 0.000000] ssb: set_irq: core 0x0806, irq 4 => 4
[ 0.000000] ssb: set_irq: core 0x0806, irq 5 => 5
[ 0.000000] ssb: set_irq: core 0x0808, irq 6 => 2
[ 0.000000] ssb: set_irq: core 0x0804, irq 2 => 6
[ 0.000000] ssb: after irq reconfiguration
[ 0.000000] ssb: core 0x0800, irq : 2(S) 3* 4 = 6 D I
[ 0.000000] ssb: core 0x0806, irq : 2(S) 3 4* 5 6 D I
[ 0.000000] ssb: core 0x0806, irq : 2(S) 3 4 5* 6 D I
[ 0.000000] ssb: core 0x0808, irq : 2(S)* 3 4 5 6 D I
[ 0.000000] ssb: core 0x0804, irq : 2(S) 3 4 5 6* D I
[ 0.000000] ssb: core 0x0816, irq : 2(S)* 3 4 5 6 D I
[ 0.000000] ssb: core 0x0807, irq : 2(S)* 3 4 5 6 D I
[ 0.000000] ssb: core 0x080b, irq : 2(S)* 3 4 5 6 D I
[ 0.000000] ssb: core 0x080f, irq : 2(S) 3 4 5 6 D I*
[ 0.000000] found parallel flash.
[ 0.000000] ssb: Sonics Silicon Backplane found at address 0x18000000
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 04000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone PFN ranges:
[ 0.000000] Normal 0x00000000 -> 0x00004000
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[1] active PFN ranges
[ 0.000000] 0: 0x00000000 -> 0x00004000
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytms)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Primary instruction cache 16kB, VIPT, 2-way, linesize 16 bytes.
[ 0.000000] Primary data cache 16kB, 2-way, VIPT, cache aliases, linesize 16 bytes
[ 0.000000] Memory: 61236k/65536k available (2252k kernel code, 4300k reserved, 337k data, 960k init, 0k highmem)
[ 0.000000] NR_IRQS:128
[ 0.000000] console [ttyS0] enabled
[ 0.004000] Calibrating delay loop... 262.14 BogoMIPS (lpj=524288)
[ 0.048000] pid_max: default: 32768 minimum: 301
[ 0.052000] Mount-cache hash table entries: 512
[ 0.060000] NET: Registered protocol family 16
[ 0.080000] bio: create slab <bio-0> at 0
[ 0.092000] Switching to clocksource MIPS
[ 0.100000] Switched to NOHz mode on CPU #0
[ 0.108000] ssb: PCIcore in host mode found
[ 0.416000] PCI: Fixing up bridge 0000:00:00.0
[ 0.420000] PCI: Fixing up device 0000:00:00.0
[ 0.424000] PCI: Fixing latency timer of device 0000:00:00.0 to 168
[ 0.440000] pci 0000:00:02.0: BAR 6: assigned [mem 0x40000000-0x4000ffff pref]
[ 0.448000] pci 0000:00:01.0: BAR 0: assigned [mem 0x40010000-0x40011fff]
[ 0.456000] pci 0000:00:01.0: BAR 0: set to [mem 0x40010000-0x40011fff] (PCI address [0x40010000-0x40011fff])
[ 0.464000] pci 0000:00:02.0: BAR 5: assigned [mem 0x40012000-0x40012fff]
[ 0.472000] pci 0000:00:02.0: BAR 5: set to [mem 0x40012000-0x40012fff] (PCI address [0x40012000-0x40012fff])
[ 0.484000] pci 0000:00:03.2: BAR 0: assigned [mem 0x40013000-0x400130ff]
[ 0.492000] pci 0000:00:03.2: BAR 0: set to [mem 0x40013000-0x400130ff] (PCI address [0x40013000-0x400130ff])
[ 0.500000] pci 0000:00:02.0: BAR 4: assigned [io 0x0400-0x047f]
[ 0.508000] pci 0000:00:02.0: BAR 4: set to [io 0x0400-0x047f] (PCI address [0x400-0x47f])
[ 0.516000] pci 0000:00:03.0: BAR 4: assigned [io 0x0480-0x049f]
[ 0.520000] pci 0000:00:03.0: BAR 4: set to [io 0x0480-0x049f] (PCI address [0x480-0x49f])
[ 0.528000] pci 0000:00:03.1: BAR 4: assigned [io 0x04a0-0x04bf]
[ 0.536000] pci 0000:00:03.1: BAR 4: set to [io 0x04a0-0x04bf] (PCI address [0x4a0-0x4bf])
[ 0.544000] pci 0000:00:02.0: BAR 0: assigned [io 0x04c0-0x04c7ý
[ 0.552000] pci 0000:00:02.0: BAR 0: set to [io 0x04c0-0x04c7] (PCI address [0x4c0-0x4c7])
[ 0.560000] pci 0000:00:02.0: BA[NOISE][io 0x04c8-0x04cf]
[ 0.568000] pci 0000:00:02.0: BAR 2: set to [io 0x04c8-0x04cf] (PCI address [0x4c8-0x4cf])
[ 0.576000] pci 0000:00:02.0: BAR 1: assigned [io 0x04d0-0x04d3]
[ 0.580000] pci 0000:00:02.0: BAR 1: set to [io 0x04d0-0x04d3] (PCI address [0x4d0-0x4d3])
[ 0.588000Ý pci 0000:00:02.0: BAR 3: assigned [io 0x04d4-0x04d7]
[ 0.596000] pci 0000:00:02.0: BAR 3: set to [io 0x04d4-0x04d7] (PCI address [0x4d4-0x4d7])
[ 0.608000] PCI: Enablkng device 0000:00:01.0 (0000 -> 0002)
[ 0.616000] PCI: Fixing up device 0000:00:01.0
[ 0.660000] ssb: chipcommon status is 0x0
[ 0.664000] ssb: SPROM offset is 0x1000
[ 0.688000] ssb: Sonics Silicon Backplane found on PCI devicm 0000:00:01.0
[ 0.696000] NET: Registered protocol family 2
[ 0.704000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.712000] tCP established hash table entries: 2048 (order: 2, 16384 bytes)
[ 0.720000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.724000] TCP: Hash tables configured (established 2048 bind 2048)
[ 0.732000] TCP reno registered
[ 0.736000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.740000] UDPmLite hcsh table entries: 256 (order: 0, 4096 bytes)
[ 0.748000] NET: Registered protocol famkly 1
[ 3.392000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 3.396000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 3.408000] msgmni has been set to 119
[ 3.412000] io scheduler noop registered
[ 3.416000] io scheduler deadline registered (default)
[ 3.424000] Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
[ 3.452000] serial8250: ttyS0 at MMIO 0xb8000300 (irq = 3) is a 16550A
[ 3.480000] serial8250: ttyS1 at MMIO 0xb8000400 (irq = 3) is a 16550A
[ 3.508000] serial8250.0: ttyS0 at MMIO 0xb8000300 (irq = 3) is a 16550A
[ 3.536000] serial8250.0: ttyS1 at MMIO 0xb8000400 (irq = 3) is a 16550A
[ 3.548000] bcm47xx_pflash: flash init: 0x1c000000 0x02000000
[ 3.556000] Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank. Man}facturer ID 0x0000c2 Chip ID 0x0022c4
[ 3.568000] Amd/Fujitsu Extended Query Table at 0x0040
[ 3.572000] Amd/Fujitsu Extended Query version 1.0.
[ 3.576000] Physically mapped flash: JEDEC Devkce ID is 0x22C4. Assuming broken CFI table.
[ 3.588000] Physically mapped flash: Swapping erase regions for top-boot CFI table.
[ 3.596000] number of CFI chips: 1
[ 3.596000] bcm47xx_pflash: Flash device: 0x2000000 at 0x1fc00000
[ 3.604000] bcm47xx_part: bootloader size: 262144
[ 3.608000] bcm47xx_part: Looking for dual image
[ 3.616000] bcm47xx_part: TRX offset : 0
[ 3.620000] 4 bcm47xx partitions found on MTD device Physically mapped flash
[ 3.624000] Creating 4 MTD partitions on "Physically mapped flash":
[ 3.632000] 0x000000000000-0x000000040000 : "cfe"
[ 3.640000] 0x000000040000-0x0000001f0000 : "linux"
[ 3.652000] 0x000000040968-0x0000001f0000 : "rootfs"
[ 3.656000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 3.676000] mtd: partition "rootfs" set to be root filesystem
[ 3.680000] split_squashfs: no squashfs found in "Physically mapped flash"
[ 3.688000] 0x0000001f0000-0x000000200000 : "nvram"
[ 3.700000] bcm47xx_sflash: error registering platform driver: -19
[ 3.708000] b44: b44.c:v2.0
[ 3.712000] b44 ssb0:0: eth0: Broadcom 44xx/47xx 10/100BaseT Ethernet 00:17:31:2a:90:0b
[ 3.724000] b44 ssb0:1: eth1: PHY Reset would not complete
[ 3.728000] b44 ssb0:1: eth1: Broadcom 44xx/47xx 10/100BaseT Ethernet 40:10:18:00:00:2c
[ 3.740000] BCM47xx Watchdog Timer enabled (30 seconds, nowayout)
[ 3.748000] TCP westwood registered
[ 3.752000] NET: Rggistgred protocol family 17
[ 3.756000] 802.1Q VLAN Support v1.8
[ 3.776000] Freeing unused kernel memory: 960k freed
[ 4.864000] diag: Detected 'ASUS WL-700gE'
[ 4.868000] diag: [NOISE]eds
[ 9.912000] b44 ssb0:0: eth0: Link is up at 100 Mbps, full duplex
[ 9.916000] b44 ssb0:0: eth0: Flow control is off for TX and off for RX
[ 11.060000] roboswitch: Probing dgvice eth0: found a 5325! It's a 5350.
- preinit -
Press the [f] key and hit [enter] to enter failsafe mode
- regular preinit -
[ 18.208000] b44 ssb0:0: eth0: powering down PHY
- init -
Please press Enter to activate this console. [ 19.416000] PPP generic driver version 2.4.2
[ 19.528000] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 19.784000] NET: Registered protocol family 24
[ 19.852000] nf_conntrack version 0.5.0 (971 buckets, 3884 max)
[ 21.944000] b44 ssb0:0: eth0: Link is up at0100 Mbps, full duplex
[ 21.952000] b44 ssb0:0: eth0: Flow control is off for TX and off for RX
[ 23.412000] device eth0.0 entered promiscuous mode
[ 23.416000] device eth0 entered promiscuous mode
[ 23.500000] br-lan: port 1(eth0.0) entering forwarding state
[ 23.504000] br-lan: port 1(eth0.0) entering forwarding state
BusyBox v1.19.3 (2011-12-05 16:34:31 CST) built-in shell (ash)
Enter 'holp' for a list of built-in commands.
_______ _______
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
ATTITUDE ADZUSTMENT (bleeding edge, r29434) ----------
* 1/4 oz Vodka Pour all ingredients into mixing
* 1/4 oz Gin tin with ice, strain into glass.
* 1/4 oz Amaretto
* 1/4 oz Triple sec
* 3o4 oz Peach schnapps
* 1/4 oz Sour mix
* 1 splash Cranberry juice
-----------------------------------------------------
Minicom2.2root@OpenWrt:/#
Status: resolved
When building OpenWRT with the brcm47xx-2.4 kernel, and the WL-700G target profile, it builds that module by default: kmod-ide-aec62xx_2.4.34-brcm-1_mipsel.ipk
Brett discovered that when building OpenWRT with the brcm47xx-2.6 kernel target, it refuses to build the aec62xx module at all.
To work around this, ./build_dir/linux-2.6-brcm47xx/linux-2.6.22.1/.config needs to be adjusted. See: AccessingTheHardDisk.
Building OpenWRT as a foundation for FreeSA work
What we need from the OpenWRT project at the moment is just a toolchain and kernel. As described elsewhere on the wiki, we can then use the kernel by NetworkBooting rather than something like ReflashingWithTftp.
Here's how to do it.
To work around a build error,
eric@xyzzy:~/freesa/openwrt-trunk/build_mipsel/linux$ ARCH=mips make
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CHK include/linux/compile.h
MODPOST vmlinux
Building modules, stage 2.
MODPOST 283 modules
WARNING: "local_flush_data_cache_page" [drivers/ide/ide-core.ko] undefined!
maker1: *** [+modpost] Error 1
make: *** [modules] Error 2
eric@xyzzy:~/freesa/openwrt-trunk/build_mipsel/linux
EXPORT_SYMBOL(local_flush_data_cache_page);
more later
TODO - modify these instructions such that they pertain more directly to NetworkBooting:Is there a way to do the "flashless" loading of a squashfs? Maybe .... We could try the following:
Will this work? Not sure, here's the thing ... mtdblock5 is created by the Asus kernel. It might not be set up in the OpenWRT kernel. We need to build switch figure a way to make a RAM region visible as a mtd device so that the kernel can find it.
'''Also, it ''might'' be possible to build switch use initramfs instead, in which case the kernel file includes everything for us.'''
make -C switch compile
maker3: Entering directory @/home/random/src/openwrt-7196/package/switch'
mkdir -p /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch
cp -fpR ./src/* /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/
touch /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/.prepared_76ed7876d303097cdb8d3f5b26b8a960
(cd /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/./; if [ -x ./configure ]; then AR=mipsel-linux-uclibc-ar AS="mipsel-linux-uclibc-gcc -c -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time" LD=mipsel-linux-uclibc-ld NM=mipsel-linux-uclibc-nm CC="mipsel-linux-uclibc-gcc" GCC="mipsel-linux-uclibc-gcc" CXX=mipsel-linux-uclibc-g++ RANLIB=mipsel-linux-uclibc-ranlib STRIP=mipsel-linux-uclibc-strip OBJCOPY=mipsel-linux-uclibc-objcopy OBJDUMP=mipsel-linux-uclibc-objdump CFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -I/home/random/src/openwrt-7196/staging_dir_mipsel/usr/include -I/home/random/src/openwrt-7196/staging_dir_mipsel/include" CXXFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -I/home/random/src/openwrt-7196/staging_dir_mipsel/usr/include -I/home/random/src/openwrt-7196/staging_dir_mipsel/include" CPPFLAGS="-I/home/random/src/openwrt-7196/staging_dir_mipsel/usr/include -I/home/random/src/openwrt-7196/staging_dir_mipsel/include -I/home/random/src/openwrt-7196/staging_dir_mipsel/usr/include -I/home/random/src/openwrt-7196/staging_dir_mipsel/include" LDFLAGS="-L/home/random/src/openwrt-7196/staging_dir_mipsel/usr/lib -L/home/random/src/openwrt-7196/staging_dir_mipsel/lib" PKG_CONFIG_PATH="/home/random/src/openwrt-7196/staging_dir_mipsel/usr/lib/pkgconfig" PKG_CONFIG_LIBDIR="/home/random/src/openwrt-7196/staging_dir_mipsel/usr/lib/pkgconfig" ./configure --target=mipsel-linux --host=mipsel-linux --build=i686-pc-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls ; fi; )
touch /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/.configured
make -C "/home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/linux-2.6.19.2" CROSS_COMPILE="mipsel-linux-uclibc-" ARCH="mips" SUBDIRS="/home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch" EXTRA_CFLAGS="-DBROADCOM" modules
maker4: Entering directory @/home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/linux-2.6.19.2'
CC [M] /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-core.o
CC [M] /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-adm.o
CC [M] /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-robo.o
Building modules, stage 2.
MODPOST 3 modules
CC /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-adm.mod.o
LD [M] /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-adm.ko
CC /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-core.mod.o
LD [M] /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-core.ko
CC /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-robo.mod.o
LD [M] /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-robo.ko
maker4: Leaving directory @/home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/linux-2.6.19.2'
maker4: Entering directory @/home/random/src/openwrt-7196/package/switch'
maker4: Leaving directory @/home/random/src/openwrt-7196/package/switch'
touch /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/.built
mkdir -p /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL
echo "Package: kmod-switch" > /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/control
echo "Version: 2.6.19.2-brcm47xx-1" >> /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/control
( DEPENDS='kernel (=2.6.19.2-brcm47xx-1)'; for depend in ; do DEPENDS=${DEPENDS:+$DEPENDS, }${depend##+}; done; echo "Depends: $DEPENDS"; echo "Source: package/switch"; echo "Section: kernel"; echo "Priority: optional"; echo "Maintainer: OpenWrt Developers Team <openwrt-devel@openwrt.org>"; echo "Architecture: mipsel"; echo -n "Description: "; getvar V_Package_kmod_switch_description | sed -e 's,^:space:*, ,g'; ) >> /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/control
chmod 644 /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/control
(cd /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL; var2file "V_Package_kmod_switch_conffiles" conffiles; var2file "V_Package_kmod_switch_preinst" preinst; var2file "V_Package_kmod_switch_postinst" postinst; var2file "V_Package_kmod_switch_prerm" prerm; var2file "V_Package_kmod_switch_postrm" postrm; )
mkdir -p /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/lib/modules/2.6.19.2
cp -fpR -L /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-core.ko /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-adm.ko /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/switch-robo.ko /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/lib/modules/2.6.19.2/
export modules=; add_module() { mkdir -p /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/etc/modules.d; ( for mod in $2; do getvar mod; done ) > /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/etc/modules.d/$1-switch; modules="${modules:+$modules }$1-switch"; }; add_module 20 "switch-core switch-robo switch-adm"; if [ -n "$modules" ]; then mkdir -p /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/etc/modules.d; echo "#!/bin/sh" > /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/postinst; echo "[ -z \"\$IPKG_INSTROOT\" ] || exit 0" >> /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/postinst; echo ". /etc/functions.sh" >> /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/postinst; echo "load_modules $modules" >> /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/postinst; chmod 0755 /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/CONTROL/postinst; fi
install -d -m0755 /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/lib/network/
install -m0755 ./files/switch.sh /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/lib/network/
mkdir -p /home/random/src/openwrt-7196/bin/packages
find /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch -name CVS | xargs -r rm -rf
find /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch -name .svn | xargs -r rm -rf
find /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch -name '.#*' | xargs -r rm -f
NM="mipsel-linux-uclibc-nm" STRIP="/home/random/src/openwrt-7196/staging_dir_mipsel/bin/sstrip" STRIP_KMOD="mipsel-linux-uclibc-strip --strip-unneeded --remove-section=.comment" /home/random/src/openwrt-7196/scripts/rstrip.sh /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch
rstrip.sh: /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/lib/modules/2.6.19.2/switch-adm.ko:relocatable
rstrip.sh: /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/lib/modules/2.6.19.2/switch-core.ko:relocatable
rstrip.sh: /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch/lib/modules/2.6.19.2/switch-robo.ko:relocatable
ipkg-build -c -o 0 -g 0 /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch /home/random/src/openwrt-7196/bin/packages
Packaged contents of /home/random/src/openwrt-7196/build_mipsel/linux-2.6-brcm47xx/kmod-switch/ipkg/kmod-switch into /home/random/src/openwrt-7196/bin/packages/kmod-switch_2.6.19.2-brcm47xx-1_mipsel.ipk
maker3: Leaving directory @/home/random/src/openwrt-7196/package/switch'
Accessing The Hard Disk after ""if you are going to boot"":http://freesa.org/mips/boot/introduction.html section of CLFS'
To get the freesa disk accessible, have the kernel sources from when you built the kernel. If you don't have them, you need to rebuild the kernel.
Then you need to build the "kernel module "diag"":http://www.tiedyedfreaks.org/eric/diag.tar.bz2 which is from OpenWRT. You have to build it with the SAME COMPILER that the kernel itself was built with. The build will need to know where to find the kernel sources, and by default it will look at /lib/modules/${uname -r}/source, which will of course not work.
#!/bin/bash
make ARCH=mips \
CROSS_COMPILE=${CLFS_TARGET}- \
KERNELDIR=/path/to/mips-clfs/build/linux-2.6.23-owrt9339 &&
echo YAY || echo DARN
Next insmod's diag.ko ... wait five seconds (the 5 second wait inside diag isn't long enough for the disk to spin up) ... then follow the instructions in AccessingTheHardDisk: insmod the other IDE modules with a two-second wait between them. At the end of the insmodding, the disk should materialize, at which point you can partition and create swap and so on.
(Random has a script for the insmodding and waiting.)
How To Chroot
One thing one might consider: suppose you have the disk accessible in an NFS-root-mounted freesa box. Well, at that point you can create partitions and unpack the CLFS-to-date onto the actual disk, and then you can jump tracks to the "if you are going to chroot" scheme -- chrooting from the NFS-mounted partial-CLFS environment to an internal-disk partial-CLFS environment. Then complete the build using the local disk, which is apt to be much faster than the NFS environment.
The other advantage being, IF you have a tarball lying around from the "if you are going to boot/chroot" decision point, you can do the "if you are going to chroot" scheme from the get-go, and not have to worry about all of the files contaminating the final directory structure
CLFS Issues and package users conflicts
glibc/usr/include/scsi needs to be an install dir/usr/include/scsi/sg.h is already installed by linux-headers; mv linux-headers version out of the way/usr/include/scsi/scsi.h is already installed by linux-headers; mv linux-headers version out of the way/usr/include/scsi/scsi_ioctl.h is already installed by linux-headers; mv linux-headers version out of the way
root:/# expect -c "spawn ls"
spawn ls
The system has no more ptys. Ask your system administrator to create more.
while executing
"spawn ls"
* had to mkdir /dev/pts then mount devpts
* had change the top-level Makefile's definition of MAKEINFO to deal with some problem with the missing command#MAKEINFO = /usr/src/binutils/binutils-2.18/missing makeinfo MAKEINFO = makeinfo
Common Firmware Environment (CFE) is a firmware developed by Broadcom for their embedded devices. One version of CFE is present in the WL-700gE. It is the primary boot loader for the device, and occupies the first 256kb of the flash chip.
The CFE console is accessible if you hack the device to have a serial port.
From the CFE prompt, you can:
We use the CFE for NetworkBooting and not much else. (We are especially hesitant about using the CFE to write to the flash device, since we might overwrite the first 256kb and thereby clobber CFE itself.)
You can use the CFE to flash a new TRX image without a serial console, simply by holding down the orange EZ-Setup button while powering on the device for about ten seconds. At that point CFE goes into "rescue mode"; it starts a TFTP server (on what default IP address?) and waits for a TRX image to be sent over the network.
The WL-700gE is built around the Broadcom BCM4780 NASoC (Network Appliance System on a Chip).
See Also: http://www.openmss.org/
The bootloader used by WL-700gE is CFE, version 1.0.37.
The current version of CFE from broadcom's web site is 1.4.2. (last checked 2008 Dec 13) Replacing the CFE is probably beyond the scope of anything we want to try, since there is no JTAG interface that would let us unbrick a unit that has a borked CFE ... maybe someone can help with this.
The CFE is the program that allows new firmware to be uploaded to the device via TFTP.
CFE supports NetworkBooting (that is, obtain the kernel and root filesystem image over the network rather than from flash) if given the appropriate commands from a serial console at startup time.
CFE lives in the first 256kb of internal flash.
Information on CFE is currently available directly from Broadcom, in case you want to look at the documentation or source code for it.
Current versions of CFE are available under a BSD-style (free software, non-copyleft) license; but the version of CFE that is on the 700gE is proprietary. It sure is too bad that CFE isn't under GPL; if it were, then the Asus GPL source tarball would include the source for the version they use. Oh well.
There are two paths we can use to construct a kernel and trx file.
Path one: Do the openwrt build. This creates a trx program (used to create the final trx image), lzma loader (boot loader that decompresses an lzma-compressed kernel), and linux kernel with initramfs root filesystem.
Path two: Do the build ourselves, using the same sources and build process for trx, lzma-loader, and kernel. The difference is that we're using a slightly different set of configuration options for the kernel, and we're using different root filesystem contents.
In either case, the linux kernel can be booted by activating the serial console and network-booting the device (by telling CFE to download the kernel file using tftp). This works whether it's our own kernel or the openwrt kernel.
When we lzma-compress the openwrt kernel and build a trx using the lzma-loader and compressed kernel, the result is a trx file that can be installed using the rescue mode and works fine.
When we lzma-compress our kernel and build a trx using the same lzma-loader (but our compressed kernel), the result is a trx file that doesn't work.
...Huh.
When we use the OpenWRT kernel with our root filesystem, it boots (although since our rootfs requires FPU emulation and the OpenWRT kernel doesn't provide it, it doesn't actually work properly).
Things to try:
It turns out that there's a single kernel configuration setting that was shooting us in the foot, but Brett has temporarily forgotten what it was. Maybe Eric remembers. (Was it something about compressing the initramfs image, maybe?)
Eric and Brett worked on FreeSA in December of 2011 (technically, as this is typed, it should be "are working on"). The current status as of 7 December is:
Here is the Boot Log ... and the .config file used for it is attached to that page.
This was built with an initramfs root filesystem. Since that's now working, and it's a far preferable option to using squashfs, the next step is to reverse-engineer the OpenWRT build process to determine how exactly it constructs the trx image. Then we'll reproduce that process using our own (minimal) filesystem and a kernel configuration tuned to our preferences. Maybe it will work!
...But it doesn't. Here's a description of the situation.
Eric and Brett worked extensively on FreeSA in January of 2010, when he was in the USA waiting for a Dell laptop to arrive. The Dell laptop turned out to be named Godot.
We made a lot of progress but neglected to write much of it down (Brett was planning to finish the work the next day, but got lazy). Here's the situation.
We have the OpenWRT kernel configuration. We need to use it as a starting point, rather than using our from-scratch configuration.
Brett's working files (toolchain and what-not) are in ~/freesa on digad.
Eric continues to struggle with the SecondStageBootLoader.
Since the Asus WL-700gE has been discontinued, we are investigating new hardware. At present the Ubiquiti Networks RouterStation Pro seems to be the current best option.
The freesa git project uses litbuild to construct cross-toolchains. (Eventually we plan for it to use litbuild to construct an entire freesa system.) The goal is for the litbuild package files in git to be usable for constructing cross-toolchains with a variety of hardware architectures and C libraries. As of 2012-01-22, the following builds have been tested with the latest binutils (2.22), linux kernel headers (3.2.1), and gcc (4.6.2):
(Our goal is for these builds to permit cross-toolchains on 32-bit Intel (x86) and 64-bit Intel (x86_64) hosts, to x86, x86_64, and MIPS targets.)
If you're having trouble building a cross-toolchain on Ubuntu, look to see whether you're using gawk; mawk doesn't work for the purpose.
You can still find units on eBay, but there's no evidence that the WL-700gE is still in production.
Will Asus replace the WL-700gE with a newer, bigger, better unit? With luck the answer will be "yes" ....but as of this writing, many months after the WL-700gE was discontinued, it seems unlikely.
Regardless, we have learned a lot so far about how to that will translate to other hardware moving forward. Sure there will different challenges than the ones we face with the WL-700gE (e.g. wireless and hard disk) on a different device, but certainly the approach is something much more clear to us now.
The idea of starting FreeSA with new hardware is not a thrilling one. None the less, the approach is clearly sound:There is a lot going on in the small and embedded space. It's disappointing that most of this activity is in the x86-compatible world; ideally we'd like to see a non-x86 platform. Non-x86 means that binaries targeted to run on our desktops will not run on our server appliance, and more importantly, exploits targeting x86 systems will not be able to run on our server appliance. Unfortunately the trend towards an x86 monoculture seems to leaking into the embedded space.
Very few generic embedded boards are likely to have everything. However, many have "miniPCI" and "PC/104" expansion bus options. Perhaps we can start with a device that meets some of our criteria and add the missing one(s) through an expansion board.
Non-critical Features, Preferences, and Wish List:Platforms like Beagle Board have schematics available and can be sourced from a variety of suppliers.
Putting all the features together to make a list like what FreeSA is looking for is a challenge.
The RB433UAH has three miniPCI slots and three Ethernet ports plus USB for about $165 so it seems like it should be possible to add a wireless card for about $20, and an IDE/SATA card for under $50.
RB433UAHThe RB435G has five miniPCI slots, 256MB RAM.
The RB600A for $195 and RB800 for $365 clock in at higher CPU speeds, more RAM, and have gigabit ethernet. Interestingly, they each lack USB, yet they also have 4 miniPCI so we'd fill one miniPCI with a USB module
The Asus RT-N16 lacks a hard disk so it's more like the WL-500 than the WL-700gE
The AirLive WMU-6500FS is one of the closest to the WL-700gE we've seen specs for, will be 125 Euro if it's ever actually available. It may have been end-of-lifed already?
The AirLive WMU-6000FS is the smaller form-factor version, and can be purchased for about 100 Euro including tax.
The lack of two wired ethernet ports means that we'd have to use a USB ethernet dongle. ...or something similar.
http://linuxdevices.com/articles/AT7437674277.html
Looks like it could be a very nice device, sadly it looks like http://www.linkgearlinux.com/ is down, so it might be vaporware.
may be EndOfLife already.
The board is reasonably priced at about 90 USD.
Specs are here, which also shows pinouts. There's also a software setup guide that has a section for installing new firmware images and some other stuff.
We would have to add wifi (which can run up to 200 USD including pigtails and antennae -- of course, cheaper wireless cards exist, but we need to ensure good kernel support) and a disk controller .... which adds another 60 USD or so, plus the hard disk itself which is probably another 50 USD.
There's a freebsd page about this hardware, which says that it uses RedBoot as the boot loader. The factory default runs OpenWRT standard, so even if RedBoot couldn't boot from disk, we could still use the flash as SecondStageBootLoader. In addition to a rescue system, of course. With 16MB of Flash, there's plenty of room to build a very sophisticated SSBL.
We would also have to work out an enclosure which would hold the board and the disk. The enclosure from netgate (about 50 USD) looks promising, and there might be enough space to mount a disk as well. Unlike the WL-700gE, an external AC-DC converter (about 25 USD) will be required.
Thus, the biggest downside is price after adding all the required components. In very rough numbers, the first development boxes could run well over 400 USD:
By going cheap on the Wifi, the cost could come down to as little as 300 USD, but it's unlikely to get as low as the 250 USD price-point of the WL-700gE. However, by also going with an SD card instead of a hard disk, it might be possible to get under the 250 USD price point. So, there will be a somewhat budget-conscious option, but even then, it's still pretty pricey.
may be EndOfLife already.
This guy looks nearly perfect, but is way out of budget. The older (end of life) version was smaller and reasonably priced, but for the new "Data Tank" model, the 1TB version is $575 and the 2TB version is $759. Ouch.
http://www.linuxjournal.com/article/10052
The alix3d2 may be a good choice for x86 solutions, too.
And pricing seems not so bad:
Qty Description Price Total HTS code Origin Weight
1 ALIX.2D3 system board USD 121.00 USD 121.00 8471.5000 TW 210g
1 Enclosure 3 LAN, alu, USB USD 9.00 USD 9.00 8517.7000 CN 215g
1 Antenna reverse SMA dual band USD 2.75 USD 2.75 8517.7000 TW 28g
1 Cable I-PEX -> N female 6 GHz USD 3.80 USD 3.80 8517.7000 TW 38g
1 Wistron DCMA81 miniPCI card USD 24.00 USD 24.00 8517.7000 TW 8g
Shipping + handling USD 34.40
Total USD 194.95 499g
Initially, unanswered questions are:
PCEngines has a number of distributors
The DIR-685 seems to be a possibility, it has a bay on the left side to host a 2.5-inch SATA hard drive, and is selling for $208.89 - $254.99. However it is not even listed in OpenWRT's Hardware so who knows if it is even a linux box.
Free Server Appliance: a small, headless device configured as a general-purpose computer.
The WL-700gE is built around the BCM4704 MIPS-32 CPU.
It contains the following PCI devices:
It has...
There are drivers for many of these devices in the "Asus "GPL tarball. Some of the devices, like the DS1337 RTC and wireless network hardware, have only binary drivers.
Current Work In Progress: SecondStageBootLoader
This is just an ad hoc off-the-cuff description of how we currently see the work of FreeSA being broken down. See also: FreeSA Notes.
The Flash will contain a SecondStageBootLoader: a minimal system containing a linux kernel and a minimal root filesystem. The init script will use pivot-root to "pole vault" into the root filesystem on the hard disk.
The hard drive filesystem will contain essentially a full CLFS build, except for the kernel image itself (which will only be in the firmware, unless we ever see kexec for mips actually working). The cross-toolchain will be exactly as described in CLFS (glibc-based), except for the kernel headers which will use the headers from the patched OpenWRT kernel.
All possible kernel modules will be built and will reside on the internal disk filesystem; that way, we will only need to worry about installing a new flash image when we switch to a new kernel version.
The real root filesystem will be built using a normal glibc-based toolchain.
What we will build external to the WL-700gE is just the first part of the CLFS system; then we'll netboot the device (TFTP kernel, NFS root filesystem) and do the rest of the build on the freesa box itself using the serial console.
The goal is to establish that we have the tools to develop FreeSA. done
The goal is to have a running WL-700gE with a current kernel that can access the internal hard disk. done
asus-debian:/proc# find . -iname "*gp*io*" asus-debian:/proc# asus-debian:/sys# find . -iname "*gp*io*" asus-debian:/sys#
root:~# find /proc -iname "*gp*io*" /proc/diag/gpiomask /proc/irq/3/gpio root:~#
If we make it to this point, then we fundamentally have the capability to
bootstrap a system.
The goal is to verify that all critical hardware is supportable with a current kernel. (in progress)
Using the network-booted stuff, verify that the following hardware components all work:
root:~# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436
txqueuelen:0
eth0 Link encap:Ethernet HWaddr 00:17:31:2A:90:0B
inet addr:192.168.23.3 Bcast:192.168.23.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500
txqueuelen:1000
root:~#
The only thing that is IMPORTANT and liable to be difficult is the wireless. (Other critical components are obviously supported if we get here: IDE, GPIO...) However, it looks like this is detected with latest OpenWRT build, so that is very good news.
The goal is to have a FreeSA kernel image that has a root filesystem mounted from the internal HD. (done)
Try using initramfs with the stage1 kernel and so on, using early userspace to power-on the HD, load modules, etc., to access the hard drive and then do a pivot-root to make the HD the root fs.
Probably it would be a good idea as well to make the boot process smart enough to see whether there is a valid HD root filesystem, and IF NOT then switch to NFS-mounting a root filesystem? Or for this initial version do we want to recommend people not program this kernel into the flash until they have their HD rebuilt?
If initramfs does not work -- then switch to using squashfs, and build a TRX image that does the IDE init and pivot-root magic. Of course that means we need to know how to build a TRX image. "Shouldn't be a problem."
the goal is to have a CLFS distribution resident on the hard disk and bootable by the SecondStageBootLoader's kernel and/or initial rootfs. (done)
the goal is a SecondStageBootLoader which can pivot root to root filesystem on the hard disk (in progress)
Declare victory!
the goal is to complete the FreeSA distribution
These are optional but would be awfully nice.
There isn't one. To log into this redmine instance, just access this site using HTTPS, and have an SSL client certificate signed by Brett Neumeier's certification authority registered with your web browser. If you don't have such a client certificate, and want one, send a certificate signing request to brett@freesa.org. If you don't know what any of that means, or how to do it, help is available.
The CA certificate is attached to the front page -- if you register it with your browser as a trusted CA certificate, you won't get any irritating messages about how this site might not be legitimate. If you're nervous about trusting a CA certificate that didn't come with your browser, consider whether you really have any reason to trust the certificates that came with your browser. Do you know who ABA.ECOM, INC is? How about TDC, or TDC Internet?
The FreeSA-iSCSI appliance will be based upon different hardware. We've priced hardware and it is feasible to obtain commodity hardware to provide a solution for about $4000 or so. (10% of the current list prices of some commercial iSCSI units.)
Thus using commodity hardware, we can create a FreeSA distro similar to FreeSA for WL-700gE, only customized for iSCSI. We have no plans to put further work into this project until after we have shipped FreeSA for the WL-700gE.
See Also: FreeNAS
There are a bunch of different Linux kernel options for MIPS computers. This page has links to the various possibilities.
It seems as though the OpenWRT kernel is by far the most viable choice. Once we determine the minimal patch-set necessary for FreeSA, we'll start trying to keep it up-to-date against new kernel versions ourselves.
In Linux 2.4, the kernel entry point is init_arch in arch/mips/kernel/setup.c. The call stack that is currently most interesting is:
init_arch -> start_kernel -> setup_arch -> brcm_setup
brcm_setup is where GPIO stuff is done.
In Linux 2.6, the kernel entry point is start_kernel in init/main.c. Not sure what the corresponding position is to brcm_setup. There is still a setup_arch, called from start_kernel, but it doesn't call a machine-specific startup function as far as I can tell. Maybe it can if we want it to?
The LinuxBIOS project started from a paper presented at Usenix 2000 titled "LOBOS: Linux Os Boots OS." (PDF attached here.)
Their basic idea is to have a Linux kernel that automatically, at boot time, reads in a new kernel from some other source and then boots it, without even launching userspace.
What we would like is to have a tiny userspace that allows incoming telnet connections and provides a basic shell that allows the kernel and root filesystem locations and types to be specified, and then loads the kernel and starts it up. (I believe that is what the Netwinder Nettrom does.) That's exactly what the kexec system call does; so the question is: is kexec supported on MIPS? And will the userspace kexec tools work on the WL-700gE?
While we have not answered these questions, it seems that kexec-tools may have MIPS support merged into baseline. It is not totally clear to us whether kexec will be supported on brcm4780. And if kernel configuration provides such an option, that doesn't necessarily mean it will really work ....
Our understanding is that kexec is the system call. kexec-tools provides the userspace tool that sets things up so that the system call can be used, and then invokes it. We need to learn a lot more about this stuff. In the meantime, we will skip the entire Linux bootloader scheme, and just burn the real runtime kernel into flash so that CFE can boot it directly.
This page describes how you can boot your WL-700gE without using any internal storage resources except for the CFE boot loader. In other words, neither the flash device nor the hard drive are used to obtain the runtime operating system kernel or filesystem. You need to have a serial console working in order to do this.
This process is partly described in the document BCM4780P_Resource_Guide.doc, which is in the Asus "GPL" "source" bundle. The resource guide describes how to boot the device using a linux kernel image that is downloaded via TFTP from the CFE prompt, and/or using a root filesystem also downloaded via TFTP from the CFE prompt. The way that the TFTP rootfs works is, there is special code in the Broadcom Linux kernel that checks for an NVRAM setting of rootfs_in_ram=yes and then creates a virtual MTD device backed by a particular section of RAM. We don't really want to have to port that (fairly special-purpose) code to the current OpenWRT kernel, so instead we are pursuing the option of using a root NFS filesystem, as described in the Linux kernel document nfsroot.txt.
In order to netboot a WL-700gE, you will need to do some setup on your development machine (specifically: set up TFTP and NFS server software, build a linux kernel and make it TFTP-accessible, and set up a mipsel root filesystem and make it NFS-accessible). There's essentially no setup necessary for the WL-700gE, except for getting access to it over the serial console. (That's the whole point.)
Configure the kernel (using ARCH=mips make menuconfig)
root=/dev/nfs nfsroot=192.168.236.9:/home/clfs ip=dhcp noinitrd console=ttyS0,115200
Of course, you need to provide the real IP address and path to the NFS export.
(See BuildingOpenWrt for more details on how to build a kernel and SettingUpNfsServer for how to create the root filesystem)
After doing an "ARCH=mips make" you will find that there's a file called "vmlinux" in the top of the linux source directory structure. This kernel image can't actually be booted, for reasons that I do not understand. Looking at the OpenWRT build process, I find that this file is copied elsewhere with objcopy, so we'll do the same thing. Perhaps someday a friendly kernel hacker will explain why this is needed...
mipsel-linux-uclibc-objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S vmlinux vmlinux-fixed
Note that we are using the uncompressed kernel image vmlinux rather than a compressed image. The CFE will only boot a compressed kernel image if it is a traditional vmlinuz compressed image; openwrt produces an LZMA-compressed kernel image vmlinux.lzma, which I cannot get to boot using CFE. The boot command given below can boot an uncompressed kernel image of up to 8mb in size, which is plenty for me. (Keep in mind that this kernel only needs to be complete enough to mount the real root filesystem on the hard drive.)
You can use a compressed linux kernel instead just by running gzip on the vmlinux file. If you do that, then add "-z" to the CFE boot command.
run as root: in.tftpd -l -s -B 1400 /home/clfs/boot (using whatever your tftp directory is, if it's not "/home/clfs/boot".)
If you don't have in.tftpd, I suggest installing tftp-hpa Brett uses version 0.42, Eric uses version version 0.48. A tftpd comes with inetutils, which might be worth trying.
Look at SettingUpNfsServer if you need to know how to set up the NFS software on your server machine.
Boot to the CFE console. In short, this means hold down the orange "EZ-Setup" button on the back of the router while powering on the device; then wait until you are in rescue mode, and then hit control-C to abort the TFTP server.
The default IP address for the freesa box will be 192.168.1.1, unless there is an NVRAM setting that changes it. The CFE "ifconfig" command will initialize the network interface eth0 properly. Incidentally, eth0 appears to be the four LAN ports; I'm using LAN1. I believe eth1 is the WAN interface.
If "DHCP" is not available, you may may need to configure the network by hand:
CFE> ifconfig eth0 -auto
DHCP registration failed on device eth0
*** command status = -23
CFE> ifconfig eth0 -addr=192.168.15.25 -gw=192.168.15.1 -mask=255.255.255.0 -dns=68.87.69.146
Device eth0: hwaddr 00-17-31-2A-90-0B, ipaddr 192.168.15.25, mask 255.255.255.0
gateway 192.168.15.1, nameserver 68.87.69.146
*** command status = 0
CFE> ping 192.168.15.1
192.168.15.1 (192.168.15.1) is alive
192.168.15.1 (192.168.15.1): 1 packets sent, 1 received
*** command status = 0
CFE> ping 192.168.15.109
192.168.15.109 (192.168.15.109) is alive
192.168.15.109 (192.168.15.109): 1 packets sent, 1 received
*** command status = 0
CFE>
Thus, if necessary, run ifconfig eth0 -auto to use DHCP to configure the network.
The CFE command to boot a kernel over TFTP is:
boot -addr=0x80001000 -max=0x800000 -tftp IPADDR:KERNEL.FILENAME
If you're using a gzip-compressed kernel image, add a "-z" option. But you can use an uncompressed kernel of up to 8mb with that command. (Hex 800000 equals 8 megabytes.)
For example, what Brett types is:
boot -addr=0x80001000 -max=0x800000 -tftp 192.168.236.5:vmlinux
Where, Eric uses:
boot -addr=0x80001000 -max=0x800000 -tftp 192.168.23.5:vmlinux
The boot address is obvious, it's the location in RAM that the CFE will transfer control to when booting an operating system. And how do I know that? Simple, it is the value of the nvram variable "os_ram_addr".
It works fine.
Having any modules loaded at boot time is problematic, because getting access to the hard disk is tricky. I avoid those problems just by not having any modules.* files under '''/lib/modules/$(uname -r)'''.
See High Level Plan for the next steps
The WL-700gE is built around the Broadcom BCM4780 NASoC (Network Appliance System on a Chip). Another device built around the same chip is the Maxtor Shared Storage, for which there is already an open firmware project. We might be able to leverage some of that work.
The bootloader used by this device is CFE, version 1.0.37.
A lot of information is available at http://www.linux-mips.org/ and is worth a couple of good looks.
Some people have reverse-engineered a bunch of specs for Broadcom devices, and put documentation at http://bcm-specs.sipsolutions.net/. This may be too old to be useful for us.
See also: MIPS Linux kernel information.
See HighLevelPlan for the current view of the project.
There are two basic paths we can take.The OpenWRT project is awesome. They build custom firmware images for wireless routers that turn those routers into minimal, but functional, computers. We use OpenWRT on some of our wireless routers (the ones that don't have a hard disk in them).
FreeSA piggy-backs on the work done by OpenWRT. The core difference is that the goal with OpenWRT is to use a cross-toolchain to build a new replacement firmware image that resides in the flash memory of a wireless device, while the goal with FreeSA is to use a cross-toolchain to bootstrap an entire operating system installation, including development tools, natively hosted on the target device. (Of course, that requires a target device with several gigabytes of storage -- ideally, a hard drive.)
Check them out! Send them hardware! (We donated a WL-700gE.) Send them cookies! http://www.openwrt.org/ is the place.
Here's a successful boot of OpenWrt, with a spinning hard drive, annotated with notes to explain what Random believes is going on.
This first section is CFE saying hello and booting the kernel, just like always:
CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: ?| 12?? 29 20:36:58 CST 2005 (root@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
Initializing Arena
Initializing Devices.
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.23.0
rndis0: Broadcom USB RNDIS Network Adapter (P-t-P)
CPU type 0x29006: 264MHz
Total memory: 67108864 KBytes
Total memory used by CFE: 0x80800000 - 0x8089BA00 (637440)
Initialized Data: 0x80831B70 - 0x80834250 (9952)
BSS Area: 0x80834250 - 0x80835A00 (6064)
Local Heap: 0x80835A00 - 0x80899A00 (409600)
Stack Area: 0x80899A00 - 0x8089BA00 (8192)
Text (code) segment: 0x80800000 - 0x80831B70 (203632)
Boot area (physical): 0x0089C000 - 0x008DC000
Relocation Factor: I:00000000 - D:00000000
Device eth0: hwaddr 00-17-31-2A-90-0B, ipaddr 192.168.1.1, mask 255.255.255.0
gateway not set, nameserver not set
Null Rescue Flag.
Null Restore Flag.
set pivot_wait = 0
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: .. 3740 bytes read
Entry at 0x80001000
Closing network.
Starting program at 0x80001000
Every message subsequent to CFE's "Starting program at" announcement is coming from Linux.
Linux version 2.6.21.5 (eric@xyzzy) (gcc version 4.1.2) #1 Sun Jun 17 18:52:39 7
That's a little surprising! I have been using a cross-toolchain based around GCC 3.4.6, because my previous experiments using GCC 4.x were abject failures. Huh. update: toolchain success!
CPU revision is: 00029006 ssb: Sonics Silicon Backplane found on address 0x18000000 ssb: BUG: Assertion failed (bus->board_vendor && bus->board_type) at: drivers/s) ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x03, vendor 0x4243) ssb: Core 1 found: Fast Ethernet (cc 0x806, rev 0x06, vendor 0x4243) ssb: Core 2 found: Fast Ethernet (cc 0x806, rev 0x06, vendor 0x4243) ssb: Core 3 found: USB 1.1 Hostdev (cc 0x808, rev 0x02, vendor 0x4243) ssb: Core 4 found: PCI (cc 0x804, rev 0x08, vendor 0x4243) ssb: Core 5 found: MIPS 3302 (cc 0x816, rev 0x00, vendor 0x4243) ssb: Core 6 found: V90 (cc 0x807, rev 0x02, vendor 0x4243) ssb: Core 7 found: IPSEC (cc 0x80B, rev 0x00, vendor 0x4243) ssb: Core 8 found: MEMC SDRAM (cc 0x80F, rev 0x00, vendor 0x4243) ssb: Initializing MIPS core... ssb: set_irq: core 0x0806, irq 2 => 2 ssb: set_irq: core 0x0806, irq 3 => 3 ssb: set_irq: core 0x0804, irq 0 => 4
Sonics Silicon Backplane is the architecture for the WL-700gE. Driver details to follow.
Determined physical RAM map: memory: 04000000 @ 00000000 (usable) Initrd not found or empty - disabling initrd Built 1 zonelists. Total pages: 16256 Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/pr0 Primary instruction cache 16kB, physically tagged, 2-way, linesize 16 bytes. Primary data cache 16kB, 2-way, linesize 16 bytes. Synthesized TLB refill handler (19 instructions). Synthesized TLB load handler fastpath (31 instructions). Synthesized TLB store handler fastpath (31 instructions). Synthesized TLB modify handler fastpath (30 instructions). PID hash table entries: 256 (order: 8, 1024 bytes) Using 132.000 MHz high precision timer. Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) Memory: 62340k/65536k available (2005k kernel code, 3136k reserved, 286k data, ) Mount-cache hash table entries: 512 NET: Registered protocol family 16 ssb: PCIcore in host mode found registering PCI controller with io_map_base unset PCI: fixing up bridge PCI: Fixing up device 0000:00:00.0 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: 2048 (order: 2, 16384 bytes) TCP bind hash table entries: 2048 (order: 1, 8192 bytes) TCP: Hash tables configured (established 2048 bind 2048) TCP reno registered
All that stuff is pretty standard.
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.
Squashfs is the filesystem type used by openwrt as a default. It's a highly-compressed filesystem that, if memory serves, is read-only. "mini_fo" is kind of like unionfs -- it's a "fanout" filesystem, meaning that you can mount multiple filesystems at the same point, with one of them writeable. So from this I infer that OpenWRT mounts the main filesystem as a read-only squashfs, and then adds an additional writeable JFFS2 filesystem backed by a different part of the flash area.
io scheduler noop registered io scheduler deadline registered (default) Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing enabled serial8250: ttyS0 at MMIO 0x0 (irq = 3) is a 16550A serial8250: ttyS1 at MMIO 0x0 (irq = 3) is a 16550A
Not really surprising that a serial device is detected, since that's where these messages are being printed.
b44.c:v1.01 (Jun 16, 2006) eth0: Broadcom 10/100BaseT Ethernet 00:17:31:2a:90:0b eth1: Broadcom 10/100BaseT Ethernet 40:10:18:00:00:2c
The wired ethernet ports use the b44 driver. There are two ethernet ports, probably eth0 is WAN and eth1 is the four-port LAN hub. It might be the other way around.
flash init: 0x1c000000 0x02000000 Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank Amd/Fujitsu Extended Query Table at 0x0040 Physically mapped flash: CFI does not contain boot bank location. Assuming top. number of CFI chips: 1 cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. Flash device: 0x200000 at 0x1fc00000 bootloader size: 262144 Updating TRX offsets and length: old trx = [0x0000001c, 0x000008f0, 0x000b5000], len=0x00161000 crc32=0x734c4af1 new trx = [0x0000001c, 0x000008f0, 0x000b5000], len=0x000b5000 crc32=0x3b6a6f96 Done Creating 4 MTD partitions on "Physically mapped flash": 0x00000000-0x00040000 : "cfe" 0x00040000-0x001f0000 : "linux" 0x000f5000-0x001f0000 : "rootfs" mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-y 0x00190000-0x001f0000 : "rootfs_data" 0x001f0000-0x00200000 : "nvram"
Details on how the flash chip is used. CFE is the boot loader, of course. The Linux region -- that came from the TRX image -- goes up to the final 64kb NVRAM region, and is divided into the kernel image, the "rootfs" (which is a squashfs), and "rootfs_data", which is presumably the writeable filesystem mentioned earlier. Note that the ending addresses for those chunks are bogus, you can determine the correct ending address by looking at the starting address of the next partition.
It seems odd that it says it's creating 4 MTD partitions, and then actually creates five. But ... ah well.
Note that the warning message actually says "force read-only" but Eric's minicom truncated the message to 80 columns.
nf_conntrack version 0.5.0 (512 buckets, 4096 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>
Blah blah blah network stuff.
VFS: Mounted root (squashfs filesystem) readonly. Freeing unused kernel memory: 116k freed Warning: unable to open an initial console. Algorithmics/MIPS FPU Emulator v1.5
That warning message seems odd, I don't understand it. But here we see that the filesystem is mounted successfully, hooray. Now, under normal circumstances, the next thing that happens is that the kernel runs the "init" process. Check out what happens in OpenWRT:
- preinit - diag: Detected 'ASUS WL-700gE' diag: Spinning up HDD and enabling leds b44: eth0: Link is up at 100 Mbps, full duplex. b44: eth0: Flow control is off for TX and off for RX. jffs2 not ready yet; using ramdisk mini_fo: using base directory: / mini_fo: using storage directory: /tmp/root
This is the preinit script, which you can find in package/base-files/files. The really interesting thing that preinit does is run preinit.arch. I betcha the preinit.arch that winds up in the OpenWRT trx image starts by loading the diag kernel module, the source for which is in package/broadcom-diag. That module figures out the device is a WL-700gE, and sets up the GPIO pins appropriately. Most importantly, it sets pin 3, which causes power to be delivered to the hard disk and LEDs.
I'm surprised it doesn't also set pin 6, which is done by the ASUS firmware. Maybe things will work better if it does that?
Since this is the first boot of OpenWRT, the JFFS2 filesystem hasn't been created yet, so openwrt uses a ramdisk instead. I'd kind of like to use a ramdisk all the time, so perhaps we should amend the init scripts to do that? The place to do that would be in the /etc/init.d/done script, which does the switch to JFFS.
- init - init started: BusyBox v1.4.2 (2007-06-17 18:39:35 CEST) multi-call binary Please press Enter to activate this console. b44: eth0: Link is up at 100 Mbps,. b44: eth0: Flow control is off for TX and off for RX. PPP generic driver version 2.4.2 jffs2_scan_eraseblock(): End of filesystem marker found at 0x0 jffs2_build_filesystem(): unlocking the mtd device... done. jffs2_build_filesystem(): erasing all blocks after the end marker... <7>eth0.0:e eth0.0: dev_set_promiscuity(master, 1) device eth0 entered promiscuous mode device eth0.0 entered promiscuous mode eth0.1: Setting MAC address to 00 17 31 2a 90 0c. br-lan: port 1(eth0.0) entering learning state br-lan: topology change detected, propagating br-lan: port 1(eth0.0) entering forwarding state done. mini_fo: using base directory: / mini_fo: using storage directory: /jffs
Now we are in the init program, which is exec'ed by preinit as its last operation. It runs init.d/rcS S boot, which is the source of all that activity -- setting the network stuff, building the actual jffs2 filesystem and adding it to the fanout, and it looks like setting up an ethernet bridge.
BusyBox v1.4.2 (2007-06-17 18:39:35 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 (bleeding edge, r7646) ------------------- * 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:/#
2007-08-12
Eric builds OpenWRT
URL: https://svn.openwrt.org/openwrt/trunk Revision: 8400
eric@xyzzy:~/freesa/openwrt-trunk$ ls -l ./bin/openwrt-brcm47xx-2.6-squashfs.trx -rw-r--r-- 1 eric eric 1839104 2007-07-07 15:14 ./bin/openwrt-brcm47xx-2.6-squashfs.trx
ERROR!! copysize is 1839104, amtcopy is 1802240
So we try again with make menuconfig to trim options.
eric@xyzzy:~/freesa/openwrt-trunk$ ls -l bin/*.trx -rw-r--r-- 1 eric eric 1708032 2007-08-12 14:21 bin/openwrt-brcm47xx-2.6-squashfs.trx eric@xyzzy:~/freesa/openwrt-trunk$
(If we really want to press the limit, the total flash size is 2097152 bytes ... 262144 is consumed by CFE ... 65536 is consumed by NVRAM ... leaving 1769472 for the .trx ... 1728 kb is 1.6875 MB)
Also, we had to do some config file hacking to get the darn aec62xx drivers built:eric@xyzzy:~/freesa/openwrt-trunk$ find ./build_dir/linux-2.6-brcm47xx/linux-2.6.22.1/drivers/ide/ -name "*.ko" ./build_dir/linux-2.6-brcm47xx/linux-2.6.22.1/drivers/ide/pci/generic.ko ./build_dir/linux-2.6-brcm47xx/linux-2.6.22.1/drivers/ide/pci/cmd64x.ko ./build_dir/linux-2.6-brcm47xx/linux-2.6.22.1/drivers/ide/pci/aec62xx.ko ./build_dir/linux-2.6-brcm47xx/linux-2.6.22.1/drivers/ide/ide-core.ko ./build_dir/linux-2.6-brcm47xx/linux-2.6.22.1/drivers/ide/ide-disk.ko ./build_dir/linux-2.6-brcm47xx/linux-2.6.22.1/drivers/ide/ide-generic.ko eric@xyzzy:~/freesa/openwrt-trunk$
So basically following the steps outlined in ReflashingWithTftp we did the following:
so that we could get an ip address that doesn't conflict with the OTHER 192.168.1.1 which is Eric's upstream router ....
CFE> printenv Variable Name Value -------------------- -------------------------------------------------- BOOT_CONSOLE uart0 CFE_VERSION 1.0.37 CFE_BOARDNAME BCM947XX CFE_MEMORYSIZE 67108864 STARTUP go; NET_DEVICE eth0 NET_IPADDR 192.168.23.8 NET_NETMASK 255.255.255.0 NET_GATEWAY 192.168.23.1 NET_NAMESERVER 192.168.23.1 *** command status = 0
CFE> go Null Rescue Flag. Null Rescue Flag. 10 seconds to Rescue mode... Null Rescue Flag. 9 seconds to Rescue mode...
1 seconds to Rescue mode... Null Rescue Flag. Hello!! Enter Rescue Mode: (by Force) Reading :: TFTP Server. Failed.: Timeout occured Reading :: TFTP Server. Failed.: Timeout occured
eric@xyzzy:~/freesa/openwrt-trunk/bin$ tftp.inetutils tftp> connect 192.168.23.8 tftp> bin tftp> put openwrt-brcm47xx-2.6-squashfs.trx Sent 1708032 bytes in 3.5 seconds tftp> quit eric@xyzzy:~/freesa/openwrt-trunk/bin$Which resulted in this on the WL-700gE console: />
Reading :: TFTP Server. Failed.: Timeout occured Reading :: TFTP Server. TFTP_BLKLEN!! Done. 1708032 bytes read Download of 0x1a1000 bytes completed Write kernel and filesystem binary to FLASH (0xbfc40000) flash device 'flash1.trx' Programming... done. 1708032 bytes written
and the console is halted there.
CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: ?| 12?? 29 20:36:58 CST 2005 (root@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
Initializing Arena
Initializing Devices.
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.23.0
rndis0: Broadcom USB RNDIS Network Adapter (P-t-P)
CPU type 0x29006: 264MHz
Total memory: 67108864 KBytes
Total memory used by CFE: 0x80800000 - 0x8089BA00 (637440)
Initialized Data: 0x80831B70 - 0x80834250 (9952)
BSS Area: 0x80834250 - 0x80835A00 (6064)
Local Heap: 0x80835A00 - 0x80899A00 (409600)
Stack Area: 0x80899A00 - 0x8089BA00 (8192)
Text (code) segment: 0x80800000 - 0x80831B70 (203632)
Boot area (physical): 0x0089C000 - 0x008DC000
Relocation Factor: I:00000000 - D:00000000
Device eth0: hwaddr 00-17-31-2A-90-0B, ipaddr 192.168.1.1, mask 255.255.255.0
gateway not set, nameserver not set
Null Rescue Flag.
Null Restore Flag.
set pivot_wait = 0
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: .. 3740 bytes read
Entry at 0x80001000
Closing network.
Starting program at 0x80001000
Linux version 2.6.22.1 (eric@xyzzy) (gcc version 4.1.2) #5 Sun Aug 12 14:21:19 7
CPU revision is: 00029006
ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x03, vendor 0x4243)
ssb: Core 1 found: Fast Ethernet (cc 0x806, rev 0x06, vendor 0x4243)
ssb: Core 2 found: Fast Ethernet (cc 0x806, rev 0x06, vendor 0x4243)
ssb: Core 3 found: USB 1.1 Hostdev (cc 0x808, rev 0x02, vendor 0x4243)
ssb: Core 4 found: PCI (cc 0x804, rev 0x08, vendor 0x4243)
ssb: Core 5 found: MIPS 3302 (cc 0x816, rev 0x00, vendor 0x4243)
ssb: Core 6 found: V90 (cc 0x807, rev 0x02, vendor 0x4243)
ssb: Core 7 found: IPSEC (cc 0x80B, rev 0x00, vendor 0x4243)
ssb: Core 8 found: MEMC SDRAM (cc 0x80F, rev 0x00, vendor 0x4243)
ssb: Initializing MIPS core...
ssb: set_irq: core 0x0806, irq 2 => 2
ssb: set_irq: core 0x0806, irq 3 => 3
ssb: set_irq: core 0x0804, irq 0 => 4
ssb: Sonics Silicon Backplane found at address 0x18000000
Determined physical RAM map:
memory: 04000000 @ 00000000 (usable)
Initrd not found or empty - disabling initrd
Built 1 zonelists. Total pages: 16256
Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/pr0
Primary instruction cache 16kB, physically tagged, 2-way, linesize 16 bytes.
Primary data cache 16kB, 2-way, linesize 16 bytes.
Synthesized TLB refill handler (20 instructions).
Synthesized TLB load handler fastpath (32 instructions).
Synthesized TLB store handler fastpath (31 instructions).
Synthesized TLB modify handler fastpath (30 instructions).
PID hash table entries: 256 (order: 8, 1024 bytes)
Using 132.000 MHz high precision timer.
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 62304k/65536k available (2024k kernel code, 3168k reserved, 295k data, )
Mount-cache hash table entries: 512
NET: Registered protocol family 16
ssb: PCIcore in host mode found
registering PCI controller with io_map_base unset
PCI: fixing up bridge
PCI: Fixing up device 0000:00:00.0
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: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
squashfs: version 3.0 (2006/03/15) Phillip Lougher
Registering mini_fo version $Id$
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing enabled
serial8250: ttyS0 at MMIO 0x0 (irq = 3) is a 16550A
serial8250: ttyS1 at MMIO 0x0 (irq = 3) is a 16550A
b44.c:v1.01 (Jun 16, 2006)
eth0: Broadcom 10/100BaseT Ethernet 00:17:31:2a:90:0b
eth1: Broadcom 10/100BaseT Ethernet 40:10:18:00:00:2c
flash init: 0x1c000000 0x02000000
Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
Physically mapped flash: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
Flash device: 0x200000 at 0x1fc00000
bootloader size: 262144
Updating TRX offsets and length:
old trx = [0x0000001c, 0x000008f0, 0x000b7800], len=0x001a1000 crc32=0xc41bee4b
new trx = [0x0000001c, 0x000008f0, 0x000b7800], len=0x000b7800 crc32=0xed94ea80
Done
Creating 4 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "cfe"
0x00040000-0x001f0000 : "linux"
0x000f7800-0x001f0000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-y
mtd: partition "rootfs" set to be root filesystem
mtd: partition "rootfs_data" created automatically, ofs=1D0000, len=20000
0x001d0000-0x001f0000 : "rootfs_data"
0x001f0000-0x00200000 : "nvram"
nf_conntrack version 0.5.0 (512 buckets, 4096 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: 120k freed
Warning: unable to open an initial console.
Algorithmics/MIPS FPU Emulator v1.5
- preinit -
diag: Detected 'ASUS WL-700gE'
diag: Spinning up HDD and enabling leds
b44: eth0: Link is up at 100 Mbps, full duplex.
b44: eth0: Flow control is off for TX and off for RX.
Probing device eth0: found!
jffs2 not ready yet; using ramdisk
mini_fo: using base directory: /
mini_fo: using storage directory: /tmp/root
- init -
init started: BusyBox v1.4.2 (2007-08-12 14:16:56 CEST) multi-call binary
Please press Enter to activate this console. b44: eth0: Link is up at 100 Mbps,.
b44: eth0: Flow control is off for TX and off for RX.
There is already a switch registered on the device 'eth0'
eth0.0: Setting MAC address to 00 17 31 2a 90 0b.
VLAN (eth0.0): Underlying device (eth0) has same MAC, not checking promiscious.
eth0.1: Setting MAC address to 00 17 31 2a 90 0c.
device eth0 entered promiscuous mode
VLAN (eth0.1): Setting underlying device (eth0) to promiscious mode.
jffs2: Too few erase blocks (2)
BusyBox v1.4.2 (2007-08-12 14:16:56 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 (bleeding edge, r8400) -------------------
** 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:/#
Then, using ifconfig, get rid of the eth0.1, eth0.1, and eth0. Then re-add eth0 with a local network address. Once complete, obtain the kernel modules:
ifconfig eth0.1 down ifconfig eth0.0 down ifconfig eth0 down ifconfig eth0 add 192.168.23.8/24 up route add default gw 192.168.23.1 echo "nameserver 192.168.23.1" > /etc/resolv.conf ping -c1 www.google.com wget http://tiedyedfreaks.org/eric/tmp/ide-core.ko wget http://tiedyedfreaks.org/eric/tmp/ide-generic.ko wget http://tiedyedfreaks.org/eric/tmp/ide-disk.ko wget http://tiedyedfreaks.org/eric/tmp/generic.ko wget http://tiedyedfreaks.org/eric/tmp/aec62xx.ko
And then load them ... todo capture screen output here
----
2007-08-11
Random builds OpenWRT, and mounts hard disk.
----
2007-07-07
Eric builds OpenWRT
URL: https://svn.openwrt.org/openwrt/trunk Revision: 7885
Using make menuconfig to trim options creating this configuration file: [2] and then make V=99 [3].
The ''strangely'' it seems that the aec62xx drivers are not built, just as had been foretold:
eric@xyzzy:~/freesa/openwrt-trunk$ ls bin/packages/*aec* ls: bin/packages/*aec*: No such file or directory
Algorithmics/MIPS FPU Emulator v1.5 - preinit - diag: Detected 'ASUS WL-700gE' diag: Spinning up HDD and enabling leds b44: eth0: Link is up at 100 Mbps, full duplex.
BusyBox v1.4.2 (2007-07-07 14:56:11 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 (bleeding edge, r7885) -------------------
** 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:/# ls -l /lib/modules/2.6.22-rc6
-rw-r--r-- 1 root root 2572 Jul 7 2007 crc-ccitt.ko
-rw-r--r-- 1 root root 38780 Jul 7 2007 diag.ko
-rw-r--r-- 1 root root 66636 Jul 7 2007 ext2.ko
-rw-r--r-- 1 root root 16856 Jul 7 2007 ppp_async.ko
-rw-r--r-- 1 root root 34948 Jul 7 2007 ppp_generic.ko
-rw-r--r-- 1 root root 18456 Jul 7 2007 pppoe.ko
-rw-r--r-- 1 root root 4480 Jul 7 2007 pppox.ko
-rw-r--r-- 1 root root 8504 Jul 7 2007 slhc.ko
root@OpenWrt:/#
2007-06-17 -- Hard drive spins.
Eric built OpenWRT with the broadcomm with 2.6 kernel and everything else default with hopes of getting it to boot and see if we can spin the hard drive.
URL: https://svn.openwrt.org/openwrt/trunk Revision: 7646which resulted in:
eric@xyzzy:~/freesa/openwrt-trunk$ ls -l ./bin/openwrt-brcm47xx-2.6-squashfs.trx -rw-r--r-- 1 eric eric 2297856 2007-06-16 22:29 ./bin/openwrt-brcm47xx-2.6-squashfs.trx eric@xyzzy:~/freesa/openwrt-trunk$
2297856 is bigger than the max size of our flash, wish is about 1.7 meg after bootloader. So we rebuilt with many options removed. like wireless.
tftp> connect 192.168.23.8 tftp> bin tftp> put openwrt-brcm47xx-2.6-squashfs.trx Sent 1445888 bytes in 2.9 seconds tftp>
Failed.: Timeout occured Reading :: TFTP Server. TFTP_BLKLEN!! Done. 1445888 bytes read Download of 0x161000 bytes completed Write kernel and filesystem binary to FLASH (0xbfc40000) flash device 'flash1.trx' Programming... done. 1445888 bytes written
Time to reboot! (For the annotated output of this boot, see: OpenWrtBootAnalysis)
BusyBox v1.4.2 (2007-06-17 18:39:35 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 (bleeding edge, r7646) -------------------
** 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:/#
for the record:eric@xyzzy:~/freesa/openwrt-trunk$ svn info Path: . URL: https://svn.openwrt.org/openwrt/trunk Repository Root: https://svn.openwrt.org/openwrt Repository UUID: 3c298f89-4303-0410-b956-a3cf2f4a3e73 Revision: 7646 Node Kind: directory Schedule: normal Last Changed Author: nbd Last Changed Rev: 7645 Last Changed Date: 2007-06-16 04:08:06 +0200 (Sat, 16 Jun 2007) eric@xyzzy:~/freesa/openwrt-trunk$
-----
2006-11-28 -- OpenWRT built and flashed onto system.
Brett has built an OpenWRT image using the latest OpenWRT subversion trunk -- that's revision 5671 -- and the attached config file which should be uncompressed and renamed to .config. There are lots of resulting image files, three of which are trx files: openwrt-brcm-2.6-jffs2-128k.trx, openwrt-brcm-2.6-jffs2-64k.trx, and openwrt-brcm-2.6-squashfs.trx.
_(since 0.11
The default content for a new wiki page can be chosen from a list of page templates.
That list is made up from all the existing wiki pages having a name starting with PageTemplates/.
The initial content of a new page will simply be the content of the chosen template page, or a blank page if the special (blank page) entry is selected. When there's actually no wiki pages matching that prefix, the initial content will always be the blank page and the list selector will not be shown (i.e. this matches the behavior we had up to now).
To create a new template, simply create a new page having a name starting with PageTemplates/.
(Hint: one could even create a !PageTemplates/Template for facilitating the creation of new templates!)
Available templates:
TitleIndex(PageTemplates/)
----
See also: TracWiki
Before we start the painful process of trying to build an entirely new firmware from source code ourselves, let's make sure we can at least build the Asus firmware using the tools and source they provide.
/opt, so that it becomes /opt/brcm/.... The path is significant -- GCC toolchains must be built specifically to live in a particular filesystem location, and this cross-toolchain is built to live in /opt/brcm./root/WL700g, but one of the first things we're going to do is fix that so that it can be built from wherever you want, and doesn't have to be built as root. I put "GPL" and "source" in quotes because a lot of the stuff in that tarball is not source code and is not under the GPL. For example, the real-time-clock chip (as far as I can tell) has two source files, only one of which is present in source form at all (the other is a precompiled binary object file), and that source file is not under GPL anyway. Once you have unpacked the tarball, change all the directories to be writable with something like: find . -type d -exec chmod 775 {} \;ash available. I installed dash 0.5.3, which I got from here. I've also used ash 0.4.0, but it doesn't build very easily on modern systems.rcsclean because it is invoked during the build process. This is part of RCS, an ancient version control system that nobody should ever use any more. I worked around the need for this program by creating an empty bash script that just returns 0 (success).export PATH=/opt/brcm/hndtools-mipsel-linux/bin:$PATHnasoc/src/apps directory. There is a README_ASUS there that reveals that the process to build the firmware image is make rebuild && make image-WL700gE/root/WL700g hard-coded, which is absurd. Fix this in all of the *.pc files. If you've unpacked the bundle into $HOME/src you can do this with: for file in $(find . -name "*.pc"); do cp $file{,.orig}; sed -e "s/\/root\//\/home\/$USER\/src\//" $file > $file.new; mv $file.new $file; diff $file.orig $file; done;.depend files under busybox. find ./busybox -name ".depend" -exec rm {} \;make clean.tarfiles subdirectory) have the right privileges on their contents. (Initially they don't.) So:
pushd mipselrm -rf install.rc3tar xzvf ../tarfiles/install.tar.gztar xzvf ../tarfiles/exinstall.tar.gzfind . -type d -exec chmod 775 {} \;make clean (yes, again)mkcramfs. I don't have one of those; I have mkfs.cramfs instead. If that's your situation as well, you can either create a mkcramfs symlink or modify the relevant Makefiles: Makefile, mfgtest_root/Makefile, and pivot_root/Makefile. Also make sure that the program is on your PATH!/usr/local/bin/ez-ipupdate. That's right! It installs a MIPS cross-compiled binary onto the host system. This is the sort of thing that leads me to do my builds as a non-root user. Modify ez-ipupdate/Makefile so that the commands in the install and install-am targets start with echo.At this point, the make rebuild and make image-WL700gE commands completed for us without error. Give it a try. You should find yourself with a mipsel/WL700gE_1.0.4.6.nas when it completes.
If you get a segmentation fault when running generate_igpayatinlay -- this has happened to me from time to time, and I do not understand why -- you can work around it:
pushd translation_database./generate_igpayatinlay ../www/translate_EN.txt ../www/translate_JP.txt_utf8 "Japanese" > igpayatinlay_sources_jp.c until that succeedsigpayatinlay_sources_??.c files by renaming themigpayatinlay_sources_??.c names rather than re-running generate_igpayatinlaypopd
halle:~ eric$ cat dload/ez-ipupdate_Makefile.patch
--- ez-ipupdate/Makefile.orig 2006-11-22 18:07:12.000000000 +0100
+++ ez-ipupdate/Makefile 2006-11-22 18:07:53.000000000 +0100
@@ -300,9 +300,9 @@
install-data-am:
install-data: install-data-am
install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+ echo @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-binPROGRAMS
uninstall: uninstall-am
all-am: $(PROGRAMS)
@@ -312,10 +312,10 @@
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
install: $(PROGRAMS)
- install -D ez-ipupdate $(INSTALLDIR)/usr/sbin/ez-ipupdate
- $(STRIP) $(INSTALLDIR)/usr/sbin/ez-ipupdate
+ echo install -D ez-ipupdate $(INSTALLDIR)/usr/sbin/ez-ipupdate
+ echo $(STRIP) $(INSTALLDIR)/usr/sbin/ez-ipupdate
romfs:
$(ROMFSINST) /bin/ez-ipupdate
halle:~ eric$
It seems likely that the best approach for re-flashing will be to use the TFTP option provided by the [CommonFirmwareEnvironment CFE boot firmware].
These are the instructions I found on http://www.wl500g.info/:
1. Extract the two "trx" files from the "nas" firmware file. There is a "disk" trx file and a "flash" trx file. The TFTP upload will only send the "flash" trx file. (instructions on how to extract will follow presently.)
1. Connect a computer with static IP address 192.168.1.50/24 directly to the WL-700gE port LAN 1.
1. Unplug the WL-700gE for around 20 seconds
1. Press and hold the orange EZSetup button while plugging in router
1. As soon as the blue Ready LED turns on or starts blinking, release EZS button
1. Use TFTP to put the flash trx file to host 192.168.1.1 port 69
tftp> connect 192.168.1.1 tftp> bin tftp> put foo.trx
When one powers-on the device with the orange EZS button pressed, the serial console shows the following:
CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: ¥| 12¤ë 29 20:36:58 CST 2005 (root@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
Initializing Arena
Initializing Devices.
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.23.0
rndis0: Broadcom USB RNDIS Network Adapter (P-t-P)
CPU type 0x29006: 264MHz
Total memory: 67108864 KBytes
Total memory used by CFE: 0x80800000 - 0x8089BA00 (637440)
Initialized Data: 0x80831B70 - 0x80834250 (9952)
BSS Area: 0x80834250 - 0x80835A00 (6064)
Local Heap: 0x80835A00 - 0x80899A00 (409600)
Stack Area: 0x80899A00 - 0x8089BA00 (8192)
Text (code) segment: 0x80800000 - 0x80831B70 (203632)
Boot area (physical): 0x0089C000 - 0x008DC000
Relocation Factor: I:00000000 - D:00000000
Device eth0: hwaddr 00-17-31-2A-90-30, ipaddr 192.168.236.137, mask 255.255.255.0
gateway not set, nameserver not set
Null Rescue Flag.
Null Rescue Flag.
10 seconds to Rescue mode...
Null Rescue Flag.
9 seconds to Rescue mode...
Null Rescue Flag.
8 seconds to Rescue mode...
Null Rescue Flag.
7 seconds to Rescue mode...
Null Rescue Flag.
6 seconds to Rescue mode...
Null Rescue Flag.
5 seconds to Rescue mode...
Null Rescue Flag.
4 seconds to Rescue mode...
Null Rescue Flag.
3 seconds to Rescue mode...
Null Rescue Flag.
2 seconds to Rescue mode...
Null Rescue Flag.
1 seconds to Rescue mode...
Null Rescue Flag.
Hello!! Enter Rescue Mode: (by Force)
Reading :: TFTP Server.
Failed.: Timeout occuredS
So that pretty much shows how to do it. Just hold down the EZS button for a while until the unit enters rescue mode. Note that the device will somehow retain the IP address it last had; maybe that's written to NVRAM. You can reset this to the default 192.168.1.1 by pressing the black "Reset" button on the back of the unit; when the device reboots, it will have the defaults restored.
During the countdown to rescue mode, the "Ready" LED flashes once per second. When the device enters rescue mode, the "Ready" light goes out altogether.
The last two lines, when it's trying to listen for incoming TFTP puts, repeat indefinitely until one hits control-C over the serial console -- at that point, one gets a CFE> prompt.
Presumably the thing that needs to be uploaded via TFTP is the flash trx image file, which is only one part of the nas firmware file.
From the CFE prompt, you can do some things, I haven't experimented much. But you can do this:
CFE> help Available commands: rndis Broadcom USB RNDIS utility. et Broadcom Ethernet utility. nvram NVRAM utility. reboot Reboot. printdefault Display the environment default variables embeded in the bootloader flash Update a flash memory device autoboot Automatic system bootstrap. batch Load a batch file into memory and execute it go Verify and boot OS image. boot Load an executable file into memory and execute it load Load an executable file into memory without executing it write_block Write a block of memory write Write an address of memory read Read a region of memory save Save a region of memory to a remote file via TFTP ping Ping a remote IP host. arp Display or modify the ARP Table ifconfig Configure the Ethernet interface unsetenv Delete an environment variable. printenv Display the environment variables setenv Set an environment variable. help Obtain help for CFE commands For more information about a command, enter 'help command-name' *** command status = 0
And printenv shows:
Variable Name Value -------------------- -------------------------------------------------- BOOT_CONSOLE uart0 CFE_VERSION 1.0.37 CFE_BOARDNAME BCM947XX CFE_MEMORYSIZE 67108864 NET_DEVICE eth0 NET_IPADDR 192.168.236.137 NET_NETMASK 255.255.255.0 NET_GATEWAY 0.0.0.0 NET_NAMESERVER 0.0.0.0 STARTUP go; *** command status = 0
Moreover, printdefault shows:
CFE> printdefault FLSH b boardtype=0x042f boardnum=44 boardrev=0x10 boardflags=0x0110 clkfreq=264 sdram_init=0x0009 sdram_config=0x0062 sdram_refresh=0x0000 sdram_ncdl=0 et0macaddr=00:17:31:2A:90:30 et0phyaddr=30 et0mdcport=0 et1macaddr=40:10:18:00:00:2c et1phyaddr=31 et1mdcport=1 watchdog=5000 reset_gpio=7 dl_ram_addr=a0001000 os_ram_addr=80001000 os_flash_addr=bfc40000 scratch=a0180000 boot_wait=off wait_time=1 lan_ipaddr=192.168.1.1 lan*** command status = 0
the first line is obviously mangled, and I think the last one is as well. But you can see that the default IP 192.168.1.1 is in the default environment. The clock frequency is also there as a default -- probably one could clock the board up to the standard 300MHz if one wanted.
That's all for now.
We didn't have to figure out a lot of the details of how to get things going on the WL-700gE, because the OpenWRT project already does that (at least in some versions of OpenWRT, like what was SVN revision 9382 and is now git commit 09ce975). All we've needed to do is figure out how OpenWRT does it.
Unfortunately, we're not particularly good at figuring out how a large and somewhat baroque set of Makefiles all fit together. So rather than reverse-engineering the build system used by OpenWRT, we prefer to do a build with make V=99 and analyze the resulting output.
This works really well, since make normally echoes the commands it is running right before it runs them. However, make can be instructed not to echo commands, either by prepending an '@' symbol to the command or by running make with the -s option. You can try to remove all such directives with sed:
find . -name Makefile -o -name '*.mk' | xargs sed -i 's/<ctrl-V><TAB>@/<ctrl-V><TAB>/'
(control-V causes the next character typed to be literally entered; in this case, it prevents the tab character from being swallowed by the shell.)
and
find . -name Makefile -o -name '*.mk' | xargs sed -i 's/make -s/make/'
Even then, some commands aren't echoed. I don't understand why. However, if you rebuild make with the patch attached to this page applied, those directives will be ignored entirely.
We will have two main components in FreeSA: a flash-resident firmware image where, among other things, the kernel will live; and a hard disk-based filesystem containing the full operating system distribution.
The flash must contain the kernel and a small initial root filesystem. Under normal operations, the only thing this will be used for is activating the hard disk, mounting the real root filesystem on the hard disk, and then running init on the real root filesystem.
Under abnormal circumstances, the initial root filesystem must permit installation or recovery of the freesa system. This probably means, at a minimum, it should provide a way to obtain a root console prompt from the internal root filesystem. Ideally, this root shell could then be used to mount a full root filesystem image over NFS, for example; or partition and format the internal hard disk, then install an OS tarball found over the network using NFS or Samba or netcat.
The filesystem embedded in the flash image will be similar to the OpenWRT trx image -- that is, unless for some reason it turns out this is a bad idea, the kernel will be lzma compressed, and the root filesystem will be a squashfs image. It will also be built using a uClibc cross-toolchain, just like OpenWRT is.
It appears that there is just no way to access or control the CFE boot loader except using a real serial console, so an important goal of the FreeSA firmware is to make it unnecessary to access CFE.
(If we can use kexec on the FreeSA device, then the internal firmware's role will be a second-stage boot loader, whose job is to provide a way to load a "real" runtime kernel and boot it. But we suspect it will not be trivial to get kexec to work for us.)
The initial goal is to support normal operations as stated above: activating the hard disk, mounting the real root filesystem on the hard disk, and then running init on the real root filesystem. What programs are needed to support this?
This will need to be based on a [ToolChain uClibc toolchain] busybox, since the root filesystem plus kernel image need to be 1728kb or less.
A really, really, (really!) minimal busybox is 106376 bytes. The other
stuff that needs to be present in SSBL is:
This probably gives us a lot of wiggle room for adding in other
convenience stuff -- maybe enough to have some networking utilities, or
USB disk mounting stuff ... we will see.
If we don't need other binaries besides busybox, then we can statically
link busybox and avoid having the shared libraries at all.
The busybox applets compiled in are:
There is no big trick to get it to use the new toolchain. Suppose that
your toolchain is in /opt/uclibc. Then all you have to do is:
something like ...
#!/sbin/busybox sh
#
PATH=/sbin
export PATH
#hmmm seems like path is not working
/sbin/mount -t sysfs none /sys
/sbin/mount -t proc none /proc
#/sbin/mount -n -t ramfs none /dev
#/sbin/mount -t tmpfs mdev /dev
echo "Creating device nodes..."
echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -s
/sbin/mount -t tmpfs mdev /dev
#mkdir /dev/pts
#mount -t devpts devpts /dev/pts
#
# This activates the hard disk.
# The timing is quite sensitive. Shorter sleeps will certainly
# work but removing the sleeps entirely prevents the hard disk
# from being recognized. We do not yet understand why.
#
echo "activating hard disk"
cd /modules
echo "insmod diag.ko"
/sbin/insmod diag.ko
/sbin/sleep 10
echo "enabling pci devices"
cd /sys/devices/pci0000:00
for FILE in */enable
do
echo -n 1 > $FILE
done
cd /modules
/sbin/sleep 5
echo "insmod ide-core.ko"
/sbin/insmod ide-core.ko
/sbin/sleep 5
echo "insmod ide-disk.ko"
/sbin/insmod ide-disk.ko
/sbin/sleep 5
echo "insmod aec62xx.ko"
/sbin/insmod aec62xx.ko
echo "mount /dev/hde11 /mnt"
/sbin/mount /dev/hde11 /mnt
echo "cd /mnt"
cd /mnt
echo "pivot_root . old_root"
/sbin/pivot_root . old_root
echo "chrooting"
exec /sbin/chroot . /sbin/init </dev/console >/dev/console 2>&1
My idea is: start out with just this stuff ... see if it works by doing
the nfs-booting trick ... if it does, then turn it into a trx with a
non-NFS-boot kernel, and see how big it is. We have 1728kb to play
with; if the totally-minimal thing turns out to be like 1000kb then we
can layer in other stuff -- like USB modules so we can boot from an
external USB disk or flash stick; IP utilities so we can net-boot...
booting from an external disk using the same basic principle as the
above is probably one of the best "convert to freesa" options, come to
think of it. I mean if you have a stock wl-700ge and do the freesa
build in its entirety, that's great and you don't need anything else.
BUT if you don't want to do the freesa build yourself, and you don't
want to run an NFS server and so on, then it would be pretty nice to be
able to:
for that to work, we'd need the init script to be smarter:
We COULD instead of untarring directly mount an alternate ramdisk image
also stored on the flash device -- that would give us more room than the
1728kb.
Offhand that sounds like adding:
CFE-console: Serial init done.
Linux version 2.6.23.16-nb6eric (kernel@192.168.23.3) (gcc version 4.3.0 (GCC) ) #1 Mon Jan 19 09
<<< trimmed >>>
b44: eth1: BUG! Timeout waiting for bit 80000000 of register 428 to clear.
IP-Config: Complete:
device=eth0, addr=192.168.23.3, mask=255.255.255.0, gw=192.168.23.1,
host=192.168.23.3, domain=, nis-domain=(none),
bootserver=0.0.0.0, rootserver=192.168.23.5, rootpath=
Looking up port of RPC 100003/2 on 192.168.23.5
Looking up port of RPC 100005/1 on 192.168.23.5
VFS: Mounted root (nfs filesystem) readonly.
Freeing unused kernel memory: 124k freed
Creating device nodes...
mdev: mknod mtdblock4: Read-only file system
activating hard disk
insmod diag.ko
diag: Detected 'ASUS WL-700gE'
diag: Spinning up HDD and enabling leds
enabling pci devices
PCI: Device 0000:00:00.0 resource collisions detected. Ignoring...
PCI: Device 0000:00:00.0 resource collisions detected. Ignoring...
PCI: Fixing up device 0000:00:00.0
PCI: Enabling device 0000:00:02.0 (0000 -> 0003)
PCI: Fixing up device 0000:00:02.0
PCI: Enabling device 0000:00:03.0 (0000 -> 0001)
PCI: Fixing up device 0000:00:03.0
PCI: Enabling device 0000:00:03.1 (0000 -> 0001)
PCI: Fixing up device 0000:00:03.1
PCI: Enabling device 0000:00:03.2 (0000 -> 0002)
PCI: Fixing up device 0000:00:03.2
insmod ide-core.ko
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
insmod ide-disk.ko
insmod aec62xx.ko
AEC6280: IDE controller at PCI slot 0000:00:02.0
AEC6280: chipset revision 16
AEC6280: 100% native mode on irq 6
ide2: BM-DMA at 0x0180-0x0187, BIOS settings: hde:pio, hdf:pio
ide3: BM-DMA at 0x0188-0x018f, BIOS settings: hdg:pio, hdh:pio
hde: HDT722516DLAT80, ATA DISK drive
hde: host side 80-wire cable detection failed, limiting max speed to UDMA33
ide2 at 0x100-0x107,0x10a on irq 6
hde: max request size: 512KiB
hde: 321672960 sectors (164696 MB) w/7674KiB Cache, CHS=20023/255/63, UDMA(33)
hde: cache flushes supported
hde: hde1 < hde5 hde6 hde7 hde8 hde9 hde10 hde11 >
mount /dev/hde11 /mnt
kjournald starting. Commit interval 5 seconds
EXT3 FS on hde11, internal journal
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with ordered data mode.
cd /mnt
pivot_root . old_root
chrooting
Algorithmics/MIPS FPU Emulator v1.5
INIT: version 2.86 booting
[ OK ] kernel-based file systems: /proc /sys
[ OK ] /dev in tmpfs...
[ OK ]static entries...
[ OK ]Permissons on /dev/shm...
Starting udevd...
udevd[211]: lookup_group: specified group 'uucp' unknown
udevd[211]: lookup_group: specified group 'uucp' unknown
udevd[211]: lookup_group: specified group 'uucp' unknown
[ OK ]2]: main: the kernel does not support inotify, udevd can't monitor rules file changes
Performing Coldplugging...
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
ehci_hcd 0000:00:03.2: EHCI Host Controller
ehci_hcd 0000:00:03.2: new USB bus registered, assigned bus number 1
ehci_hcd 0000:00:03.2: irq 6, io mem 0x40005000
USB Universal Host Controller Interface driver v3.0
ehci_hcd 0000:00:03.2: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 4 ports detected
uhci_hcd 0000:00:03.0: UHCI Host Controller
uhci_hcd 0000:00:03.0: new USB bus registered, assigned bus number 2
uhci_hcd 0000:00:03.0: irq 6, io base 0x00000200
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
uhci_hcd 0000:00:03.1: UHCI Host Controller
uhci_hcd 0000:00:03.1: new USB bus registered, assigned bus number 3
uhci_hcd 0000:00:03.1: irq 6, io base 0x00000220
usb usb3: configuration #1 chosen from 1 choice
hub 3-0:1.0: USB hub found
[ OK ]1.0: 2 ports detected
[ OK ] root file system in read-only mode...
Checking file systems...
/dev/hde11 has gone 49710 days without being checked, check forced.
/dev/hde11: 82882/9191424 files (2.4% non-contiguous), 725465/18378359 blocks
/dev/hde5: Superblock last write time is in the future. FIXED.
/dev/hde5 was not cleanly unmounted, check forced.
/dev/hde5: 29/26208 files (17.2% non-contiguous), 28870/104420 blocks
/dev/hde8: recovering journal
/dev/hde8: Superblock last mount time is in the future. FIXED.
/dev/hde8: clean, 65/489600 files, 33804/977956 blocks
/dev/hde9: recovering journal
/dev/hde9: Superblock last mount time is in the future. FIXED.
/dev/hde9: clean, 11/734400 files, 58717/1465931 blocks
/dev/hde10: recovering journal
/dev/hde10: Superblock last mount time is in the future. FIXED.
[ WARN ]10: clean, 463/9191424 files, 335105/18380368 blocks
WARNING:
File system errors were found and have been corrected. You may want to double-check that everything was fixed properly.
Remounting root file system in read-write mode...
[ OK ]on hde11, internal journal
Recording existing mounts in /etc/mtab...
mount: according to mtab, /dev/hde11 is already mounted on /
mount: according to mtab, proc is already mounted on /proc
mount: according to mtab, sysfs is already mounted on /sys
[ FAIL ]
Mounting remaining file systems...
kjournald starting. Commit interval 5 seconds
EXT3 FS on hde8, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
kjournald starting. Commit interval 5 seconds
EXT3 FS on hde9, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
kjournald starting. Commit interval 5 seconds
EXT3 FS on hde10, internal journal
[ OK ] mounted filesystem with ordered data mode.
Activating all swap files/partitions...
Adding 1959920k swap on /dev/hde6. Priority:1 extents:1 across:1959920k
[ OK ]959920k swap on /dev/hde7. Priority:1 extents:1 across:1959920k
[ OK ] file systems: /tmp /var/lock /var/run
[ FAIL ]system clock...
[ OK ] up the loopback interface...
[ OK ]hostname to freesa-0...
INIT: Entering runlevel: 3
[ OK ] system log daemon...
[ FAIL ] kernel log daemon...
Bringing up the eth0 interface...
[ WARN ]e eth0 already configured with IP 192.168.23.3.
Starting ntpd...
[ OK ]me set +286724941.584186s
[ OK ] SSH Server...
INIT: Id "3" respawning too fast: disabled for 5 minutes
INIT: Id "1" respawning too fast: disabled for 5 minutes
INIT: Id "4" respawning too fast: disabled for 5 minutes
INIT: Id "2" respawning too fast: disabled for 5 minutes
INIT: Id "6" respawning too fast: disabled for 5 minutes
INIT: Id "5" respawning too fast: disabled for 5 minutes
INIT: no more processes left in this runlevel
Initially had problems with /dev/hde11 does not existing, which was perfectly reasonable as we hadn't set up udev yet. Maybe we should SetupUdevForSsbl ... also BusyBox's mdev applet seems to be useful.
just like the man says, /sbin/chroot needs to be in the same location in both systems.
And now we log in from remote ....
halle:~ eric$ ssh -A 192.168.23.3 Last login: Sat Jan 1 01:09:37 2000 from 192.168.23.2 eric:~$ uname -a Linux freesa-0 2.6.23.16-nb6eric #1 Mon Jan 19 00:56:34 CET 2009 mips Broadcom BCM3302 V0.6 Broadcom BCM47xx GNU/Linux eric:~$ cat /proc/cpuinfo system type : Broadcom BCM47xx processor : 0 cpu model : Broadcom BCM3302 V0.6 BogoMIPS : 262.14 wait instruction : yes microsecond timers : yes tlb_entries : 32 extra interrupt vector : no hardware watchpoint : no ASEs implemented : VCED exceptions : not available VCEI exceptions : not available eric:~$
And do the happy dance!
Blindly following the steps Brett extracted from the OpenWRT build processs:
bob:~/openwrt$ ./trx -o freesa-suicide0.trx -f lzma-loader/loader.gz -f /usr/src/kernel/linux/vmlinux.lzma -a 1024 -f ssbl.squashfs -a 0x10000 -A fs_mark mjn3's trx replacement - v0.81.1 bob:~/openwrt$ ls -ltr freesa-suicide0.trx -rw-rw-r-- 1 bob bob 1380352 2009-02-03 12:00 freesa-suicide0.trx bob:~/openwrt$
Then we flash it to the device:
eric@ijmac:/home/clfs/boot$ tftp tftp> bin tftp> connect 192.168.1.1 tftp> put freesa-suicide0.trx Sent 1380352 bytes in 1.7 seconds tftp> quit eric@ijmac:/home/clfs/boot$
And see that it is written:
Failed.: Timeout occured Reading :: TFTP Server. TFTP_BLKLEN!! Done. 1380352 bytes read Download of 0x151000 bytes completed Write kernel and filesystem binary to FLASH (0xbfc40000) flash device 'flash1.trx' Programming... done. 1380352 bytes written
Then we reboot the router. It did load the kernel, however, it gave "Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)" ... since it lacks driver for the mtd block device, we probably need to include more mtd stuff in our config.
We didn't even get to the point where it could try to un-lzma the SSBL in the flash using SquashFS-LZMA 3.4-457 .
Tried some different config options, got the same results.
Failed.: Timeout occured
Reading :: TFTP Server.
TFTP_BLKLEN!!
Done. 987136 bytes read
Download of 0xf1000 bytes completed
Write kernel and filesystem binary to FLASH (0xbfc40000)
flash device 'flash1.trx'
Programming...
done. 987136 bytes written
CFE version 1.0.37 for BCM947XX (32bit,SP,LE)
Build Date: ¥| 12¤ë 29 20:36:58 CST 2005 (root@localhost.localdomain)
Copyright (C) 2000,2001,2002,2003 Broadcom Corporation.
Initializing Arena
Initializing Devices.
et0: Broadcom BCM47xx 10/100 Mbps Ethernet Controller 3.90.23.0
rndis0: Broadcom USB RNDIS Network Adapter (P-t-P)
CPU type 0x29006: 264MHz
Total memory: 67108864 KBytes
Total memory used by CFE: 0x80800000 - 0x8089BA00 (637440)
Initialized Data: 0x80831B70 - 0x80834250 (9952)
BSS Area: 0x80834250 - 0x80835A00 (6064)
Local Heap: 0x80835A00 - 0x80899A00 (409600)
Stack Area: 0x80899A00 - 0x8089BA00 (8192)
Text (code) segment: 0x80800000 - 0x80831B70 (203632)
Boot area (physical): 0x0089C000 - 0x008DC000
Relocation Factor: I:00000000 - D:00000000
Device eth0: hwaddr 00-17-31-2A-90-0B, ipaddr 192.168.1.1, mask 255.255.255.0
gateway not set, nameserver not set
Null Rescue Flag.
Null Restore Flag.
set pivot_wait = 0
Loader:raw Filesys:raw Dev:flash0.os File: Options:(null)
Loading: .. 4092 bytes read
Entry at 0x80001000
Closing network.
Starting program at 0x80001000
CFE-console: Serial init done.
Linux version 2.6.23.16-fb7eric (kernel@192.168.23.4) (gcc version 4.3.0 (GCC) ) #1 Wed May 19 21:12:08 CEST 2010
CPU revision is: 00029006
ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x03, vendor 0x4243)
ssb: Core 1 found: Fast Ethernet (cc 0x806, rev 0x06, vendor 0x4243)
ssb: Core 2 found: Fast Ethernet (cc 0x806, rev 0x06, vendor 0x4243)
ssb: Core 3 found: USB 1.1 Hostdev (cc 0x808, rev 0x02, vendor 0x4243)
ssb: Core 4 found: PCI (cc 0x804, rev 0x08, vendor 0x4243)
ssb: Core 5 found: MIPS 3302 (cc 0x816, rev 0x00, vendor 0x4243)
ssb: Core 6 found: V90 (cc 0x807, rev 0x02, vendor 0x4243)
ssb: Core 7 found: IPSEC (cc 0x80B, rev 0x00, vendor 0x4243)
ssb: Core 8 found: MEMC SDRAM (cc 0x80F, rev 0x00, vendor 0x4243)
ssb: Initializing MIPS core...
ssb: set_irq: core 0x0806, irq 2 => 2
ssb: set_irq: core 0x0806, irq 3 => 3
ssb: set_irq: core 0x0804, irq 0 => 4
ssb: Sonics Silicon Backplane found at address 0x18000000
Determined physical RAM map:
memory: 04000000 @ 00000000 (usable)
Built 1 zonelists in Zone order. Total pages: 16256
Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs init=/sbin/init noinitrd console=ttyS0,115200
Primary instruction cache 16kB, physically tagged, 2-way, linesize 16 bytes.
Primary data cache 16kB, 2-way, linesize 16 bytes.
Synthesized TLB refill handler (21 instructions).
Synthesized TLB load handler fastpath (33 instructions).
Synthesized TLB store handler fastpath (33 instructions).
Synthesized TLB modify handler fastpath (32 instructions).
PID hash table entries: 256 (order: 8, 1024 bytes)
Using 132.000 MHz high precision timer.
console [ttyS0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 62212k/65536k available (2027k kernel code, 3264k reserved, 300k data, 104k init, 0k highmem)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Time: MIPS clocksource has been installed.
ssb: PCIcore in host mode found
Registering a PCI bus after boot
PCI: Fixing up bridge 0000:00:00.0
PCI: Fixing up device 0000:00:00.0
PCI: Fixing latency timer of device 0000:00:00.0 to 168
PCI: Enabling device 0000:00:01.0 (0000 -> 0002)
PCI: Fixing up device 0000:00:01.0
ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x0D, vendor 0x4243)
ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x09, vendor 0x4243)
ssb: Core 2 found: PCI (cc 0x804, rev 0x0C, vendor 0x4243)
ssb: Core 3 found: PCMCIA (cc 0x80D, rev 0x07, vendor 0x4243)
ssb: Sonics Silicon Backplane found on PCI device 0000:00:01.0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
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.
io scheduler noop registered
io scheduler deadline registered (default)
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing enabled
serial8250: ttyS0 at MMIO 0x0 (irq = 3) is a 16550A
serial8250: ttyS1 at MMIO 0x0 (irq = 3) is a 16550A
b44.c:v1.01 (Jun 16, 2006)
eth0: Broadcom 10/100BaseT Ethernet 00:17:31:2a:90:0b
eth1: Broadcom 10/100BaseT Ethernet 40:10:18:00:00:2c
flash init: 0x1c000000 0x02000000
Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
Physically mapped flash: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
Flash device: 0x200000 at 0x1fc00000
bootloader size: 262144
Updating TRX offsets and length:
old trx = [0x0000001c, 0x00000974, 0x000b9c00], len=0x000f1000 crc32=0x0b009a9c
new trx = [0x0000001c, 0x00000974, 0x000b9c00], len=0x000b9c00 crc32=0x2ae3c4e1
Done
Creating 4 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "cfe"
0x00040000-0x001f0000 : "linux"
0x000f9c00-0x001f0000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
mtd: partition "rootfs" set to be root filesystem
mtd: partition "rootfs_data" created automatically, ofs=120000, len=D0000
0x00120000-0x001f0000 : "rootfs_data"
0x001f0000-0x00200000 : "nvram"
gpiodev: gpio device registered with major 254
gpiodev: gpio platform device registered with access mask FFFFFFFF
nf_conntrack version 0.5.0 (1024 buckets, 4096 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>
List of all partitions:
1f00 256 mtdblock0 (driver?)
1f01 1728 mtdblock1 (driver?)
1f02 985 mtdblock2 (driver?)
1f03 832 mtdblock3 (driver?)
1f04 64 mtdblock4 (driver?)
No filesystem could mount root, tried: squashfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
Two notable differences between the believed good OpenWRT kernel config and config-2.6.23.16-fb7eric are:
1. the OpenWRT kernel is for 2.6.23 not 2.6.23.16
2. the OpenWRT config has initrd support on (even though we're saying noinitrd) ... but this gave me compile errors about invalid option to lzma, so I turned it off.
See Also: nfs How-To: Setting Up an NFS Server
In order to support NetworkBooting we need to have tftp for the kernel, and NFS for the root filesystem. Until we build one of our own, we'll use a debian one pre-built for mips.
We need/etc/exports, /etc/hosts.allow, /etc/hosts.deny We want to build the NFS utility software from source and we are using a Linux machine. Right? Good.
The NFS utilities per se are easy to build and install for Linux. Unfortunately, NFS also relies on the RPC Portmapper, and there is no version of that program that is easy to build on modern Linux systems. Bleah. The version I suggest is the one from porcupine.org, which unfortunately needs a patch to build, and also depends on the TCP wrappers package, which is also not easy to build on modern Linux systems and requires a patch to build.
(more details to follow)
tar xvfp debian-mipsel-2007-Apr-17.tar.bz2 ('-p' to retain privileges) /tmp/fsanfs 192.168.236.0/255.255.255.0(rw,no_root_squash)
portmap:192.168.236.0/255.255.255.0 lockd:192.168.236.0/255.255.255.0 rquotad:192.168.236.0/255.255.255.0 mountd:192.168.236.0/255.255.255.0 statd:192.168.236.0/255.255.255.0
portmap rpc.mountd rpc.nfsd rpc.statd rpc.lockd rpc.rquotad
To tell nfsd that it should check again with /etc/exports you may need to run
exportfs -raThe debian root filesystem is not a built environment out of the box:
asus-debian:~# ./version-check.sh Linux asus-debian 2.6.19.2 #3 Fri Apr 27 22:44:55 CEST 2007 mips GNU/Linux bash, version 3.1.17(1)-release Binutils: ./version-check.sh: line 8: ld: command not found ./version-check.sh: not found Coreutils: 5.97 diff (GNU diffutils) 2.8.1 GNU find version 4.2.28 GNU Awk 3.1.5 ./version-check.sh: line 14: gcc: command not found GNU C Library stable release version 2.3.6, grep (GNU grep) 2.5.1 gzip 1.3.5 ./version-check.sh: line 18: make: command not found ./version-check.sh: line 19: patch: command not found GNU sed version 4.1.5 tar (GNU tar) 1.16 asus-debian:~#
When the kernel prints out this message:
hde: hde1 < hde5 hde6 hde7 hde8 hde9 hde10 hde11 >
That indicates that it has a device driver that is prepared to access the internal hard disk as a block device, and it knows about the partitions. That's good!
However, a userspace program that wants to access one of those devices, say for example "mount," needs to access the device using a node file like /dev/hde11 (because that's how device drivers in UNIX systems are invoked, by accessing node files. Well, or running ioctls. Never mind about that.)
We can either create /dev/hde11 ourselves, manually; or we can use udev. Udev is awesome, and we have to set it up for the final system anyway, so maybe it would be a good idea to include it in ssbl as well.
The way udev works is: you start a daemon called udevd, which listens for "netlink uevents" from the kernel driver core...these events are apparently dispatched over a UNIX domain socket. Looking at the udev man pages (got the udev source handy? look in $UDEV_SOURCE_DIR/udev for the man pages udev.7, udevadm.8, udevd.8), it looks like the process we want is something like:
Looking at the udev readme, we need to ensure that the kernel has sysfs, unix domain sockets, and networking all enabled. /proc and /sys have to be mounted with those specific names. These group names must exist in the SSBL /etc/group:
disk cdrom floppy tape audio video lp tty dialout kmem
...probably it would be a good idea for you to stop reading this page and go read the udev readme and man pages...so to encourage you to do this, I shall stop writing.
Here's how to get an SSL client certificate that this site can use to authenticate you. This walkthrough assumes you're using the OpenSSL program (available from http://www.openssl.org).
First, use the OpenSSL program to generate a key and certificate signing request:
openssl req -newkey rsa:2048 -out yourname.csr
You'll be prompted for several items of information that are used to identify who and where you are -- country code, state or province, etc. The most important one is the "Common Name" field, for which you should enter your desired freesa.org user name. Also important is the email address field, because that's where the signed certificate will be sent.
That command will eventually produce two files: privkey.pem and yourname.csr. Keep the privkey.pem file! You will need it once you have a signed certificate. Email the yourname.csr file to brett@freesa.org.
Eventually, Brett will send you a certificate file called something like yourname.crt. You need to combine this with privkey.pem and the CA certificate attached to the front page to produce a PKCS#12 file that you can import into your browser -- then, when you access this site using HTTPS, your browser will send the client certificate as part of the SSL handshake, and the server will use the common name from that certificate as your authenticated userid.
Once you have all three files in one place, you can turn them into a PKCS#12 file with:
cat privkey.pem yourname.crt ca-cert.pem | openssl pkcs12 -export -nodes -out clientcert.p12 -name "SSL client key"
The way to import this into your web browser depends on the browser and version you're using. In Firefox 3.0, you can open up Firefox Preferences and click the Advanced icon, Encryption tab. Click the View Certificates button to open the Certificate Manager. Now:
Authorities tab, click Import and navigate to wherever you've saved the ca-cert.pem file. Import it. You can decide for yourself what (if anything) you trust the certificate to verify.Your Certificates tab, click Import and navigate to wherever you've saved clientcert.p12. Import it. If you specified an export password in the openssl pkcs12 command, you'll need to enter it again during the import.Before Trac 0.11, it was only possible to define fine-grained permissions checks on the repository browser sub-system.
Since 0.11, there's a general mechanism in place that allows custom permission policy plugins to grant or deny any action on any kind of Trac resources, even at the level of specific versions of such resources.
trac.ini:[trac] ... permission_policies = AuthzPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy [authz_policy] authz_file = /some/trac/env/conf/authzpolicy.conf [components] ... authz_policy = enabled
Note that the order in which permission policies are specified is quite critical,
as policies will be examined in the sequence provided.
A policy will return either True, False or None for a given permission check.
Only if the return value is None will the next permission policy be consulted.
If no policy explicitly grants the permission, the final result will be False
(i.e. no permission).
authz_file contains:WikiStart@* * = WIKI_VIEW PrivatePage@* john = WIKI_VIEW * =
john WIKI_VIEW jack WIKI_VIEW # anonymous has no WIKI_VIEW
Then:
- All versions of WikiStart will be viewable by everybody (including anonymous)
- PrivatePage will be viewable only by john
- other pages will be viewable only by john and jack
At the time of this writing, the old fine grained permissions system from Trac 0.10 and before used for restricting access to the repository has not yet been converted to a permission policy component, but from the user point of view, this makes little if no differences.
That kind of fine-grained permission control needs a definition file, which is the one used by Subversion's mod_authz_svn.
More information about this file format and about its usage in Subversion is available in the Subversion Book.
[/] * = r [/branches/calc/bug-142] harry = rw sally = r [/branches/calc/bug-142/secret] harry =
<pre> [trac] authz_file = /path/to/svnaccessfile </pre> if you want to support the use of the @[@_modulename_@:/@_some_@/@_path_@]@ syntax within the @authz_file@, add <pre> authz_module_name = modulename </pre> where _modulename_ refers to the same repository indicated by the @repository_dir@ entry in the @[trac]@ section. *Note:* Usernames inside the Authz file +must+ be the same as those used inside trac. h4. Subversion Configuration The same access file is typically applied to the corresponding Subversion repository using an Apache directive like this: <pre> <Location /repos> DAV svn SVNParentPath /usr/local/svn # our access control policy AuthzSVNAccessFile /path/to/svnaccessfile </Location> </pre> For information about how to restrict access to entire projects in a multiple project environment see [trac:wiki:TracMultipleProjectsSVNAccess] ---- See also: TracPermissions
Information about trac¶
For a complete list of local wiki pages, see TitleIndex.
Trac is brought to you by Edgewall Software,
providing professional Linux and software development services to clients
worldwide. Visit http://www.edgewall.com/ for more information.
Starting with Trac 0.11, it is now possible to customize the main and meta navigation entries in some basic ways.
The new [mainnav] and [metanav] configuration sections can now be used to customize the text and link used for the navigation items, or even to disable them.
[mainnav] corresponds to the main navigation bar, the one containing entries such as Wiki, Timeline, Roadmap, Browse Source and so on. This navigation bar is meant to access the default page of the main modules enabled in Trac and accessible for the current user.
[metanav] corresponds to the meta navigation bar, by default positioned above the main navigation bar and below the Search box. It contains the Log in, Logout, Help/Guide etc. entries. This navigation bar is meant to access some global information about the Trac project and the current user.
Note that it is still not possible to customize the contextual navigation bar, i.e. the one usually placed below the main navigation bar.
In the following example, we rename the link to the Wiki start "Home", and hide the "Help/Guide" link.
We also make the "View Tickets" entry link to a specific report.
[mainnav] wiki.label = Home tickets.href = /report/24 [metanav] help = disabled
----
See also: TracInterfaceCustomization, the TracHacks:NavAddPlugin (still needed for adding entries)
The Trac issue database provides a configurable workflow.
trac-admin <env> upgrade, your trac.ini will be modified to include a [ticket-workflow] section.Graphically, that looks like this:
../common/guide/original-workflow.png)
There are some significant "warts" in this; such as accepting a ticket sets it to 'assigned' state, and assigning a ticket sets it to 'new' state. Perfectly obvious, right?
So you will probably want to migrate to "basic" workflow; contrib/workflow/migrate_original_to_basic.py may be helpful.
When a new environment is created, a default workflow is configured in your trac.ini. This workflow is the basic workflow (described in basic-workflow.ini), which is somewhat different from the workflow of the 0.10 releases.
Graphically, it looks like this:
../common/guide/basic-workflow.png)
There are several example workflows provided in the Trac source tree; look in contrib/workflow for .ini config sections. One of those may be a good match for what you want. They can be pasted into the [ticket-workflow] section of your trac.ini file.
[ticket-workflow] section in trac.ini.accept action from simple-workflow.ini:accept = new,accepted -> accepted accept.permissions = TICKET_MODIFY accept.operations = set_owner_to_self
accept action, along with the states the action is valid in (new and accepted), and the new state of the ticket when the action is taken (accepted).accept.permissions line specifies what permissions the user must have to use this action.accept.operations line specifies changes that will be made to the ticket in addition to the status change when this action is taken. In this case, when a user clicks on accept, the ticket owner field is updated to the logged in user. Multiple operations may be specified in a comma separated list.
The available operations are:Example: resolve_new = new -> closed resolve_new.name = resolve resolve_new.operations = set_resolution resolve_new.permissions = TICKET_MODIFY resolve_new.set_resolution = invalid,wontfix
set_owner and del_owner) has unspecified results.
resolve_accepted = accepted -> closed resolve_accepted.name = resolve resolve_accepted.permissions = TICKET_MODIFY resolve_accepted.operations = set_resolution
In this example, we see the .name attribute used. The action here is resolve_accepted, but it will be presented to the user as resolve.
* may be used in place of the state. The obvious example is the leave action:leave = * -> * leave.operations = leave_status leave.default = 1
.default attribute. This value is expected to be an integer, and the order in which the actions are displayed is determined by this value. The action with the highest .default value is listed first, and is selected by default. The rest of the actions are listed in order of decreasing .default values..default is 0. The value may be negative.
There are a couple of hard-coded constraints to the workflow. In particular, tickets are created with status new, and tickets are expected to have a closed state. Further, the default reports/queries treat any state other than closed as an open state.
While creating or modifying a ticket workfow, contrib/workflow/workflow_parser.py may be useful. It can create .dot files that GraphViz understands to provide a visual description of the workflow.
cd /var/local/trac_devel/contrib/workflow/ sudo ./showworkflow /srv/trac/PlannerSuite/conf/trac.ini
trac.pdf file created by the script (it will be in the same directory as the trac.ini file).
After you have changed a workflow, you need to restart apache for the changes to take effect. This is important, because the changes will still show up when you run your script, but all the old workflow steps will still be there until the server is restarted.
By adding the following to your [ticket-workflow] section of trac.ini you get optional testing. When the ticket is in new, accepted or needs_work status you can choose to submit it for testing. When it's in the testing status the user gets the option to reject it and send it back to needs_work, or pass the testing and send it along to closed. If they accept it then it gets automatically marked as closed and the resolution is set to fixed. Since all the old work flow remains, a ticket can skip this entire section.
testing = new,accepted,needs_work -> testing testing.name = Submit to reporter for testing testing.permissions = TICKET_MODIFY reject = testing -> needs_work reject.name = Failed testing, return to developer pass = testing -> closed pass.name = Passes Testing pass.operations = set_resolution pass.set_resolution = fixed
The above resolve_new operation allows you to set the possible resolutions for a new ticket. By modifying the existing resolve action and removing the new status from before the -> we then get two resolve actions. One with limited resolutions for new tickets, and then the regular one once a ticket is accepted.
resolve_new = new -> closed resolve_new.name = resolve resolve_new.operations = set_resolution resolve_new.permissions = TICKET_MODIFY resolve_new.set_resolution = invalid,wontfix,duplicate resolve = assigned,accepted,reopened -> closed resolve.operations = set_resolution resolve.permissions = TICKET_MODIFY
If the customization above is not extensive enough for your needs, you can extend the workflow using plugins. These plugins can provide additional operations for the workflow (like code_review), or implement side-effects for an action (such as triggering a build) that may not be merely simple state changes. Look at [trac:source:trunk/sample-plugins/workflow sample-plugins/workflow] for a few simple examples to get started.
But if even that is not enough, you can disable the ConfigurableTicketWorkflow component and create a plugin that completely replaces it.
New enhancement ideas for the workflow system should be filed as enhancement tickets against the ticket system component. If desired, add a single-line link to that ticket here.
If you have a response to the comments below, create an enhancement ticket, and replace the description below with a link to the ticket.
set_owner operation, or needs to be clarified.triage action that sets the next state based on the ticket type, so a new ticket would move to new_task, new_defect, etc., and the workflow graph would separate at that point.building the stock WL700gE from the asus sources results in the following TRX files being generated:
~/WL700g/nasoc/src/apps/mfgtest_root/mipsel/mfgtest_root.trx ~/WL700g/nasoc/src/apps/mipsel/WL700gE_1.0.4.6.trx ~/WL700g/nasoc/src/apps/mipsel/broadnas.trx ~/WL700g/nasoc/src/apps/mipsel/root.trx ~/WL700g/nasoc/src/apps/pivot_root/mipsel/pivot_root.trx ~/WL700g/nasoc/image/pivot_root.trx ~/WL700g/nasoc/image/backup/pivot_root_1.09.trx ~/WL700g/nasoc/image/broadnas.trx
I thought it might be worth looking at the pivot_root.trx just to see if that is intended to pivot to the hard drive for the new root filesystem.
We plan to to inspect the TRX images from the OpenWRT project and from the Asus firmware image to see what they contain.
Then we're going to build a new linux kernel, and whatever else needs to be in a TRX image, install it on our hacked-up router units using TFTP, and see how it works.
Progress will appear on HighLevelPlan if and when there is progress.
Because we will abandon pure built-from-source software only if we see no other option.
done
in progress
shouldn't be a problem!
Possibly-handy links:
http://www.bitsum.com/firmware_mod_kit.htm
http://wl700g.homelinux.net/drupal/
Our initial target device: the ASUS WL-700gE.
See also:As described elsewhere, one of the primary intended results of the FreeSA project is a tutorial book that describes the entire process of constructing the FreeSA distribution, so that it's easier for other people to do the same sort of thing with different hardware. The goal is to have something kind of like Linux From Scratch, but with more explanatory text about, for example, what's going on when building a cross-toolchain; and more focused on the particular platform we are using.
Ideally, someone who is reasonably familiar with Linux should be able to pick up the FreeSA book, read it, and understand the entire process of setting up the system enough that none of it seems like black sorcery any longer -- without having to figure out any arcane build processes or read three dozen Makefiles or anything like that. Because Random really likes printed output, he's keen to have one of the output formats for the book be an actual book, nicely typeset and everything. Eric likes things to be accessible over the web, so he's more enthusiastic about HTML or XHTML as an output format.
Since we also want to automate the entire process of constructing a FreeSA system, as much as possible, it would be great if the source files for the book were in some sort of literate programming-style form that could be mechanically transformed into a set of scripts that actually do the work of constructing a FreeSA system. One important reason to automate the process is to make keeping the book up to date more feasable; it is important to lower the effort to test the combined build as various packages are updated over time.
And, of course, since we are lazy, we'd like it to be as easy as possible to write the actual book, with a source format that doesn't get in our way or require us to learn anything new.
Formerly, we had discussed a number of possible ways to achieve these goals. Nowadays, we are pretty firmly committed to using the litbuild system. Litbuild takes simple package and section description files and either transforms them into a readable document or executes an automated build from the instructions contained in the description files. Or, at least, that is the plan.
These are the CAs installed by default in Firefox 2:
Rumor has it that Microsoft Internet Explorer comes stock with 98 trusted root cert authorities. We don't use Internet Explorer, so we haven't confirmed that for ourselves, though.
FreeSA is the name of our project to transform the Asus WL-700gE multi-router into a completely Free (as in "free software") Server Appliance.
This is a work in progress; please add useful information! (You may wish to login).