BeagleBone Black Extracting eMMC contents

Revision as of 14:35, 12 January 2015 by Cwshep (talk | contribs) (Performing restore/flashing: Fixed bit vs. byte b->B issue. Added note to check image size. Made dd bs more sane. Other punctuation and clean-up.)
Jump to: navigation, search


There are lots of ways to extract the contents of the eMMC to save off and reuse. I'm proposing a method using Buildroot and an initramfs such that you can simply drop a few files from a .zip onto a normal, FAT-formatted SD card to perform the extraction. There are several things really handy here, such as the ability to edit to be whatever script you want to run on your board at boot. In the archive, I only have the necessary for saving your eMMC content. The flip-side is provided here in the text such that you need to go through a couple of steps before you trash your eMMC.

Steps to save

The steps for saving off your eMMC contents to a file:

  • Get a 4GB or larger uSD card that is FAT formatted.
  • Download and extract the contents onto your uSD card.
  • Eject uSD card from your computer, insert into powered-off BeagleBone Black and apply power to your board while holding down the S2 button.
  • You'll notice USR0 (the LED closest to the S1 button in the corner) will (after about 20 seconds) start to blink steadily, rather than the double-pulse "heartbeat" pattern that is typical when your BeagleBone Black is running the typical Linux kernel configuration.
  • It'll run for a bit under 10 minutes and then USR0 will stay ON steady. That's your cue to remove power, remove the uSD card and put it back into your computer.
  • You should see a file called BeagleBoneBlack-eMMC-image-XXXXX.img, where XXXXX is a set of random numbers. Save off this file to use for restoring your image later.

NOTE: Because the date won't be set on your board, you might want to adjust the date on the file to remember when you made it.

NOTE: Delete the file if you want to make room for a new backup image.

NOTE: For storage on your computer, these images will typically compress very well, so use your favorite compression tool.

Performing restore/flashing

To restore the file, make sure there is a valid BeagleBoneBlack-eMMC-image-XXXX.img file on the uSD card and edit with your favorite text editor to contain the following:

echo timer > /sys/class/leds/beaglebone\:green\:usr0/trigger 
dd if=/mnt/BeagleBoneBlack-eMMC-image-XXXXX.img of=/dev/mmcblk1 bs=10M
echo default-on > /sys/class/leds/beaglebone\:green\:usr0/trigger

NOTE: Be certain to replace the 'XXXXX' above with the proper name of your image file.

NOTE: You can share and use other people's image files, but be sure to have them uncompressed on the card or add decompression to the script.

NOTE: The bootable image referenced here cannot handle files larger than 2GB which means you cannot save an image from a Rev. C BeagleBoneBlack. Use the script with on-the-fly compression instead, almost all compressed images will be smaller than 2GB. (But be sure to check that your image file is smaller than 2GB, otherwise you could have copied an incomplete image!!!! Check autorun.log for error messages.)

Use this alternative script to perform on-the-fly compression and decompression and to support board with eMMC larger than 2GB:

echo timer > /sys/class/leds/beaglebone\:green\:usr0/trigger 
#un-comment the following line to perform a backup
dd if=/dev/mmcblk1 bs=16M | gzip -c > /mnt/BBB-eMMC-$RANDOM.img.gz >>/mnt/autorun.log 2>&1

#un-comment the following line to perform a restore (be sure to replace XXXXX with your image name)
#gunzip -c /mnt/BBB-XXXXX.revC.img.gz | dd of=/dev/mmcblk1 bs=16M >>/mnt/autorun.log 2>&1

echo default-on > /sys/class/leds/beaglebone\:green\:usr0/trigger

NOTE: if you have difficulty booting a Rev. C BBB with this tool mount the SD card and make the following changes:

cd /mnt #or wherever you have mounted the card
mkdir dtbs
cp am335x-boneblack.dtb dtbs/am335x-boneblack.dtb

You may also try booting with the barrel jack (AC power) rather than the USB port.


This image was built using Buildroot. The sources are at with tag save-emmc-0.0.1. Download via or clone the git repo. It is a small fork from git:// tag e9f6011617528646768e69203e85fe64364b7efd.

Build steps

To build, 'make beagleboneblack_defconfig; make; ./'. Output files (am335x-boneblack.dtb, MLO, u-boot.img and uImage) will be in the output/images subdirectory. The following files were created manually.


optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
uenvcmd=load mmc 0 ${loadaddr} uImage;run loadfdt;setenv bootargs console=${console} ${optargs};bootm ${loadaddr} - ${fdtaddr}

echo timer > /sys/class/leds/beaglebone\:green\:usr0/trigger 
dd if=/dev/mmcblk1 of=/mnt/BeagleBoneBlack-eMMC-image-$RANDOM.img bs=10M 
echo default-on > /sys/class/leds/beaglebone\:green\:usr0/trigger

Other sources used

The kernel is based on, but I applied the patches, added firmware and uploaded it to to pull down in the Buildroot makefile. The link to the source for the firmware is in the commit.