Search code examples
linuxyoctobitbake

How do I boot from an .hddimg file?


After running BitBake on several different recipe files, BitBake generates a file of type '.hddimg'. I haven't been able to find a clear explanation on what this file is used for, the closest that I have found is some speculation on the mailing list here. The author Paul states that:

the image isn't an image of a regular bootable system drive, but is a "live image" of a smaller system that can either boot the real system from a virtualized file system in RAM whose image is read from a single file in the first level, or it can install the real system to a different drive.

The 'bootimg.bbclass' is what generates the .hddimg, and in the opening comments it is written that:

A .hddimg file [is] an msdos filesystem containing syslinux, a kernel, an initrd and a rootfs image. These can be written to harddisks directly and also booted on USB flash disks (write them there with dd).

Which appears to corroborate with what Paul wrote, but still leaves a lot of ambiguity on how to go about booting from this file (at least to a greenhorn like me).


Solution

  • Well, the doc says "write them there with dd". So:

    dd if=/path/to/your/hddimg of=/path/to/raw/usb/device
    

    so, if you have the file as my.hddimg and the usb flash disk appears as /dev/sdg

    dd if=/home/karobar/my.hddimg of=/dev/sdg
    

    As it's name implies, it's an image, so needs to be written as such. The actual file system is inside of the rootfs file, which is similarly an image!

    Once you have that on the usb stick, the usb stick itself should be bootable. Depending on what you're trying to do this may not be the easiest kind of output from bitbake to work with.