Skip to content

Carambola2

Tom Sparks edited this page May 12, 2015 · 9 revisions

Bringing FreeBSD up on the Carambola 2

Introduction

FreeBSD-HEAD now has sufficient support to bring up the wireless support on the Carambola 2.

Hardware

The Carambola 2 (http://8devices.com/carambola-2) is an AR9330 based board with:

  • AR9330 SoC
  • 1x1 2GHz 802.11n support
  • 16MiB NOR flash
  • 64MiB RAM
  • Five 10/100 ethernet ports via an on-chip ethernet switch
  • USB host port
  • RS232 console port
  • Lots of GPIO pins

The development board breaks these out:

  • 2 x 10/100 ports
  • Reset and GPIO button
  • USB Host port
  • Power and RS232 console via mini-USB

Bringing up FreeBSD

  • Install the build scripts
  • Create /tftpboot/
  • Install the lzma port - the default lzma compressor doesn't generate compatible images for uboot!
  • (TODO) build an updated uboot port with the lzma kernel support
  • Build FreeBSD:
# cd /path/to/head/checkout/src
# /path/to/buildscripts/build carambola2
  • Power up the board via mini-USB and connect via console
  • Press the escape key to interrupt the boot process (Any other key will expedite the timeout):
    U-Boot 1.1.4 (Feb  8 2013 - 11:41:32)
    
    AP121-2MB (ar9330) U-boot
    DRAM:  
    sri
    ar7240_ddr_initial_config(145): python ddr init
    #### TAP VALUE 1 = f, 2 = 10
    64 MB
    Top of RAM usable for U-Boot at: 84000000
    Reserving 212k 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
    Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
    flash size 16777216, sector count = 256
    Flash: 16 MB
    In:    serial
    Out:   serial
    Err:   serial
    Net:   ag7240_enet_initialize...
    No valid address in Flash. Using fixed address
    No valid address in Flash. Using fixed address
    : cfg1 0x5 cfg2 0x7114
    eth0: 00:03:7f:09:0b:ad
    eth0 up
    : cfg1 0xf cfg2 0x7214
    eth1: 00:03:7f:09:0b:ad
    athrs26_reg_init_lan
    ATHRS26: resetting s26
    ATHRS26: s26 reset done
    eth1 up
    eth0, eth1
    Hit any key to stop autoboot:  0 
  • Erase the existing openwrt image:
    ar7240> erase 0x9f050000 +0xd90000
    Erase Flash from 0x9f050000 to 0x9fddffff in Bank # 1 
    First 0x5 last 0xdd sector size 0x10000
     221
    Erased 217 sectors
  • Setup the default IP address for local and tftp server:
    ar7240> setenv ipaddr 192.168.13.10
    ar7240> setenv serverip 192.168.13.11
  • TFTP and flash the combined userland/kernel. Ensure that the resulting image is no bigger than 0xfbb000 bytes else you will overwrite the calibration data!
ar7240> tftpboot 0x80050000 carambola2.flashinst.img
Using eth1 device
TFTP from server 192.168.13.11; our IP address is 192.168.13.10
Filename 'carambola2.flashinst.img'.
Load address: 0x80050000
Loading: #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 ##########################################################
done
Bytes transferred = 5621248 (55c600 hex)
ar7240> cp.b 0x80050000 0x9f050000 $filesize
Copy to Flash... .....................................................................................done
ar7240> 

  • Reboot by typing "reset" and ensure it boots FreeBSD.
U-Boot 1.1.4-g6452b07f-dirty (Jun 13 2013 - 15:49:24)

=====================================
CARAMBOLA2 v1.0 (AR9331) U-boot
http://www.8devices.com/
-------------------------------------
DRAM:  64 MB
Flash: 16 MB
Net:   eth0, eth1
=====================================

Hit ESC key to stop autoboot:  0 
## Booting image at 9f050000 ...
   Image Name:   FreeBSD
   Created:      2015-03-21  23:41:16 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1339601 Bytes =  1.3 MB
   Load Address: 80050000
   Entry Point:  80050100
   Verifying Checksum at 0x9f050040 ...OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

CPU platform: Atheros AR9330 rev 1
CPU Frequency=400 MHz
CPU DDR Frequency=400 MHz
CPU AHB Frequency=200 MHz
platform frequency: 400 MHz
CPU reference clock: 40 MHz
CPU MDIO clock: 40 MHz
arguments: 
  a0 = 00000003
  a1 = a3f7bfb0
  a2 = a3f7c3d0
  a3 = 00000010
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):
0x513000 - 0x3ffffff, 61788160 bytes (15085 pages)
Maxmem is 0x4000000
ar933x_configure_gmac: GMAC config was 0x00000010
ar933x_configure_gmac: GMAC setting is 0x00000000; register is now 0x00000010
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2015 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 11.0-CURRENT #1 r280333M: Sat Mar 21 16:29:38 PDT 2015
    adrian@lucy-11i386:/usr/home/adrian/work/freebsd/head-embedded/obj/mips/mips.mips/usr/home/adrian/work/freebsd/head-embedded/src/sys/CARAMBOLA2 mips
