Hacker News new | ask | show | jobs
by agildehaus 1207 days ago
An example from my work:

We have a Yocto build that results in about 120MB worth of files that make up our app and Yocto. Originally we had a script that would write a bootloader, partition and format ext4 our target's eMMC, and decompress a 120MB tarball to that filesystem.

That worked well, but we wanted our script to become OS-independent, as our field team ran Windows laptops. It's quite difficult to get Windows to do an ext4 format, and I wanted our tool to have a minimal number of dependencies (e2fsprogs requirement? some proprietary thing from Paragon? no thanks)

So instead, have Yocto produce an image containing the bootloader and all four pre-formatted ext4 filesystems. No operating system needs to do the format if the filesystem already exits within, it's just a raw block write. But now the image is 4GB, the size of our eMMC, and writing all of it would be painfully slow.

Thankfully Yocto also outputs a bmap file which maps the parts of that 4GB which are empty space -- blocks we don't need to write when commissioning our target device. So our commissioning tool was rewritten in Go, and I wrote a bmap implementation in Go to do the write. Flashing our target is as fast as it used to be, but now that tool can be easily made to work on multiple operating systems.