Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Jan 2017 08:54:44 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        "Dr. Rolf Jansen" <rj@obsigna.com>, freebsd-arm@freebsd.org
Subject:   Re: BeagleBone Black MMC ordering clashes
Message-ID:  <1483718084.96230.5.camel@freebsd.org>
In-Reply-To: <7D750433-59FC-4999-AC24-041683E17310@obsigna.com>
References:  <7D750433-59FC-4999-AC24-041683E17310@obsigna.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2017-01-06 at 12:37 -0200, Dr. Rolf Jansen wrote:
> The BeagleBone Black comes with 2 MMC facilities, one built-in
> (internal 4 GB) and one provided by a removable SD card. For unknown
> reasons the BBB defined on the removable SD card to be MMC0 and the
> internal flash memory is MMC0.
> 
>   1) In the first go, I dd'd the FreeBSD-12 BBB snapshot (20161221)
> onto a SD card and I was able to start the device from that card.
> gpart showed me that the device identifier of the SD card is mmcsd0
> and that of the internal flash memory is mmcsd1. OK, that matches the
> already mentioned definitions.
> 
>   2) Now, I destroyed the partition of the internal mmcsd1 and
> created a new one:
> 
> =>     63  7552961  mmcsd1  MBR  (3.6G)
>        63     8129          - free -  (4.0M)
>      8192     8192       1  fat32  [active]  (4.0M)
>     16384  7536640       2  freebsd  (3.6G)
> 
> =>      0  7536640  mmcsd1s2  BSD  (3.6G)
>         0  7536640         1  freebsd-ufs  (3.6G)
> 
>   3) I copied over the contents of /boot/msdos from the external SD
> card to the msdosfs on mmcsd1s1 and I installed the FreeBSD 12
> snapshot on mmcsd1s1a. Restarting the device from the internal flash
> and no external SD inserted with FreeBSD 12-CURRENT works well at the
> first glance.
> 
>   4) However, the internal flash got now the device identifier
> mmcsd0:
> 
>    ...
>    mmc0: No compatible cards found on bus
>    ...
>    mmcsd0: 4GB <MMCHC MMC04G 5.8 SN 82390DEC MFG 11/1998 by 112
> 0x0000> at mmc1 48.0MHz/8bit/65535-block
>    ...
> 
> I know, this is how FreeBSD deals with the device numbering, i.e.
> serial numbers starting at zero without particular meaning, and I
> know that we should not rely on the number ordering.
> 
> But it seems that the MMC device driver does cont on the external SD
> card is at MMC0 when I insert it into the BBB once it has been
> started from the internal flash. It seems to insist to assign the
> device ID mmcsd0, which results in the device ordering clash because
> mmcsd0 has been assigned to the internal flash at MMC1 (s. above).
> 
> In the moment, I can have both flash device active at the same time
> only when I start the BBB from the external SD.
> 
> I would be glad to hear suggestions on how to deal with the issue. At
> the end of the day, I want to start the device from the mostly static
> OS file system on the internal flash and keep the volatile data on
> the external SD.
> 
> Best regards
> 
> Rolf

The mmcsd0 identifier will be assigned to the first mmc device found
that has a valid mmc or sd card.  If  the external slot has a card in
it, it will become mmcsd0 because it gets probed first.  If it has no
card in it, the onboard eMMC becomes mmcsd0 because the sd slot didn't
claim that device id.  There is no way to change the order of probing;
probing happens in order of the devices in the chip.  The BBB makers
decided to connect the external sd to the first device and the onboard
eMMC to the second one.

If you want the eMMC to be the root filesystem whether there is an
external sd card installed or not, the only solution is to use UFS or
GPT labels instead of device names to refer to partitions in fstab.

-- Ian




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