ARM, CAM, FreeBSD, mmccam, SDIO, Software

Building FreeBSD’s SDIO driver for BeagleBone Black

Hi all, This post mainly concern with building FreeBSD’s SDIO driver for BeagleBone Black by cross compiling it on AMD platform. I had few unresolved issues with the master branch of current FreeBSD tree. So, for this i used another unofficial branch: https://github.com/kibab/freebsd/tree/mmcam-new . It does have the required KERNCONF file with stable SDIO driver.

A lot of steps below are similar to the one given on: https://forums.freebsd.org/threads/cross-compiling-beaglebone-on-amd64.64718/#post-384835  with slight but inevitable changes.

Procedure:

  1.  Before proceeding you need to first install git.
  2.  Setup project directory by mkdir /BBB
  3.  Clone the repository to /BBB/src by
  4. Setup environment variables as

    Note that sometime it shows an error like: Undefined command setenv, in that case just switch to root as sudo -E su and then try setting the environment variables again.
  5. Create image file and setup MSDOS filesystem for u-boot
  6. Make Buildworld and buildkernel

    Note here, that if your FreeBSD AMD environment is on virtual box, for above builds to be successful you need around 2Gb of RAM and 4Gb of Swap memory with -j7 option. Swap space can be checked via swapinfo command. For adding more swap just head towards: https://www.freebsd.org/doc/handbook/adding-swap-space.html
  7. Mount the MSDOS partition and copy the uboot stuff to it.

    Note that sysutils/u-boot-beaglebone port doesn’t come by default, in fresh FreeBSD installation. It has to be installed by
  8. Make the freebsd-ufs partition
  9.  Do installworld, installkernel into the partition
  10.  Install setup, create fstab and rc.conf
  11. Complete setup by

     

Great, you are now ready to go and dd the obtained bbb.img image to sd card. With every thing working kernel should boot up with multiple MMCCAM debug logs as in here. In case of any error, feel free to post it on the forums or comment below.

UPDATE(24/06/18):

SDIO driver has now been fixed in FreeBSD-Current head. In order to build for FreeBSD-Current just use GENERIC-MMCCAM kernel config file instead of BEAGLEBONE-MMCCAM.

References:

  • https://forums.freebsd.org/threads/cross-compiling-beaglebone-on-amd64.64718/#post-384835
  • http://freebsd-arm.freebsd.narkive.com/dZ0TaVwR/bbb-imx6-hummingboard-sdio-driver#post14
  • https://wiki.freebsd.org/SDIO

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.