Dlink Dir825B1 - freebsd/freebsd-wifi-build GitHub Wiki

FreeBSD on the D-Link DIR-825B1.

Introduction

This is an AR7161 based design based on the Atheros AP94 reference with dual AR922x wireless chips.

It uses a Realtek ethernet switch rather than the AR8216 switch.

Building firmware

$ cd /path/to/freebsd/src
$ /path/to/build/bin/build dir825b1

Uploading firmware

  • Configure your laptop as 192.168.0.100/24
  • Hold down the reset button on the DIR-825B1 and power-on
  • wait 30 seconds; verify you can ping 192.168.0.1
  • Visit http://192.168.0.1/ in firefox (not Chrome!)
  • Upload /tftpboot/dir825.factory.img

If you added a serial console, you'll see the device receive the file, verify the filetype (but not the size, sigh) and write it to the device.

It will then reboot into FreeBSD.

Default boot

  • bridge0 - 192.168.1.20/24
  • bridge0 only has arge0, so you should plug into the WAN port (or LAN port, maybe I have these instructions backwards..)
  • telnet -K 192.168.1.20, login as user with no password; su to root with no password.

Current Issues

The ART block and rootfs sizes are wrong. I'll fix that shortly

The ART block has rather invalid looking MAC addresses for ath0 (2GHz.) This breaks (at least) encryption. To work around it until the driver/boot framework is taught about where D-Link put their system MACs:

ifconfig ath0 mac (good MAC)
ifconfig wlan0 create wlandev ath0 wlanmode hostap bssid (good mac)
(then set channel, ssid, start hostapd, etc.)

The ART block is not at the end of the flash. There's some unused space in the flash. I'll see about trying to automate 'shifting' the ART block to the end of the flash but I'm not sure if the uboot code reads anything from the ART block.

