FreeBSD/arm for Marvell Orion, Kirkwood and Discovery systems-on-chip

/!\ There is no support available anymore for these systems. FreeBSD 8.2 was the last version that was really stable. /!\

This is a short introduction into running FreeBSD 8.x and 9-CURRENT on the family of Marvell integrated systems-on-chip, including

The chips have programmable endian order, but only Little Endian mode was tested so far and all below examples assume this. In particular, the [lack of] arguments for build targets cause the created binaries to be LE.

Build world

$ cd ${SRC}
$ make -j 8 buildworld TARGET_ARCH=arm

Install world into the NFS-exported location

$ su
# setenv DESTDIR /nfsroot/arm-8-le
# mkdir -p $DESTDIR
# make installworld TARGET_ARCH=arm
# make distrib-dirs TARGET_ARCH=arm
# make distribution TARGET_ARCH=arm

Adjust configuration for diskless use

# echo 'sshd_enable="YES"' > $DESTDIR/etc/rc.conf
# echo 'rpcbind_enable="YES"' >> $DESTDIR/etc/rc.conf
# echo 'nfs_client_enable="YES"' >> $DESTDIR/etc/rc.conf
# echo 'rpc_lockd_enable="YES"' >> $DESTDIR/etc/rc.conf
# echo 'rpc_statd_enable="YES"' >> $DESTDIR/etc/rc.conf

Most likely the $DESTDIR/etc/fstab should be updated according to the local configuration. Consult diskless(8) for additional info.

Build kernel

There are dedicated kernel config files for different Marvell development systems per each family, use one of the following:

$ make buildkernel TARGET_ARCH=arm KERNCONF=DB-88F5XXX
$ make buildkernel TARGET_ARCH=arm KERNCONF=DB-88F6XXX
$ make buildkernel TARGET_ARCH=arm KERNCONF=DB-MV78XXX
$ make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG
$ make buildkernel TARGET_ARCH=arm KERNCONF=DREAMPLUG-1001
### Note for Nor based flash DreamPlugs you need a special configuration and
### you will need to change the kernel DREAMPLUG configuration to NFS booting unless the
### default DREAMPLUG loads from the SD card.

Move kernel to TFTP area

In the simplest scenario a pure binary version of the kernel (kernel.bin file) will be directly run from U-Boot. In this approach the kernel.bin needs to be placed manually in the TFTP-exported directory, which is accessible from the target.

$ cp ${OBJDIR}/sys/DB-885XXX/kernel.bin /tftpboot/mv5281/

Setup TFTP server

In /etc/inetd.conf, uncomment the following two lines:

tftp    dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -l -s /tftpboot
tftp    dgram   udp6    wait    root    /usr/libexec/tftpd      tftpd -l -s /tftpboot

Make sure the inetd(8) server is enabled in /etc/rc.conf:

inetd_enable="YES"

Setup NFS server

Add the following to the /etc/rc.conf on the host:

nfs_server_enable="YES"
mountd_enable="YES"
rpcbind_enable="YES"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"

Add a line to /etc/exports, like this:

/nfsroot/arm-8-le       -maproot=0 -network 10.4.50/24

Setup DHCP server

Install the server from net/isc-dhcp42-server. Add a section to /usr/local/etc/dhcpd.conf like this:

subnet 10.0.0.0 netmask 255.255.0.0 {
  range 10.0.0.1 10.0.0.255;
  option domain-name "internal.example.org";
  option broadcast-address 10.0.255.255;
  default-lease-time 600;
  max-lease-time 7200;
  filename "mv5281/kernel.bin";
  option root-path "10.0.0.201:/nfsroot/arm-8-le";
}

Boot the kernel from U-Boot

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|  ** LOADER **
 ** MARVELL BOARD: DB-88F5X81-DDR2-A/B LE

U-Boot 1.1.4 (Aug 26 2008 - 11:21:17) Marvell version: 2.3.23

U-Boot code: 00200000 -> 0026FFF0  BSS: -> 002845AC

Soc: 88F5281 D0 (DDR2)
CPU running @ 500Mhz
SysClock = 166Mhz , TClock = 166Mhz

DRAM CAS Latency = 3 tRP = 3 tRAS = 7 tRCD=3
DRAM CS[0] base 0x00000000   size 128MB
DRAM Total size 128MB  32bit width
[512kB@fff80000] [32768kB@f8000000] Flash: 32.5 MB
Addresses 4M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (4M - 3M): Done

CPU : ARM926 (Rev 0)
Streaming disabled
VFP initialized to Run Fast Mode.

USB 0: host mode
PCI 0: PCI Express Root Complex Interface
PCI 1: Conventional PCI, speed = 33000000
CPU: Write allocate enabled
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0
Marvell>>

Marvell>> tftpboot 900000 mv5281/kernel.bin
Using egiga0 device
TFTP from server 10.0.0.204; our IP address is 10.0.2.2
Filename 'mv5281/kernel.bin'.
Load address: 0x900000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###
done
Bytes transferred = 2675700 (28d3f4 hex)
Marvell>>

Marvell>> go 900000
## Starting application at 0x00900000 ...
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2008 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 8.0-CURRENT #2: Fri Dec  5 16:20:16 CET 2008
Preloaded elf kernel "elf kernel" at 0xc0d00074.
CPU: ARM926EJ-S rev 0 (ARM9EJ-S core)
  DC enabled IC enabled WB enabled EABT branch prediction enabled
  32KB/32B 1-way Instruction cache
  32KB/32B 4-way write-back-locking-C Data cache
