Flashing Yocto Images from MacOS

Today, I needed to flash a Yocto image from my Macbook. These are the steps I used – mostly this is a note-to-self, but maybe others will find it useful.

Installation

I installed bmaptool with homebrew, thanks to gallantcrusader’s tap:

brew tap gallantcrusader/bmaptool
brew install bmaptool

Finding the Device

Run diskutil list to find the proper device:

[10:36:21] flashing $ diskutil list
/dev/disk0 (internal, physical):
  [...]

/dev/disk1 (synthesized):
  [...]

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *63.9 GB    disk2
   1:             Windows_FAT_32 boot                    136.3 MB   disk2s1
   2:                      Linux                         741.6 MB   disk2s2
                    (free space)                         63.0 GB    -

Flashing

First, you’ll need a .wic.bz2 file and the associated .wic.bmap file.

Unmount the corresponding disk:

diskutil unmountDisk /dev/disk2

Then invoke bmaptool on the .wic.bz2. This will

sudo bmaptool copy image-name.wic.bz2 /dev/rdisk2
“”
Note
Use /dev/rdiskN (the raw device) rather than /dev/diskN. It’s significantly faster.

Then, I ejected the disk and inserted it into the device:

diskutil eject /dev/disk2

Broken Pipe Note

I had some concerning output from this command, and I think overall it worked fine. I see 100% copied and synchronizing. It seems like the pbzip2 broken pipe error is just the decompressor complaining that the read end closed after bmaptool finished consuming all the data it needed.

$ diskutil unmountDisk /dev/disk2
sudo bmaptool copy file.wic.bz2 /dev/rdisk2
Unmount of all volumes on disk2 was successful
Password:
bmaptool: info: discovered bmap file 'file.wic.bmap'
bmaptool: info: block map format version 2.0
bmaptool: info: 7828 blocks of size 131072 (978.4 MiB), mapped 4153 blocks (519.1 MiB or 53.1%)
bmaptool: info: copying image 'file.wic.bz2' to file 'rdisk2' using bmap file 'file.wic.bmap'
bmaptool: info: 100% copied
bmaptool: info: synchronizing '/dev/rdisk2'
bmaptool: info: copying time: 19.4s, copying speed 26.8 MiB/sec
pbzip2: *ERROR: Could not write 900000 bytes to file [ret=-1]!  Aborting...
pbzip2: *ERROR: system call failed with errno=[32: Broken pipe]!
pbzip2: *ERROR: system call failed with errno=[32: Broken pipe]!

References

Share Your Thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.