Further information

  • [http://wiki.openwrt.org/toh/d-link/dir-825]

Example boot messages

U-Boot 1.1.4 (Aug  6 2009 - 09:20:15)

AP94 (ar7100) U-boot 0.0.12
HTTP-UID AP94: DRAM:  b8050000: 0xc0140180
64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 214k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
ar7100 flash_init: start
ar7100_spi_flash_unblock: start
ar7100_flash: id read: start
flash size 8MB, sector count = 128
Flash:  8 MB
Using default environment

BOARD IS NOT CALIBRATED!!!
In:    serial
Out:   serial
Err:   serial
Net:   eth_initialize: ag7100_enet_initialize
ar7100 : No valid address in Flash. Using fixed address
rtl8366sr_phy_setup  ethUnit=0
ar7100.c: eth0 using default MAC: 00:03:7f:09:72:10
eth0 up
ar7100 : No valid address in Flash. Using fixed address
ar7100.c: eth1 using default MAC: 00:03:7f:09:72:11
eth1 up
eth0, eth1
### main_loop entered: bootdelay=1

### main_loop: bootcmd="bootm 0xbf050000"
Hit any key to stop autoboot:  0 
### main_loop: no key string, allow autoboot
### main_loop: abortboot
## Booting image at bf050000 ...
checksum:243f51a7
   Image Name:   FreeBSD
   Image Type:   MIPS Linux Kernel Image (lzma  compressed)
   Data Size:    961361 Bytes = 938.8 kB
   Load Address: 80050000
   Entry Point:  80050100
   Verifying Checksum ... OK
   LZMA Umcompressing Kernel Image ...    Image loaded from 80050000-80412644
 OK
   Boot image os 5=IH_OS_LINUX
## do_bootm_linux start....
No initrd
## Transferring control to Linux (at address 80050100) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

CPU platform: Atheros AR7161 rev 2
CPU Frequency=680 MHz
CPU DDR Frequency=340 MHz
CPU AHB Frequency=170 MHz
platform frequency: 680000000
arguments: 
  a0 = 00000007
  a1 = a3f77fb0
  a2 = a3f78460
  a3 = 00000008
Cmd line:argv is invalid
Environment:
envp is invalid
Cache info:
  picache_stride    = 4096
  picache_loopcount = 16
  pdcache_stride    = 4096
  pdcache_loopcount = 8
cpu0: MIPS Technologies processor v116.147
  MMU: Standard TLB, 16 entries
  L1 i-cache: 4 ways of 512 sets, 32 bytes per line
  L1 d-cache: 4 ways of 256 sets, 32 bytes per line
  Config1=0x9ee3519e<PerfCount,WatchRegs,MIPS16,EJTAG>
  Config3=0x20
Physical memory chunk(s):
0x4c6000 - 0x3ffffff, 62103552 bytes (15162 pages)
Maxmem is 0x4000000
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-CURRENT #8 r239569:239768M: Wed Dec 31 16:00:00 PST 1969
    adrian@dummy:/home/adrian/work/freebsd/svn/obj/mipseb/mips.mips/usr/home/adrian/work/freebsd/svn/src/sys/DIR-825 mips
WARNING: WITNESS option enabled, expect reduced performance.
MEMGUARD DEBUGGING ALLOCATOR INITIALIZED:
        MEMGUARD map base: 0xc0400000
        MEMGUARD map limit: 0xc6a67000
        MEMGUARD map size: 104860 KBytes
Preloaded elf kernel "kernel" at 0x804bad9c.
real memory  = 67108864 (65536K bytes)
Physical memory chunk(s):
0x0055a000 - 0x03e98fff, 60026880 bytes (14655 pages)
avail memory = 59289600 (56MB)
random device not loaded; using insecure entropy
mem: <memory>
null: <null device, zero device>
nexus0: <MIPS32 root nexus>
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 340000000 Hz quality 800
Event timer "MIPS32" frequency 340000000 Hz quality 800
apb0 at irq 4 on nexus0
uart0: <16550 or compatible> on apb0
uart0: fast interrupt
uart0: console (115200,n,8,1)
pcib0 at irq 0 on nexus0
pcib0: ar71xx_pci_slot_fixup: checking dev pcib0, 0/17/0
pcib0: found EEPROM at 0x1fff1000 on 0.17.0
pcib0: ar71xx_pci_fixup: flash_addr=1fff1000, cal_data=0xbfff1000
  reg: 6000, val=29168c
  reg: 6008, val=2800001
  reg: 602c, val=a095168c
  reg: 5000, val=2a168c
  reg: 5008, val=2800001
  reg: 502c, val=a095168c
  reg: 5064, val=5040cc0
  reg: 506c, val=33811
  reg: 4004, val=40073b
  reg: 4074, val=3
  reg: 4000, val=1c20000
  reg: 6034, val=44
pcib0: EEPROM firmware: 0x1fff1000 @ 4096 bytes
firmware: 'pcib.0.bus.0.17.0.eeprom_firmware' version 1: 4096 bytes loaded at 0xc6aa5000
pcib0: device EEPROM 'pcib.0.bus.0.17.0.eeprom_firmware' registered
pcib0: ar71xx_pci_slot_fixup: checking dev pcib0, 0/18/0
pcib0: found EEPROM at 0x1fff5000 on 0.18.0
pcib0: ar71xx_pci_fixup: flash_addr=1fff5000, cal_data=0xbfff5000
  reg: 6000, val=29168c
  reg: 6008, val=2800001
  reg: 602c, val=a094168c
  reg: 5000, val=2a168c
  reg: 5008, val=2800001
  reg: 502c, val=a094168c
  reg: 5064, val=5040cc0
  reg: 506c, val=33811
  reg: 4004, val=40073b
  reg: 4074, val=3
  reg: 4000, val=1c20000
  reg: 6034, val=44
pcib0: EEPROM firmware: 0x1fff5000 @ 4096 bytes
firmware: 'pcib.0.bus.0.18.0.eeprom_firmware' version 1: 4096 bytes loaded at 0xc6aa8000
pcib0: device EEPROM 'pcib.0.bus.0.18.0.eeprom_firmware' registered
pci0: <PCI bus> on pcib0
pci0: domain=0, physical bus=0
found-> vendor=0x168c, dev=0x0029, revid=0x01
        domain=0, bus=0, slot=17, func=0
        class=02-80-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0000, statreg=0x02b0, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=0
        powerspec 2  supports D0 D3  current D0
        map[10]: type Memory, range 32, base 0, size 16, memory disabled
found-> vendor=0x168c, dev=0x0029, revid=0x01
        domain=0, bus=0, slot=18, func=0
        class=02-80-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0000, statreg=0x02b0, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=0
        powerspec 2  supports D0 D3  current D0
        map[10]: type Memory, range 32, base 0, size 16, memory disabled
pci0: <network> at device 17.0 (no driver attached)
pci0: <network> at device 18.0 (no driver attached)
arge0: <Atheros AR71xx built-in ethernet interface> at mem 0x19000000-0x19000fff irq 2 on nexus0
arge0: Generating random ethernet address.
arge0: finishing attachment, phymask 0000, proxy null 
arge0: bpf attached
arge0: Ethernet address: 62:73:64:ad:58:13
arge1: <Atheros AR71xx built-in ethernet interface> at mem 0x1a000000-0x1a000fff irq 3 on nexus0
arge1: Generating random ethernet address.
arge1: finishing attachment, phymask 0000, proxy null 
arge1: bpf attached
arge1: Ethernet address: 62:73:64:94:89:b6
spi0: <AR71XX SPI> at mem 0x1f000000-0x1f00000f on nexus0
spibus0: <spibus bus> on spi0
mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
mx25l0: m25p64, sector 65536 bytes, 128 sectors
ar71xx_wdog0: <Atheros AR71XX watchdog timer> on nexus0
Device configuration finished.
Timecounters tick every 1.000 msec
lo0: bpf attached
GEOM: new disk flash/spi0
MAP: 0x40000, data=0x40000 "/dev/map/uboot"
MAP: 40000x10000, data=0x10000 "/dev/map/cfg"
MAP: 50000x100000, data=0x100000 "/dev/map/kernel"
MAP: 150000x6a0000, data=0x6a0000 "/dev/map/rootfs"
MAP: 7f0000x10000, data=0x10000 "/dev/map/art"
map/rootfs.uncompress: GEOM_ULZMA image found
map/rootfs.uncompress: 176 x 131072 blocks
MAP: No valid partition found at map/rootfs.uncompress
WARNING: WITNESS option enabled, expect reduced performance.
Trying to mount root from ufs:/dev/map/rootfs.uncompress []...
warning: no time-of-day clock registered, system time will not be set accurately
start_init: trying /sbin/init
Aug 28 06:00:25 init: login_getclass: unknown class 'daemon'
MAP: No valid partition found at md0
MAP: No valid partition found at md0
MAP: No valid partition found at md1
MAP: No valid partition found at md1
MAP: No valid partition found at md2
MAP: No valid partition found at md2
*** Populating /var ..
*** Loading configuration files ..
*** Restoring from /dev/map/cfg .. 
1+0 records in
1+0 records out
65536 bytes transferred in 3.656180 secs (17925 bytes/sec)
gunzip: (stdin): trailing garbage ignored
etc/cfg/manifest
etc/master.passwd
etc/group
etc/cfg/rc.conf
etc/cfg/hostapd.wlan0.conf
etc/cfg/hostapd.wlan1.conf
10 blocks
*** Completed.
*** setting up hostname
*** Load kernel modules
kldload: can't load bridgestp: File exists
module_register: module if_bridge already exists!
Module if_bridge failed to register: 17
kldload: can't load if_bridge: File exists
random: <entropy source, Software, Yarrow>
wlan: <802.11 Link Layer>
pci0: driver added
found-> vendor=0x168c, dev=0x0029, revid=0x01
        domain=0, bus=0, slot=17, func=0
        class=02-80-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0000, statreg=0x02b0, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=0
        powerspec 2  supports D0 D3  current D0
pci0:0:17:0: reprobing on driver added
ath0: <Atheros 9220> irq 0 at device 17.0 on pci0
ath0: Lazy allocation of 0x10000 bytes rid 0x10 type 3 at 0x10000000
ath0: ath_pci_attach: looking up firmware @ 'pcib.0.bus.0.17.0.eeprom_firmware'
ath0: ath_pci_attach: EEPROM firmware @ 0xc6aa5000
ath0: DMA setup: legacy
ath0: [HT] enabling HT modes
ath0: [HT] 2 RX streams; 2 TX streams
ath0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
ath0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
ath0: 2T2R
ath0: 11ng MCS 20MHz
ath0: MCS 0-7: 6.5Mbps - 65Mbps
ath0: MCS 8-15: 13Mbps - 130Mbps
ath0: 11ng MCS 40MHz:
ath0: MCS 0-7: 13.5Mbps - 135Mbps
ath0: MCS 8-15: 27Mbps - 270Mbps
ath0: 11ng MCS 40MHz SGI:
ath0: MCS 0-7: 15Mbps - 150Mbps
ath0: MCS 8-15: 30Mbps - 300Mbps
ath0: AR9220 mac 128.2 RF5133 phy 13.0
ath0: 2GHz radio: 0x0000; 5GHz radio: 0x00c0
ath0: Use hw queue 1 for WME_AC_BE traffic
ath0: Use hw queue 0 for WME_AC_BK traffic
ath0: Use hw queue 2 for WME_AC_VI traffic
ath0: Use hw queue 3 for WME_AC_VO traffic
ath0: Use hw queue 8 for CAB traffic
ath0: Use hw queue 9 for beacons
ath0: using multicast key search
found-> vendor=0x168c, dev=0x0029, revid=0x01
        domain=0, bus=0, slot=18, func=0
        class=02-80-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0000, statreg=0x02b0, cachelnsz=0 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=1
        powerspec 2  supports D0 D3  current D0
pci0:0:18:0: reprobing on driver added
ath1: <Atheros 9220> irq 1 at device 18.0 on pci0
ath1: Lazy allocation of 0x10000 bytes rid 0x10 type 3 at 0x10010000
ath1: ath_pci_attach: looking up firmware @ 'pcib.0.bus.0.18.0.eeprom_firmware'
ath1: ath_pci_attach: EEPROM firmware @ 0xc6aa8000
[ath] enabling AN_TOP2_FIXUP
ath1: DMA setup: legacy
ath1: [HT] enabling HT modes
ath1: [HT] 2 RX streams; 2 TX streams
ath1: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
ath1: 2T2R
ath1: 11na MCS 20MHz
ath1: MCS 0-7: 6.5Mbps - 65Mbps
ath1: MCS 8-15: 13Mbps - 130Mbps
ath1: 11na MCS 40MHz:
ath1: MCS 0-7: 13.5Mbps - 135Mbps
ath1: MCS 8-15: 27Mbps - 270Mbps
ath1: 11na MCS 40MHz SGI:
ath1: MCS 0-7: 15Mbps - 150Mbps
ath1: MCS 8-15: 30Mbps - 300Mbps
ath1: AR9220 mac 128.2 RF5133 phy 13.0
ath1: 2GHz radio: 0x0000; 5GHz radio: 0x00c0
ath1: Use hw queue 1 for WME_AC_BE traffic
ath1: Use hw queue 0 for WME_AC_BK traffic
ath1: Use hw queue 2 for WME_AC_VI traffic
ath1: Use hw queue 3 for WME_AC_VO traffic
ath1: Use hw queue 8 for CAB traffic
ath1: Use hw queue 9 for beacons
ath1: using multicast key search
*** bringing up loopback ..
*** Starting networking via /etc/rc.d/base/net
dev.ath.0.txq_mcastq_maxdepth: 512 -> 32
dev.ath.1.txq_mcastq_maxdepth: 512 -> 32
*** Interface: arge0: start
*** Interface: arge0: done
*** Interface: arge1: start
*** Interface: arge1: done
*** Interface: wlan0: start
wlan0: bpf attached
wlan0: bpf attached
wlan0: Ethernet address: 09:20:10:32:39:23
*** Starting hostapd..
Configuration file: /etc/cfg/hostapd.wlan0.conf
Using interface wlan0 with hwaddr 09:20:10:32:39:23 and ssid 'CACHEBOY_DIR825_11NG_1'
*** Interface: wlan0: done
*** Interface: wlan1: start
wlan1: bpf attached
wlan1: bpf attached
wlan1: Ethernet address: 00:03:7f:be:f1:0c
wlan1: start 60 second CAC timer on channel 153 (5765 MHz)
*** Starting hostapd..
Configuration file: /etc/cfg/hostapd.wlan1.conf
wlan1: stop CAC timer on channel 153 (5765 MHz)
Using interface wlan1 with hwaddr 00:03:7f:be:f1:0c and ssid 'CACHEBOY_DIR825_11NA_1'
wlan1: start 60 second CAC timer on channel 153 (5765 MHz)
*** Interface: wlan1: done
*** Interface: bridge0: start
bridge0: bpf attached
bridge0: Ethernet address: f6:0a:9e:11:6f:ce
wlan0: promiscuous mode enabled
bridge0: link state changed to UP
wlan1: promiscuous mode enabled
arge0: promiscuous mode enabled
arge1: promiscuous mode enabled
*** Interface: bridge0: done
*** Default password/login databases ..
*** inetd
*** Done!

FreeBSD/mips (freebsd-dir825) (ttyu0)
⚠️ **GitHub.com Fallback** ⚠️