Skip to content

Conversation

@filipleple
Copy link
Member

@filipleple filipleple commented Jan 21, 2026

Integrate the functionality of capsule_cabinet.sh into capsule.sh. Cabinets can now be created using ./capsule.sh create_cabinet capsule.cap. Prior functionality and calls of capsule.sh remain unaffected.

Upstream-Status: Inappropriate [Dasharo downstream]

issue: Dasharo/dasharo-issues#1432
ref: DSH-1123

Integrate the functionality of capsule_cabinet.sh into capsule.sh.
Cabinets can now be created using `./capsule.sh create_cabinet
capsule.cap`. Prior functionality and calls of capsule.sh remain
unaffected.

Upstream-Status: Inappropriate [Dasharo downstream]
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
Add a command that allows uploading built cabinets to LVFS.

Upstream-Status: Inappropriate [Dasharo downstream]
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
Fix the script so that the artifacts match our naming convention.

Upstream-Status: Inappropriate [Dasharo downstream]
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
@filipleple filipleple self-assigned this Jan 30, 2026
@filipleple filipleple changed the base branch from dasharo to dasharo_develop January 30, 2026 10:24
@filipleple filipleple marked this pull request as ready for review January 30, 2026 10:24
die "no '.config' file in current directory"
fi

while read -r line; do
Copy link
Member

Choose a reason for hiding this comment

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

Please add local line above this. I should have done this earlier.

Comment on lines -206 to -210
# Option names match terminology of GenerateCapsule which conveniently start
# with different letters:
# * t - trusted
# * o - other
# * s - signer
Copy link
Member

Choose a reason for hiding this comment

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

Was the comment removed by mistake?


if [ ! -f "$capsule" ]; then
die "File $capsule not found"
fi
Copy link
Member

Choose a reason for hiding this comment

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

While at it, I think it's worth adding this check from recap.sh:

local fmp_guid_bytes_hex=edd5cb6d2de8444cbda17194199ad92a
if [ "$(xxd -l 16 -ps "$capsule")" != "$fmp_guid_bytes_hex" ]; then
    die "'$capsule' is not an FMP capsule file"
fi

As is, it's possible to make a cabinet out of any file.

Comment on lines +51 to +53
echo ' upload_lvfs upload a cabinet (.cab) to LVFS'
echo ' options: -c credentials-file -u lvfs-base-url -e email -t token'
echo ' positional argument: cabinet-file (optional if exactly one .cab in current dir)'
Copy link
Member

Choose a reason for hiding this comment

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

To document environment variables:

Suggested change
echo ' upload_lvfs upload a cabinet (.cab) to LVFS'
echo ' options: -c credentials-file -u lvfs-base-url -e email -t token'
echo ' positional argument: cabinet-file (optional if exactly one .cab in current dir)'
echo ' upload_lvfs upload a cabinet (.cab) to LVFS, options'
echo ' [-c credentials-file] (defaults to ~/.config/dasharo-credentials/lvfs)'
echo ' [-u lvfs-base-url] (defaults to $LVFS_URL)'
echo ' [-e email] (defaults to $LVFS_EMAIL)'
echo ' [-t token] (defaults to $LVFS_TOKEN)'
echo ' positional argument:'
echo ' cabinet-file (optional if exactly one .cab in current dir)'

Output:

Usage: capsule.sh subcommand [subcommand-args...]

Subcommands:
  box            export standalone GenerateCapsule out of EDK2
  help           print this message
  keygen         use OpenSSL to auto-generate test keys suitable for signing
                 positional argument: directory-path
  make           build a capsule, options:
                 -t root-certificate-file
                 -o subroot-certificate-file
                 -s signing-certificate-file
                 -b (the flag adds battery check DXE into the capsule)
  create_cabinet create a fwupd cabinet (.cab) from a capsule
                 positional argument: capsule-file
  upload_lvfs    upload a cabinet (.cab) to LVFS, options
                 [-c credentials-file] (defaults to ~/.config/dasharo-credentials/lvfs)
                 [-u lvfs-base-url]    (defaults to $LVFS_URL)
                 [-e email]            (defaults to $LVFS_EMAIL)
                 [-t token]            (defaults to $LVFS_TOKEN)
                 positional argument:
                 cabinet-file (optional if exactly one .cab in current dir)

Oh, and the subcommands were intentionally sorted alphabetically so it's a bit faster to find them in help output.

cat > "${archive_dir}/firmware.metainfo.xml" << EOF
<?xml version='1.0' encoding='utf-8'?>
<component type="firmware">
<id>com.${vendor}.${CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME}.${CONFIG_MAINBOARD_VERSION}.system.firmware</id>
Copy link
Member

Choose a reason for hiding this comment

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

Not introduced here, but still.

Suggested change
<id>com.${vendor}.${CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME}.${CONFIG_MAINBOARD_VERSION}.system.firmware</id>
<id>${id}</id>

And somewhere above:

    local id=com.${vendor}.${CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME}.${CONFIG_MAINBOARD_VERSION}.system.firmware
    id=${id// /_}
    id=${id////_}

I was testing with QEMU's firmware and LVFS did not accept com.emulation.QEMU x86 q35/ich9.1.0.system.firmware for an ID.

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