public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "'Quirin Gylstorff' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Subject: [RFC PATCH 2/3] Add imagetype Discoverable Disk Image(DDI)
Date: Mon, 10 Nov 2025 11:50:53 +0100	[thread overview]
Message-ID: <20251110105140.1609372-3-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <20251110105140.1609372-1-Quirin.Gylstorff@siemens.com>

From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows to generate with the help of systemd-repart Discoverable
Disk Images[1] like systemd-sysext and systemd-confext.

Systemd-repart was choose as is easier to setup multiple partitions
which depend on each other. As for example a SYSEXT image contains
three partitions.

[1]: https://uapi-group.org/specifications/specs/discoverable_disk_image/

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 meta/classes/imagetypes_ddi.bbclass | 47 +++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 meta/classes/imagetypes_ddi.bbclass

diff --git a/meta/classes/imagetypes_ddi.bbclass b/meta/classes/imagetypes_ddi.bbclass
new file mode 100644
index 00000000..7020508a
--- /dev/null
+++ b/meta/classes/imagetypes_ddi.bbclass
@@ -0,0 +1,47 @@
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2025
+#
+# SPDX-License-Identifier: MIT
+# Class to generate discoverable disk images (DDI)
+
+DEPENDS += "isar-ddi-definitions"
+IMAGER_BUILD_DEPS:ddi += " isar-ddi-definitions"
+IMAGER_INSTALL:ddi += " isar-ddi-definitions"
+
+DDI_SIGNING_KEY_PATH ?= ""
+DDI_SIGNING_CERTIFICATE_PATH ?= ""
+DDI_TYPE ?= "sysext"
+DDI_DEFINITION_PATH ?= "/usr/share/isar-ddi-definitions/${DDI_TYPE}.repart.d"
+DDI_OUTPUT_IMAGE ?= "${IMAGE_FULLNAME}.ddi"
+ddi_not_supported() {
+    bberror "IMAGE TYPE DDI is not supported in distribution Release '${BASE_DISTRO_CODENAME}'"
+}
+
+create_ddi_image() {
+  local_extra_arguments=""
+  if [ -n "${DDI_SIGNING_KEY_PATH}" ]; then
+    local_extra_arguments="${local_extra_arguments} --private-key=${DDI_SIGNING_KEY_PATH}"
+  fi
+  if [ -n "${DDI_SIGNING_CERTIFICATE_PATH}" ]; then
+    local_extra_arguments="${local_extra_arguments} --certificate=${DDI_SIGNING_CERTIFICATE_PATH}"
+  fi
+
+  rm -rf ${DEPLOY_DIR_IMAGE}/${DDI_OUTPUT_IMAGE}
+
+  ${SUDO_CHROOT} << EOF
+    if [ -z ${DDI_SIGNING_KEY_PATH} ]; then
+      rm -f ${DDI_DEFINITION_PATH}/30-root-verity-sig.conf
+    fi
+    /usr/bin/systemd-repart \
+      --definitions='${DDI_DEFINITION_PATH}' \
+      --copy-source=${PP_ROOTFS} \
+      --empty=create --size=auto --dry-run=no  \
+      --no-pager $local_extra_arguments \
+      ${PP_DEPLOY}/${DDI_OUTPUT_IMAGE}
+EOF
+}
+
+IMAGE_CMD:ddi:buster = "ddi_not_supported"
+IMAGE_CMD:ddi:bullseye = "ddi_not_supported"
+IMAGE_CMD:ddi:bookworm = "ddi_not_supported"
+IMAGE_CMD:ddi = "create_ddi_image"
-- 
2.51.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20251110105140.1609372-3-Quirin.Gylstorff%40siemens.com.

  parent reply	other threads:[~2025-11-10 10:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 10:50 [RFC PATCH 0/3] Add support of Discoverable Disk Image 'Quirin Gylstorff' via isar-users
2025-11-10 10:50 ` [RFC PATCH 1/3] Add Discoverable Disk Image definitions to ISAR 'Quirin Gylstorff' via isar-users
2025-11-10 10:50 ` 'Quirin Gylstorff' via isar-users [this message]
2025-11-10 10:50 ` [RFC PATCH 3/3] classes/image: Add DDI imagetype 'Quirin Gylstorff' via isar-users
2025-11-10 11:59 ` [RFC PATCH 0/3] Add support of Discoverable Disk Image 'Jan Kiszka' via isar-users

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251110105140.1609372-3-Quirin.Gylstorff@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=Quirin.Gylstorff@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox