To compile OpenWRT you will need the following Software:
On a Debian "etch" system you can install these packets with the following command:
aptitude install build-essential binutils patch bzip2 flex bison \
gettext pkg-config unzip zlib1g-dev libncurses5-dev libstring-crc32-perl
Additionally you will need the Subversion client, which you can install with this command:
aptitude install subversion
You get the source code to OpenWRT from the OpenWRT SVN trunk with this command:
svn co -r 9340 https://svn.openwrt.org/openwrt/trunk openwrt
After this you should have a folder with the name "openwrt" in the current directory. Change into this directory and patch the source code with the FRITZ!WRT patches:
cd openwrt wget -q -O - http://code.bastart.eu.org.nyud.net/files/ar7-atm-module-params.patch | patch -p0 wget -q -O - http://code.bastart.eu.org.nyud.net/files/ar7-fritz-eva-loader.patch | patch -p0 wget -q -O - http://code.bastart.eu.org.nyud.net/files/ar7-fritz-gpio-leds.patch | patch -p0 wget -q -O - http://code.bastart.eu.org.nyud.net/files/ar7-fritz-reduce-flash-size.patch | patch -p0
You now have a fully patched copy of the OpenWRT source code.
Because you now have a working copy of the OpenWRT source code, you can configure it with this command:
make menuconfig
Here you should select "TI AR7 [2.6]" as the "Target System" and select "No WiFi" as the "Target Profile".
Under "Target Images" you only need "squashfs" and the rest can be removed.
Additionally you should select kmod-sangam-atm-annex-b under "Kernel modules" | "Network Devices" for the DSL support.
The rest of the configuration is up to you.
Now exit the menu with Exit and choose "Yes" at the question asking you if the configuration should be saved.
You now have a file with the name .config in your working copy directory. You can make a backup of this file so you can restore it later.
If you restore the configuration, don't forget this command:
make oldconfig
After you configured the working copy, you can start the compilation with this command:
make
or for users that are like me and like to see many messages because they wouldn't believe something is going on otherwise:
make V=99
Now go get a coffee or something similar because the compilation will take some time depending on your computers speed because the complete toolchain (gcc, binutils, libc, etc...) is being compiled.
Finally, after long waiting, you can install the firmware. The required version is in the directory "bin".
The relevant files for the FRITZ!Box are the following:
openwrt-ar7-2.6-squashfs.bin - ADAM2
openwrt-EVA-2.6-squashfs.bin - EVA
The former is for FRITZ!Boxes with the ADAM2 bootloader (I didn't test this) while the latter is for FRITZ!Boxes with the EVA bootloader.
The difference is that the ADAM2 version has its own LZMA loader, while the EVA version only has the EVA header because the loader can decompress LZMA and start the kernel by itself.
You can now use FRITZ!Flash to flash the firmware onto your box:
~/fritz-flash -f bin/openwrt-EVA-2.6-squashfs.bin
In case you have the variable "kernel_args" set in your bootloader, you will have to modify it with this command:
setenv kernel_args init=/etc/preinit
The bootlog of the firmware over the serial port should now approximately look like this:
(AVM) EVA Revision: 1.136 Version: 1136
(C) Copyright 2005 AVM Date: Feb 2 2006 Time: 12:38:21 (1) 2 0-1111
[FLASH:] MACRONIX Top-MirrorBit-Flash 8MB 32 Bytes WriteBuffer
[FLASH:](Eraseregion [0] 127 sectors a 64kB)
[FLASH:](Eraseregion [1] 8 sectors a 8kB)
[SYSTEM:] OHIO on 211MHz/125MHz
Eva_AVM >
AVM decompress Kernel:
.................done
start kernel
Linux version 2.6.22.4 (ago@agovm) (gcc version 4.1.2) #21 Wed Aug 29 08:10:46 EDT 2007
CPU revision is: 00018448
Clocks: Async mode
Clocks: Setting DSP clock
Clocks: base = 25000000, frequency = 125000000, prediv = 1, postdiv = 2, postdiv2 = 1, mul = 10
Clocks: Setting CPU clock
Adjusted requested frequency 211000000 to 211968000
Clocks: base = 35328000, frequency = 211968000, prediv = 1, postdiv = 1, postdiv2 = -1, mul = 6
Clocks: Setting USB clock
Adjusted requested frequency 48000000 to 48076920
Clocks: base = 125000000, frequency = 48000000, prediv = 13, postdiv = 1, postdiv2 = -1, mul = 5
TI AR7 (TNETD7200), ID: 0x002b, Revision: 0x11
Determined physical RAM map:
memory: 02000000 @ 14000000 (usable)
Built 1 zonelists. Total pages: 8128
Kernel command line: init=/etc/preinit console=ttyS0,38400n8r
Primary instruction cache 16kB, physically tagged, 4-way, linesize 16 bytes.
Primary data cache 8kB, 4-way, linesize 16 bytes.
Synthesized TLB refill handler (20 instructions).
Synthesized TLB load handler fastpath (32 instructions).
Synthesized TLB store handler fastpath (32 instructions).
Synthesized TLB modify handler fastpath (31 instructions).
PID hash table entries: 128 (order: 7, 512 bytes)
Using 105.984 MHz high precision timer.
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 28804k/32768k available (2026k kernel code, 3964k reserved, 406k data, 104k init, 0k highmem)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
vlynq0: regs 0x08611800, irq 29, mem 0x04000000
Generic PHY: Registered new driver
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: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
squashfs: version 3.0 (2006/03/15) Phillip Lougher
Registering mini_fo version $Id$
JFFS2 version 2.2. (NAND) (c) 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered (default)
ar7_wdt: timer margin 59 seconds (prescale 65535, change 57180, freq 62500000)
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x8610e00 (irq = 15) is a TI-AR7
console handover: boot [early0] -> real [ttyS0]
Fixed PHY: Registered new driver
cpmac-mii: probed
cpmac: device eth0 (regs: 08610000, irq: 27, phy: fixed@100:1, mac: 00:15:0c:fc:06:25)
physmap platform flash device: 00400000 at 10000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
NOR chip too large to fit in mapping. Attempting to cope...
Amd/Fujitsu Extended Query Table at 0x0040
physmap-flash.0: Swapping erase regions for broken CFI table.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
Reducing visibility of 8192KiB chip to 4096KiB
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Parsing AR7 partition map...
4 ar7part partitions found on MTD device physmap-flash.0
Creating 4 MTD partitions on "physmap-flash.0":
0x00000000-0x00010000 : "loader"
0x003f0000-0x00400000 : "config"
0x00010000-0x003f0000 : "linux"
0x000e0000-0x003f0000 : "rootfs"
mtd: partition "rootfs" set to be root filesystem
mtd: partition "rootfs_data" created automatically, ofs=1B0000, len=240000
0x001b0000-0x003f0000 : "rootfs_data"
Registered led device: ar7:status
Registered led device: avm:led0
Registered led device: avm:led1
Registered led device: avm:led2
Registered led device: avm:led3
Registered led device: avm:led4
nf_conntrack version 0.5.0 (256 buckets, 2048 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: 104k freed
Warning: unable to open an initial console.
Algorithmics/MIPS FPU Emulator v1.5
mini_fo: using base directory: /
mini_fo: using storage directory: /jffs
init started: BusyBox v1.4.2 (2007-08-28 10:02:21 EDT) multi-call binary
Please press Enter to activate this console. device eth0 entered promiscuous mode
br-lan: port 1(eth0) entering learning state
br-lan: topology change detected, propagating
br-lan: port 1(eth0) entering forwarding state
NET: Registered protocol family 8
NET: Registered protocol family 20
PHY: fixed@100:1 - Link is Up - 10/Half
registered device TI Avalanche SAR
Ohio250(7200/7100A2) detected
requesting firmware image "ar0700xx.bin"
Creating new root folder avalanche in the proc for the driver stats
Texas Instruments ATM driver: version:[7.02.01.00]
device nas0 entered promiscuous mode
br-lan: port 2(nas0) entering learning state
br-lan: topology change detected, propagating
br-lan: port 2(nas0) entering forwarding state
BusyBox v1.4.2 (2007-08-28 10:02:21 EDT) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| F r i t z ! B o x F R E E D O M
---------------------------------------------------
root@fritz:/#
I wish you much joy with your newly installed FRITZ!WRT system!
Axel Gembe