Writing an image to Removable Media¶
Overview¶
We cover how to apply a previously prepared image to a Removable Media such as: SD, MicroSD, USB drives, etc.
Bmap-tools¶
Bmap-tools is a Python project that is used to flash image files to block devices using the block map, thus speeding up the process when image has lots of empty space. To install the bmap-tools package, you should be able to use the package manager for your linux distro.
In Ubuntu / Debian:
sudo apt-get install bmap-tools
In Fedora (as root):
dnf install bmap-tools
Alternatively, you can clone the bmap-tools repository from Github:
git clone https://github.com/intel/bmap-tools
File examples¶
Next, we will download the proper files for the board. In this example:
core-image-weston-raspberrypi4-64.wic.bz2
core-image-weston-raspberrypi4-64.wic.bmap
Final image file name can vary, but will follow the format:
<image-name>-<board>_<yocto-release-codename>_<update-version>
Note
You can find a list of pre-built images in the Image Files section.
Write the image to a device¶
Next, write the image to the storage media. In this example, the local Linux system has assigned the MicroSD card to /dev/sdX. Substitute X with the assigned device.
If you run as a sudo enabled user (default in Ubuntu) use:
sudo bmaptool copy <path-to>/core-image-weston-raspberrypi4-64.wic.bz2 /dev/sdX
bmaptool copy <path-to>/core-image-weston-raspberrypi4-64.wic.bz2 /dev/sdX
Note
If you downloaded from git rather than installing the package you'll need to specify the full path to the bmaptool command, for example /home/user/bmap-tools/bmaptool copy <image>
.
In case bmaptool cannot be used for some reason, the image can be written as a regular raw image, it will just take more time.
If you run as a sudo enabled user (default in Ubuntu) use:
bzcat <path-to>/core-image-weston-raspberrypi4-64.wic.bz2 | sudo dd of=/dev/sdX
bzcat <path-to>/core-image-weston-raspberrypi4-64.wic.bz2 >/dev/sdX
Note
You can find what device name has been assigned to your removable storage in your Linux system using the either dmesg
, lsblk
or blkid
.
Warning
Careful! Take your time and ensure that you're writing the image file to the correct device. If you make a mistake, you could end up writing to the wrong device.