Skip to content

Conversation

@fintelia
Copy link
Contributor

This PR adds a new "baremetal-image" image type and implements the logic for creating COSI 1.2 files.

A baremetal image consists of a COSI 1.2 file with a VHD footer attached to it. This construction enables several benefits:

  • Unlike a normal VHD, the file is compressed so it is considerably faster to transfer.
  • The updated metadata in COSI 1.2 carries all the information need to reconstruct a partition table for the image
  • Tooling and services which today operate on VHDs without inspecting their contents will seamlessly be able to operate on baremetal-images as well.

Checklist

  • Tests added/updated
  • Documentation updated (if needed)
  • Code conforms to style guidelines

@fintelia fintelia mentioned this pull request Dec 12, 2025
3 tasks
@fintelia fintelia changed the title Add support for COSI 1.2 and baremetal images Add support for baremetal images Dec 12, 2025

padSize := int64(1024*1024) - (currentSize % int64(1024*1024))
if padSize != int64(1024*1024) {
_, err = cosiFile.Write(make([]byte, padSize))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use cosiFile.Truncate to expand the file size.

if padSize != int64(1024*1024) {
_, err = cosiFile.Write(make([]byte, padSize))
if err != nil {
return fmt.Errorf("failed to pad image file to 1 MB:\n%w", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MiB

MB means 10^6, not 2^20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants