FreeBSD/armv6 in QEMU

December 5, 2012 — 7 Comments

[QEMU 1.5 users see this update]

First take at getting FreeBSD/armv6 running in simulators. Simulators are great for tracking down nasty bugs and building packages.

So here is support for Versatile Platform Board machine supported by QEMU. Most likely this code will not run on real VersatilePB because I do not have this hardware and timing code (or lack of it) on CLCD driver and Keyboard/Mouse interface (PL050) is pure guesswork.

Back to gory details:


You’ll need this patch and this script. Apply patch, use script to get freebsd-versatilepb.flash.

As for userland – it’s fully compatible with Raspberry Pi’s userland, or Pandaboard’s one. So you can use latest RPi SD card image. As for now it’s freebsd-pi-r243778.img.gz (124Mb)


I believe that at least QEMU 1.2.0 is required. It’s still 1.1.1 in ports due to some blockers that prevent upgrade to 1.3.0. This patch updates port to 1.3.0 and it worked for me. Also I tested images with QEMU on windows and OS X – works fine.

qemu-system-arm -M versatilepb -m 128M -kernel freebsd-versatilepb.flash  -cpu arm1176 -hda freebsd-pi-r243778.img 


  • Serial console is off by default, use graphics console. If you need headless mode, rebuild image with “device sc” and related options disabled or use prebuilt flash image for headless mode
  • root device name is hardcoded so if you’re using some other image or building your own – be sure that’s ROOTDEV actually match real root
  • Memory size is hardcoded – 128M. For getting this information run-time we’ll need uboot and ubldr added to boot chain

Prebuilt kernels

freebsd-versatilepb.flash (4Mb)
freebsd-versatilepb-headless.flash (4Mb)
MD5 (freebsd-versatilepb-headless.flash) = 24a41807bf94c5fec0565adcfef48678
MD5 (freebsd-versatilepb.flash) = 085dedae67895ac1d1a7c04c7cda8468



7 responses to FreeBSD/armv6 in QEMU

  1. Oleksandr,

    i’ve several difficulties with arm and QEMU.
    I downloaded your prebuilt kernel and tried it in QEMU (1.4.0 and 1.4.1 from ports)
    It hangs at every boot attempt, the last line is:
    Timecounters tick every ….
    sometimes there is a number printed sometimes not.
    I decided to check out a fresh current to built it by myself and got it booting till it tries to mount the root fs. This failed because the driver for the “Versatile PCI controller” failed to attach (some memory related error).
    The obvious thing is that i have to start QEMU with -m 512M (512Mb of RAM) otherwise the QEMU window stays black forever. I tried to set some different values for the amount of memory in “sys/boot/fdt/dts/versatilepb.dts” but it changes nothing. The kernel is only booting with -m 512M.
    Today i rolled my CURRENT back to r244479 (right before “Replace generic ARM11 option with more specific support for ARM1136 and ARM1176”)
    With this state i can boot the kernel, the “Versatile PCI controller” and the sym driver are working and i can successfully load the userland image. But i have to use -m 512M otherwise it’s not working.
    Now if i try to use network together with r244479 the whole thing breaks with different errors. The most errors i see are from QEMU and look like this and are printed out hundred times:
    vpb_sic_write: Bad register offset 0xd44
    qemu: hardware error: smc91c111_write: Bad reg 0:2

    together with the following message in the running versatilepb system:
    : jemalloc_chunk.c:203: Failed assertion: “p[i] == 0”
    interrupt storm detected on “intr31:”; throttling interrupt source

    As far as i can see from the kernel boot messages the “kmi0 (PL050 Keyboard/Mouse Interface)” device is using irq31.

    It looks like as it could all be related to the “-m 512M” argument but i’m not sure.
    Can you shed some some light into this? Is a fresh CURRENT working for you as expected in QEMU?

    Kind regards

  2. Hello Gonzo!
    I’m tried run your script for cubieboard in one Mele_a1000 and now for understand how works u-boot on free-bsd i’m tried follow your tutorial for “FreeBSD in QEMU”.
    My question is you know how run u-boot and free-bsd on qemu for versatilepb.
    Or if you know where find information for ubldr for boot a free-bsd on my mele.
    Thanks and i’m sorry for my bad english

  3. Many thanks gonzo !!
    Now I’ll try to compile packages from port tree and get those with my rpi !
    I’m following your work around there.

Trackbacks and Pingbacks:

  1. ทดลอง FreeBSD บน Raspberry Pi | Raspberry Pi Thailand - December 9, 2012

    […] patch สำหรับ QEMU บน FreeBSD เพื่อใช้มันเป็น emulator […]

  2. FreeBSD 10 under Qemu emulated VersatilePB (armv6) « Thinking too much - February 2, 2013

    […] Tymoshenko’s patches to get the FreeBSD 10-CURRENT  kernel running in a Qemu-emulated Versatile Platform Board (VersatilePB) armv6 […]

Leave a Reply

Text formatting is available via select HTML. <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>