1517393d9SAndrew Geissler.. SPDX-License-Identifier: CC-BY-SA-2.0-UK 2517393d9SAndrew Geissler 3517393d9SAndrew GeisslerFlashing Images Using ``bmaptool`` 4517393d9SAndrew Geissler********************************** 5517393d9SAndrew Geissler 6517393d9SAndrew GeisslerA fast and easy way to flash an image to a bootable device is to use 7*b58112e5SPatrick Williamsbmaptool, which is integrated into the OpenEmbedded build system. 8*b58112e5SPatrick Williamsbmaptool is a generic tool that creates a file's block map (bmap) and 9517393d9SAndrew Geisslerthen uses that map to copy the file. As compared to traditional tools 10*b58112e5SPatrick Williamssuch as dd or cp, bmaptool can copy (or flash) large files like raw 11517393d9SAndrew Geisslersystem image files much faster. 12517393d9SAndrew Geissler 13517393d9SAndrew Geissler.. note:: 14517393d9SAndrew Geissler 15517393d9SAndrew Geissler - If you are using Ubuntu or Debian distributions, you can install 16517393d9SAndrew Geissler the ``bmap-tools`` package using the following command and then 17517393d9SAndrew Geissler use the tool without specifying ``PATH`` even from the root 18517393d9SAndrew Geissler account:: 19517393d9SAndrew Geissler 20517393d9SAndrew Geissler $ sudo apt install bmap-tools 21517393d9SAndrew Geissler 22517393d9SAndrew Geissler - If you are unable to install the ``bmap-tools`` package, you will 23*b58112e5SPatrick Williams need to build bmaptool before using it. Use the following command:: 24517393d9SAndrew Geissler 25*b58112e5SPatrick Williams $ bitbake bmaptool-native 26517393d9SAndrew Geissler 27517393d9SAndrew GeisslerFollowing, is an example that shows how to flash a Wic image. Realize 28*b58112e5SPatrick Williamsthat while this example uses a Wic image, you can use bmaptool to flash 29*b58112e5SPatrick Williamsany type of image. Use these steps to flash an image using bmaptool: 30517393d9SAndrew Geissler 31517393d9SAndrew Geissler#. *Update your local.conf File:* You need to have the following set 32517393d9SAndrew Geissler in your ``local.conf`` file before building your image:: 33517393d9SAndrew Geissler 34517393d9SAndrew Geissler IMAGE_FSTYPES += "wic wic.bmap" 35517393d9SAndrew Geissler 36517393d9SAndrew Geissler#. *Get Your Image:* Either have your image ready (pre-built with the 37517393d9SAndrew Geissler :term:`IMAGE_FSTYPES` 38517393d9SAndrew Geissler setting previously mentioned) or take the step to build the image:: 39517393d9SAndrew Geissler 40517393d9SAndrew Geissler $ bitbake image 41517393d9SAndrew Geissler 42*b58112e5SPatrick Williams#. *Flash the Device:* Flash the device with the image by using bmaptool 43517393d9SAndrew Geissler depending on your particular setup. The following commands assume the 44517393d9SAndrew Geissler image resides in the :term:`Build Directory`'s ``deploy/images/`` area: 45517393d9SAndrew Geissler 46517393d9SAndrew Geissler - If you have write access to the media, use this command form:: 47517393d9SAndrew Geissler 48*b58112e5SPatrick Williams $ oe-run-native bmaptool-native bmaptool copy build-directory/tmp/deploy/images/machine/image.wic /dev/sdX 49517393d9SAndrew Geissler 50517393d9SAndrew Geissler - If you do not have write access to the media, set your permissions 51517393d9SAndrew Geissler first and then use the same command form:: 52517393d9SAndrew Geissler 53517393d9SAndrew Geissler $ sudo chmod 666 /dev/sdX 54*b58112e5SPatrick Williams $ oe-run-native bmaptool-native bmaptool copy build-directory/tmp/deploy/images/machine/image.wic /dev/sdX 55517393d9SAndrew Geissler 56517393d9SAndrew GeisslerFor help on the ``bmaptool`` command, use the following command:: 57517393d9SAndrew Geissler 58517393d9SAndrew Geissler $ bmaptool --help 59517393d9SAndrew Geissler 60