FreeBSD/armv6z/clang on Raspberry Pi 512MB (with U-Boot + ubldr)

Daisuke Aoyama aoyama at
Wed Dec 12 17:08:57 UTC 2012


I've created FreeBSD clang world for RPI based on svn 244112 + eabi.diff(NOT 
USE) + few NetBSD code.
I didn't test with "-mfloat-abi=softfp" but it might work.

The first version is released at my Japanese blog:

Thank you for many comments to previous versions.
Thank you for adding RPI support to FreeBSD.
Thank you for porting latest clang to head!
It's very useful for RPI developing now.

You can get the pre-build image from my archives:
(At this time, freebsd-pi-clang-20121213.img.gz is the latest version.)

Download and decompress it, then write it to SD. This image requires SD 4GB 
or more.
I'm using as headless server. So, you need a serial console for seeing the 
boot log.
If you need to change the value on it, please mount the second partition 
(e.g. /dev/da0s2a).
If you want the video out, please remove the line of "set 
console=comconsole" in /boot/loader.rc.

Note: first time, it takes about 2 minutes for generating the SSH keys.
This version includes axe(ASIX AX88x7x/760) driver because smsc is not 
Now "cc" is "clang" instead of "gcc". If you want to use gcc, specify or 
edit /etc/make.conf.
The initial setup code is taken from NetBSD.

Using config is here:

Source and pacth is here:

Pre-configured for:

I/O: multi-console (primary serial)
IP address:
Default router:
sshd: enabled

User: pi
Password: raspberry
Password(root): raspberry

kernel section limit:
TS=256MB, DS=1024MB, SS=256MB

example of /etc/make.conf:


# Now cc = clang is default

# For clang

CFLAGS=-O2 -fno-strict-aliasing -pipe -march=armv6z -mtune=arm1176jzf-s -mfloat-abi=soft
COPTFLAGS=-O1 -fno-strict-aliasing -pipe -march=armv6z -mtune=arm1176jzf-s -mfloat-abi=soft

# For gcc
How to use GPT USB stick in RPI:

(if you use something, delete/destory it before doing)
# gpart delete -i NN da0
# gpart destroy -F da0

(create new partition and format)
# gpart create -s gpt da0
# gpart add -t freebsd-ufs da0
# gpart show
# newfs -U -j /dev/da0p1

(mount it)
# mount /dev/da0p1 /mnt
Known problems:
 o SD card is not configured correctly. (power on/off need if it's failed)
 o hang the system. (unknown reason)
 o smsc is not stable.
 o alignment/padding is not same as gcc. (temporary avoid strict alignment 
 o call both IDCACHE_WBINV_ALL and DCACHE_WB_RANGE at switch. (can't work 
without both)
 o still depend on GNU as (gas syntax).

 o modify/replace bcm2835 drivers.
 o using "clang -integrated-as".
 o fix alignment with clang.
 o self build.
 o use EABI if possible.
 o create build script :-)

Enjoy clang world in Raspberry Pi!
Thank you.
Daisuke Aoyama 

More information about the freebsd-arm mailing list