gcc version 4.2.1 20070831 patched [FreeBSD]
Preloaded elf kernel "kernel" at 0x8050d310.
real memory  = 67108864 (65536K bytes)
Physical memory chunk(s):
0x005a7000 - 0x03eb7fff, 59838464 bytes (14609 pages)
avail memory = 59568128 (56MB)
wlan: <802.11 Link Layer>
random: entropy device infrastructure driver
random: selecting highest priority adaptor <Dummy>
random: SOFT: yarrow init()
random: selecting highest priority adaptor <Yarrow>
mem: <memory>
null: <full device, null device, zero device>
nexus0: <MIPS32 root nexus>
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 200000000 Hz quality 800
Event timer "MIPS32" frequency 200000000 Hz quality 800
argemdio0: <Atheros AR71xx built-in ethernet interface, MDIO controller> at mem 0x1a000000-0x1a000fff on nexus0
mdio0: <MDIO> on argemdio0
mdioproxy0: <MII/MDIO proxy, MDIO side> on mdio0
arswitch0: <Atheros AR7240 Ethernet Switch (ver 0 rev 0)> on mdio0
miibus0: <MII bus> on arswitch0
ukphy0: <Generic IEEE 802.3u media interface> PHY 0 on miibus0
ukphy0: OUI 0x00c82e, model 0x0004, rev. 1
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus1: <MII bus> on arswitch0
ukphy1: <Generic IEEE 802.3u media interface> PHY 1 on miibus1
ukphy1: OUI 0x00c82e, model 0x0004, rev. 1
ukphy1:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus2: <MII bus> on arswitch0
ukphy2: <Generic IEEE 802.3u media interface> PHY 2 on miibus2
ukphy2: OUI 0x00c82e, model 0x0004, rev. 1
ukphy2:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus3: <MII bus> on arswitch0
ukphy3: <Generic IEEE 802.3u media interface> PHY 3 on miibus3
ukphy3: OUI 0x00c82e, model 0x0004, rev. 1
ukphy3:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
etherswitch0: <Switch controller> on arswitch0
mdio1: <MDIO> on arswitch0
mdioproxy1: <MII/MDIO proxy, MDIO side> on mdio1
apb0 at irq 4 on nexus0
uart0: <ar933x> at mem 0x18020000-0x18020017 irq 3 on apb0
uart0: console (115200,n,8,1)
uart0: fast interrupt
gpio0: <Atheros AR71XX GPIO driver> at mem 0x18040000-0x18040fff irq 2 on apb0
gpio0: [GIANT-LOCKED]
gpio0: function_set: 0x0
gpio0: function_clear: 0x0
gpio0: gpio pinmask=0x1803
gpiobus0: <GPIO bus> on gpio0
gpioled0: <GPIO led> at pin(s) 0 on gpiobus0
gpioled1: <GPIO led> at pin(s) 1 on gpiobus0
gpioc0: <GPIO controller> on gpio0
ehci0: <AR71XX Integrated USB 2.0 controller> at mem 0x1b000100-0x1bffffff irq 1 on nexus0
usbus0: set host controller mode
usbus0: EHCI version 1.0
usbus0: set host controller mode
usbus0 on ehci0
ehci0: usbpf: Attached
arge0: <Atheros AR71xx built-in ethernet interface> at mem 0x19000000-0x19000fff irq 2 on nexus0
arge0: Generating random ethernet address.
miiproxy0: <MII/MDIO proxy, MII side> on arge0
miiproxy0: attached to target mdio1
arge0: finishing attachment, phymask 0010, proxy set 
miibus4: <MII bus> on miiproxy0
ukphy4: <Generic IEEE 802.3u media interface> PHY 4 on miibus4
ukphy4: OUI 0x00c82e, model 0x0004, rev. 1
ukphy4:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
arge0: bpf attached
arge0: Ethernet address: 62:73:64:b4:07:38
arge1: <Atheros AR71xx built-in ethernet interface> at mem 0x1a000000-0x1a000fff irq 3 on nexus0
arge1: Generating random ethernet address.
mii_attach_proxy: not attaching, no mdio device hint for arge1
arge1: finishing attachment, phymask 0000, proxy null 
arge1: bpf attached
arge1: Ethernet address: 62:73:64:55:0d:ec
ath0: Vendor=0x168c, Device=0x0035
ath0: Vendor=0x168c, Device=0x0035
ath0: <Atheros AR933x> at mem 0x18100000-0x1811ffff irq 0 on nexus0
ath0: eeprom @ 0x1fff0000 (16384 bytes)
ath0: eeprom data @ 0xbfff0000
Bootstrap clock 40MHz
ar9300_attach: calling ar9300_hw_attach
ar9300_hw_attach: calling ar9300_eeprom_attach
ar9300_flash_map: unimplemented for now
Restoring Cal data from DRAM
ar9300_hw_attach: ar9300_eeprom_attach returned 0
ath0: RX status length: 48
ath0: RX buffer size: 4096
ath0: TX descriptor length: 128
ath0: TX status length: 36
ath0: TX buffers per descriptor: 4
ath0: ath_edma_setup_rxfifo: type=0, FIFO depth = 16 entries
ath0: ath_edma_setup_rxfifo: type=1, FIFO depth = 128 entries
ath0: [HT] enabling HT modes
ath0: [HT] enabling short-GI in 20MHz mode
ath0: [HT] 1 stream STBC receive enabled
ath0: [HT] 1 RX streams; 1 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: 1T1R
ath0: 11ng MCS 20MHz
ath0: MCS 0-7: 6.5Mbps - 65Mbps
ath0: 11ng MCS 20MHz SGI
ath0: MCS 0-7: 7Mbps - 72Mbps
ath0: 11ng MCS 40MHz:
ath0: MCS 0-7: 13.5Mbps - 135Mbps
ath0: 11ng MCS 40MHz SGI:
ath0: MCS 0-7: 15Mbps - 150Mbps
ath0: AR9330 mac 512.1 RF5110 phy 0.0
ath0: 2GHz radio: 0x0000; 5GHz radio: 0x0000
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
spi0: <AR71XX SPI> at mem 0x1f000000-0x1f00000f on nexus0
spibus0: <spibus bus> on spi0
mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
mx25l0: w25q128, sector 65536 bytes, 256 sectors
ar71xx_wdog0: <Atheros AR71XX watchdog timer> on nexus0
Device configuration finished.
Timecounters tick every 1.000 msec
tcp_init: net.inet.tcp.tcbhashsize auto tuned to 1024
lo0: bpf attached
arswitch0port1: link state changed to DOWN
arswitch0port2: link state changed to DOWN
arswitch0port3: link state changed to DOWN
arswitch0port4: link state changed to DOWN
GEOM: new disk flash/spi0
usbus0: 480Mbps High Speed USB v2.0
MAP: flash/spi0: 0x40000, data=0x40000 "/dev/map/uboot"
MAP: flash/spi0: 40000x10000, data=0x10000 "/dev/map/uboot-env"
MAP: search flash/spi0 for key ".!/bin/sh" from 0x50000, step 0x10000
ugen0.1: <Atheros> at usbus0
uhub0: <Atheros EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
MAP: flash/spi0: 50000x150000, data=0x150000 "/dev/map/kernel"
MAP: search flash/spi0 for key ".!/bin/sh" from 0x50000, step 0x10000
MAP: flash/spi0: 1a0000xe40000, data=0xe40000 "/dev/map/rootfs"
MAP: flash/spi0: fe0000x10000, data=0x10000 "/dev/map/cfg"
MAP: flash/spi0: ff0000x10000, data=0x10000 "/dev/map/art"
map/rootfs.uncompress: GEOM_ULZMA image found
map/rootfs.uncompress: 141 x 131072 blocks
MAP: No valid partition found at map/rootfs.uncompress
random: unblocking device.
Root mount waiting for: usbus0
uhub0: 1 port with 1 removable, self powered
Root mount waiting for: usbus0
arswitch0: arswitch_miipollstat: port 1: port -> UP
arswitch0port2: link state changed to UP
Root mount waiting for: usbus0
ugen0.2: <PNY Technologies> at usbus0
umass0: <PNY Technologies USB 2.0 FD, class 0/0, rev 2.00/11.00, addr 2> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:0:0: Attached to scbus0
Trying to mount root from ufs:map/rootfs.uncompress []...
GEOM: new disk da0
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <PNY USB 2.0 FD 1100> Removable Direct Access SPC-2 SCSI device
da0: Serial Number AA00000000005875
da0: 40.000MB/s transfers
da0: 7788MB (15950592 512 byte sectors: 255H 63S/T 992C)
da0: quirks=0x2<NO_6_BYTE>
da0: Delete methods: <NONE(*)>
warning: no time-of-day clock registered, system time will not be set accurately
start_init: trying /sbin/init
MAP: No valid partition found at da0
Mar 21 23:41:00 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
gunzip: 65536 bytes transferred in 4.612009 secs (14210 bytes/sec)
invalid compressed data--crc error
etc/cfg/manifest
etc/master.passwd
etc/group
etc/cfg/rc.conf
etc/cfg/hostapd.wlan0.conf
9 blocks
*** Completed.
*** setting up hostname
*** Load kernel modules
kldload: can't load bridgestp: module already loaded or in kernel
kldload: can't load if_bridge: No such file or directory
kldload: can't load random: No such file or directory
*** bringing up loopback ..
*** Default password/login databases ..
*** Starting networking via /etc/rc.d/base/net
*** Interface: arge0: start
arge0: link state changed to DOWN
*** Interface: arge0: done
*** Interface: arge1: start
*** Interface: arge1: done
*** Interface: ath0: start
dev.ath.0.txq_mcastq_maxdepth: 512 -> 32
dev.ath.0.hal.force_full_reset: 0 -> 1
*** Interface: ath0: done
*** Interface: wlan0: start
ath_hal_reg_write: reg=0x000080e0, val=0xffffff3b, pm=1
ath_hal_reg_write: reg=0x000080e4, val=0x0000ffff, pm=1
wlan0: bpf attached
wlan0: bpf attached
wlan0: Ethernet address: c4:93:00:00:3c:c9
Configuration file: /var/run/hostapd.wlan0.conf
Using interface wlan0 with hwaddr c4:93:00:00:3c:c9 and ssid "CACHEBOY_2GHZ"
*** Interface: wlan0: done
*** Interface: bridge0: start
bridge0: bpf attached
bridge0: Ethernet address: d2:8f:1a:a6:bb:34
arge0: promiscuous mode enabled
bridge0: link state changed to DOWN
arge1: promiscuous mode enabled
wlan0: promiscuous mode enabled
*** Interface: bridge0: done
*** inetd
*** Done!

FreeBSD/mips (freebsd-carambola2) (ttyu0)

login: root
Password:
ifNo home directory.
Logging in with home = "/".
config wln# ifconfig wlan0
wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether c4:93:00:00:3c:c9
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng <hostap>
        status: running
        ssid CACHEBOY_2GHZ channel 1 (2412 MHz 11g ht/20) bssid c4:93:00:00:3c:c9
        regdomain FCC country US ecm authmode WPA1+WPA2/802.11i privacy MIXED
        deftxkey 2 TKIP 2:128-bit txpower 30 scanvalid 60 protmode CTS
        ampdulimit 64k ampdudensity 8 shortgi wme burst dtimperiod 1 -dfs
        groups: wlan 
# ifconfig arge0
arge0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80008<VLAN_MTU,LINKSTATE>
        ether 62:73:64:b4:07:38
        media: Ethernet autoselect (none)
        status: no carrier
# ifconfig arge1
arge1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8<VLAN_MTU>
        ether 62:73:64:55:0d:ec
        media: Ethernet 1000baseT <full-duplex>
        status: active
#