real memory  = 134217728 (128 MB)
Physical memory chunk(s):
00000000 - 0x8fffff, 9437184 bytes (2304 pages)
0xdf1000 - 0x7d8efff, 117039104 bytes (28574 pages)
avail memory = 125468672 (119 MB)
SOC: (0x5281:0x04) Marvell 88F5281 rev D0, TClock 166MHz
random: <entropy source, Software, Yarrow>
nfslock: pseudo-device
mem: <memory>
null: <null device, zero device>
mbus0: <Marvell Internal Bus (Mbus)> on motherboard
ic0: <Marvell Integrated Interrupt Controller> at mem 0xf1020200-0xf102023b on mbus0
timer0: <Marvell CPU Timer> at mem 0xf1020300-0xf102032f irq 0 on mbus0
timer0: [FILTER]
gpio0: <Marvell Integrated GPIO Controller> at mem 0xf1010100-0xf101011f irq 6,7,8,9 on mbus0
gpio0: [FILTER]
gpio0: [FILTER]
gpio0: [FILTER]
gpio0: [FILTER]
uart0: <16550 or compatible> at mem 0xf1012000-0xf101201f irq 3 on mbus0
uart0: [FILTER]
uart0: fast interrupt
uart0: console (115200,n,8,1)
uart1: <16550 or compatible> at mem 0xf1012100-0xf101211f irq 4 on mbus0
uart1: [FILTER]
uart1: fast interrupt
ehci0: <Marvell Integrated USB 2.0 controller> at mem 0xf1050000-0xf1050fff irq 16,17 on mbus0
ehci0: [GIANT-LOCKED]
ehci0: [ITHREAD]
ehci0: 5.24 GL USB-2 workaround enabled
usb0: EHCI version 1.0
usb0 on ehci0
usb0: USB revision 2.0
uhub0: <Marvell EHCI root hub, class 9/0, rev 2.00/1.00, addr 1> on usb0
uhub0: 1 port with 1 removable, self powered
umass0: <SanDisk Corporation Cruzer Mini, class 0/0, rev 2.00/0.20, addr 2> on uhub0
umass0:0:0:-1: Attached to scbus0
mge0: <Marvell Gigabit Ethernet controller> at mem 0xf1072000-0xf1073fff irq 18,19,20,21,22 on mbus0
mge0: bpf attached
mge0: Ethernet address: 00:01:01:00:52:81
miibus0: <MII bus> on mge0
e1000phy0: <Marvell 88E1111 Gigabit PHY> PHY 8 on miibus0
e1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX-FDX, auto
mge0: [MPSAFE]
mge0: [ITHREAD]
mge0: [MPSAFE]
mge0: [ITHREAD]
twsi0: <Marvell Integrated I2C Bus Controller> at mem 0xf1011000-0xf101101f on mbus0
iicbus0: <Philips I2C bus> on twsi0
iic0: <I2C generic I/O> on iicbus0
rtc0: <Dallas Semiconductor DS1339 RTC> on iicbus0
rtc0: registered as a time-of-day clock (resolution 1000000us)
pcib0: <Marvell 88F5281 PCI-Express host controller> at mem 0xf1040000-0xf1041fff on mbus0
pci0: <PCI bus> on pcib0
pcib1: <Marvell 88F5281 PCI-X host controller> at mem 0xf1030000-0xf1031fff on mbus0
pci1: <network, ethernet> at device 7.0 (no driver attached)
Timecounter "CPU Timer" frequency 166666667 Hz quality 1000
Timecounters tick every 1.000 msec
lo0: bpf attached
pass0 at umass-sim0 bus 0 target 0 lun 0
pass0: <SanDisk Cruzer Mini 0.4> Removable Direct Access SCSI-2 device
pass0: 40.000MB/s transfers
GEOM: new disk da0
bootpc_init: wired to interface 'mge0'
Sending DHCP Discover packet from interface mge0 (00:01:01:00:52:81)
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <SanDisk Cruzer Mini 0.4> Removable Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: 244MB (501759 512 byte sectors: 64H 32S/T 244C)
mge0: link state changed to UP
Received DHCP Offer packet on mge0 from 0.0.0.0 (accepted) (no root path)
Sending DHCP Request packet from interface mge0 (00:01:01:00:52:81)
Received DHCP Ack packet on mge0 from 0.0.0.0 (accepted) (got root path)
mge0 at 10.0.0.18 server 0.0.0.0
subnet mask 255.255.0.0 router 10.0.0.1 rootfs 10.0.0.201:/nfsroot/arm-8-le/ hostname mv5281-a
Adjusted interface mge0
Trying to mount root from nfs:
NFS ROOT: 10.0.0.201:/nfsroot/mv5281-a/
start_init: trying /sbin/init
Interface mge0 IP-Address 10.0.0.18 Broadcast 10.0.255.255
No suitable dump device was found.
Entropy harvesting: interrupts ethernet point_to_point kickstart.
Fast boot: skipping disk checks.
mount_nfs: can't update /var/db/mounttab for 10.0.0.201:/nfsroot/arm-8-le
Starting Network: lo0.
devd: cannot open pid file: Operation not supported
Mounting NFS file systems:.
syslogd: cannot open pid file: Operation not supported
/etc/rc: WARNING: Dump device does not exist.  Savecore not run.

Fri Dec  5 13:38:31 UTC 2008

FreeBSD/arm (mv5281-a) (ttyu0)

login:

openrd-client specific notes

To access the console, you have to use the MicroUSB connector labeled "SYSTEM". It's not possible to use the usual RS-232 serial port instead. After connecting to FreeBSD host, two USB devices show up:

uftdi0: <OpenRD JTAGKey FT2232D B> on usbus0
uftdi1: <OpenRD JTAGKey FT2232D B> on usbus0

Console is on the second one (/dev/cuaU1). The default speed is 115200, 8N1.


CategoryInactiveProject CategoryHistorical

arm/Marvell (last edited 2019-09-06T21:32:04+0000 by LorenzoSalvadore)