Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2014 17:59:56 -0400
From:      Patrick Kelsey <kelsey@ieee.org>
To:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Booting FreeBSD from eMMC on BeagleBone Black
Message-ID:  <CAD44qMXrKbZqXT_Z1UL2LXuVON4Gb49m-GygW_6Y14Zz-egTFw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I've had some changes integrated recently to crochet-freebsd, and to ubldr
in -current, that enable booting FreeBSD from the onboard eMMC on
BeagleBone Black.

The changes to crochet-freebsd include (as of 3412b48a0a):

- Additional patches for u-boot-2013.04 that fix device enumeration bugs,
provide for enumeration of all MMC devices in the presence of empty card
slots, and ensure that when booting from an MMC device, MLO loads
BB-uboot.img and BB-uboot.img in turn loads BBubldr from the same device
MLO was loaded from.

- Improvements to the crochet disk partitioning support so multiple
partitions of any type can be created, and their sizes and labels can be
specified.  Even if you aren't interested in having multiple UFS partitions
in your image, the disk label support is handy for writing /etc/fstabs that
don't rely on the unstable /dev/mmcsdN device names.

The changes to ubldr include (as of r263124):

- Improved disk probing support that will now by default find and use the
first suitable partition among the available storage devices.

- Support for an environment variable 'loaderdev' that can be used to
specify a specific load device, or to constrain the disk probe.  For
example, adding a line "loaderdev=mmc1:2.0" to BB-uEnv.txt will cause ubldr
to try to load a kernel from the first UFS partition on the eMMC (if you
are using the typical crochet partitioning approach of one FAT partition
followed by a UFS partition).  If you don't define loaderdev, a kernel
won't be loaded from the eMMC unless the SD card slot is empty, or
otherwise has a card in it that won't produce anything of interest during
the disk probe, because the disk probe visits the SD card slot first.

The partitioning and /etc/fstab customization routines at the end of
https://github.com/pkelsey/crochet-configs/blob/master/BBB-multi-install-config.shmay
be of interest.  If you add these to your config, an image with one
FAT
boot partition and two equal-sized, world-installed UFS partitions will be
created.  The filesystems in the image will be labeled either:

SDBOOT, sdfreebsd1, sdfreebsd2

or

EMMCBOOT, emmcfreebsd1, emmcfreebsd2

depending on whether or not BEAGLEBONE_BOOT_EMMC is set to "y" when crochet
is run, and the contents of /etc/fstab will be constructed accordingly.  If
you only want one world-installed UFS partition, change NUM_INSTALLS=2 to
NUM_INSTALLS=1 in beaglebone_multiinstall_partition_image().  The
functionality in these routines may be canned as a configurable board
default or option in the future.

Also, when making an image for the eMMC, take care to limit the image size
to its usable capacity:

option ImageSize 1832mb # maximal eMMC image

To install an image on the eMMC, I usually do something along the lines of:

1. sudo sh crochet.sh -c <myconfig>
2. dd the resulting image to an sd card and boot from that sd card
3. sudo BEAGLEBONE_BOOT_EMMC=y sh crochet.sh -c <myconfig>
4. scp a bzipped image down, then bzcat | dd it to the eMMC, or ssh -C "cat
<image>" | dd it to the eMMC.

-Patrick



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD44qMXrKbZqXT_Z1UL2LXuVON4Gb49m-GygW_6Y14Zz-egTFw>