Using Beaglebone Black internal eMMC

Hello everyone,

I’m new to Mender and would like to try it on my Beaglebone Black board. I’ve read the topic on image generation, however, if I understood correctly, it will be booted off the SD card. Is it possible to flash the internal eMMC storage of BBB with Mender image?

Hey @azarubkin!

I haven’t tested it, but as far as I know, it’s pretty easy. Beaglebone Black assigns storage devices depending on whether the Boot Switch button is held down or not. If it’s unpressed, then the internal eMMC becomes the boot device. It’s possible you may need to switch some storage variables as well, but this is pretty easy if needed.

Thank you @kacf . Could you please direct me to where I can find some info on the topic?
What are my steps?

The forum topic says I need at least 8 GB card, while the internal storage is 4 GB. How do I partition it? Can I just boot off the SD card and run some tool to fulfill the task of moving Mender image to eMMC? Or should I do a sequence of steps manually?

The page that you linked to is the primary source, and the mender-convert tool, which it refers to, does the partitioning for you. For flashing the eMMC I believe you will have to resort to Beagleboard’s own pages, though I think it is as simple as a write (dd) to the storage device.

I think the space requirement is due to the size of the original image from Beagleboard. Last time I checked they didn’t offer an image which was small enough to use dual rootfs on a 4GB card. For this you will probably have to do some manual work: Boot the original image (no Mender) using SD card, find packages on the system you don’t need, and uninstall them until you have maximum around 1.5G or so, then dump the SD card to your computer, and then us a tool like gparted to shrink the filesystem and partition. Then you can use mender-convert on this image afterwards to convert it to a Mender image.

They offer now two images: 4 Gb and 1 Gb. Even the bigger one has 2.5 Gb free after flashing it to the internal eMMC, so I guess it could be used too.
I went with the smaller one, its rootfs size is 660MB, used space is 462 MB, so I guess there’s plenty of room for expanding either rootfs or data partition.
What I did:

  • built Mender image as per the manual (forum topic), only specified config file with “emmc” in its name, not with “sdcard”.
  • booted Beaglebone with official image from uSD card.
  • copied Mender .img file to the SD card with scp. This step could be done prior to booting.
  • issued dd command on the Beaglebone itself for flashing the .img file to the eMMC.
  • powered Beaglebone off, removed uSD card and powered it on.

It booted and appeared in the hosted Mender server dashboard!

So now I have another question:
The official Beaglebone image can be booted from SD card as well as from internal eMMC. It’s possible to uncomment a single line (cmdline=init=<path_to_flasher_script>) in /boot/uEnv.txt to flash the image from SD card to eMMC.
Is it possible to prepare similar image for Mender? E.g. it can be booted from SD card, but, with a single command, it copies itself to eMMC without the need for .img file.
Or the only way is to copy Mender .img file to official Beaglebone image, and then dd it?

I haven’t tried it myself. Is the flasher script a shell script or a U-Boot script? If it’s a shell script, it probably won’t work quite so easily, because mender-convert doesn’t boot the kernel using U-Boot. It uses U-Boot as a UEFI provider and then boots using a UEFI-compliant GRUB binary. This means that any arguments configured using U-Boot variables are unlikely to reach the kernel, since GRUB has its own set of arguments.

However, it would not be hard to add support for something like this. If you change the set bootargs line inside /EFI/BOOT/grub.cfg on the boot partition, you might be able to achieve the same effect.

On the other hand, if it’s a U-Boot script, it might work out of the box exactly as you say.

I may be misunderstanding your question, but if you already have an sdimg you want to write to the emmc, and you already have a working image that is bootable from ummc/sd, then simply copy the sdimg to the ummc filesystem, say, to your users home dir, and dd that image directly to the emmc block by block, i.e.
dd if=~myBBB.sdimg of=/dev/mmcblk1 bs=1M
When thats done, simply shutdown, pull the sd card and boot into myBBB.