public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 0/6] Add target bootstrapper framework
@ 2025-09-22 17:04 alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 1/6] isar-installer: Moved installer related Kconfig to separate file alexander.heinisch via isar-users
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: alexander.heinisch via isar-users @ 2025-09-22 17:04 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Heinisch

From: Alexander Heinisch <alexander.heinisch@siemens.com>

Currently the installer deploys images embedded to itself.

In many situations this is fine, but for some more demanding requirements
are in place. e.g.:
- enrollment of keys (e.g. Secure Boot),
- setup for disk encryption,
- collection and reporting of device information (serial number, mac addresses, ...)
- resize / repartition of disk during comissioning
- generation of a commissioning report

While many of these tasks can be done on first-boot doing so during
device setup can be beneficial in many cases.
e.g.
- additional time required for "first-boot" when performing tasks
with high effort on site may not be desired
- the comissioning environment oftentimes allows for failures during
that phase - worst case the device is put aside. On site failures during
the wrong bootstrapping phases (secure boot setup, disk encryption)
can be severe.

This patch extends current installer behaviour to support a flexible
framework to define multiple tasks to be executed in sequence during
the "target (device) bootstrapping" phase.

Note: Current patchset uses installer and target-bootstrapper interchangeably.
Imo the name target-bootstrapper fits better to the actual purpose,
while installer is already established for some time in isar and changing
the naming would probably break some downstream. Although, that could be
fixed in a backwards compatible way, I left this exercise open upon agreement.

Alexander Heinisch (6):
  isar-installer: Moved installer related Kconfig to separate file.
  isar-installer: Added target bootstrapper framework
  isar-installer: Use target-bootstrapper-service in favour of
    deploy-image-service
  isar-installer: Removed deploy-image-service
  isar-installer: Fixing race between ttys in unattended mode.
  isar-installer: Added example target bootstrapper task to collect
    device information.

 kas/image/Kconfig                             |  83 ++------------
 kas/image/isar-image-installer.yaml           |   6 +
 kas/installer/Kconfig                         | 104 ++++++++++++++++++
 kas/installer/add-device-info-collector.yaml  |  14 +++
 kas/installer/unattended.yaml                 |  18 +++
 meta-isar/classes/target-bootstrapper.bbclass |  37 +++++++
 .../images/isar-image-installer.bb            |   2 +-
 .../deploy-image-service.bb                   |  21 ----
 .../files/install.override.conf               |   5 -
 .../device-info-collector.bb                  |  27 +++++
 .../files/usr/bin/device-info-collector.sh    |  28 +++++
 .../files/target-bootstrapper.override.conf   |   3 +
 .../target-bootstrapper-service.bb            |  38 +++++++
 .../files/target-bootstrapper.sh.tmpl         |  44 ++++++++
 .../target-bootstrapper.bb                    |  41 +++++++
 15 files changed, 369 insertions(+), 102 deletions(-)
 create mode 100644 kas/installer/Kconfig
 create mode 100644 kas/installer/add-device-info-collector.yaml
 create mode 100644 kas/installer/unattended.yaml
 create mode 100644 meta-isar/classes/target-bootstrapper.bbclass
 delete mode 100644 meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
 delete mode 100644 meta-isar/recipes-installer/deploy-image-service/files/install.override.conf
 create mode 100644 meta-isar/recipes-installer/device-info-collector/device-info-collector.bb
 create mode 100755 meta-isar/recipes-installer/device-info-collector/files/usr/bin/device-info-collector.sh
 create mode 100644 meta-isar/recipes-installer/target-bootstrapper-service/files/target-bootstrapper.override.conf
 create mode 100644 meta-isar/recipes-installer/target-bootstrapper-service/target-bootstrapper-service.bb
 create mode 100644 meta-isar/recipes-installer/target-bootstrapper/files/target-bootstrapper.sh.tmpl
 create mode 100644 meta-isar/recipes-installer/target-bootstrapper/target-bootstrapper.bb

--
2.39.5

-- 
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/20250922170445.1393839-1-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] isar-installer: Moved installer related Kconfig to separate file.
  2025-09-22 17:04 [PATCH 0/6] Add target bootstrapper framework alexander.heinisch via isar-users
@ 2025-09-22 17:04 ` alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 2/6] isar-installer: Added target bootstrapper framework alexander.heinisch via isar-users
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: alexander.heinisch via isar-users @ 2025-09-22 17:04 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Heinisch

From: Alexander Heinisch <alexander.heinisch@siemens.com>

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 kas/image/Kconfig     | 73 +--------------------------------------
 kas/installer/Kconfig | 79 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+), 72 deletions(-)
 create mode 100644 kas/installer/Kconfig

diff --git a/kas/image/Kconfig b/kas/image/Kconfig
index 8193efc5..1ebd056e 100644
--- a/kas/image/Kconfig
+++ b/kas/image/Kconfig
@@ -38,78 +38,7 @@ config IMAGE_INSTALLER
 endchoice
 
 if IMAGE_INSTALLER
-
-choice
-	prompt "Image to install"
-	default INSTALL_IMAGE_BASE
-
-config INSTALL_IMAGE_BASE
-	bool "Base image"
-	help
-	  Embed the basic Isar image into the installer image.
-
-config INSTALL_IMAGE_CI
-	bool "CI image"
-	help
-	  Embed the Isar CI image into the installer image.
-
-config INSTALL_IMAGE_DEBUG
-	bool "Debug image"
-	help
-	  Embed the Isar debug image into the installer image.
-
-config INSTALL_EMPTY
-	bool "No installer payload"
-	help
-	  This will generate a installer image without payload. The user of
-	  that image needs then to copy a image to the partition labeled
-	  INSTALLDATA.
-
-endchoice
-
-config INSTALLER_TARGET_IMAGE
-	string
-	default "isar-image-base" if INSTALL_IMAGE_BASE
-	default "isar-image-ci" if INSTALL_IMAGE_CI
-	default "isar-image-debug" if INSTALL_IMAGE_DEBUG
-
-config INSTALL_UNATTENDED
-	bool "Run installer unattended"
-
-if INSTALL_UNATTENDED
-
-config INSTALLER_UNATTENDED
-	string
-	default "1" if INSTALL_UNATTENDED
-	default ""
-
-config INSTALLER_TARGET_DEVICE
-	string "Target device to deploy"
-	default "/dev/sda"
-	help
-          Deploy image to this target device. Accepts comma/colon-separated multiple devices; installs on the first available.
-	  Leave this empty to get prompted during installation
-	  Examples: /dev/sda, /dev/nvme0n1, /dev/sda:/dev/nvme0n1
-
-choice
-	prompt "Overwrite handling"
-	default OPT_INSTALLER_TARGET_OVERWRITE
-
-config OPT_INSTALLER_TARGET_OVERWRITE
-	bool "Overwrite if target is not empty"
-
-config OPT_INSTALLER_TARGET_ABORT
-	bool "Abort if target is not empty"
-
-endchoice
-
-config INSTALLER_TARGET_OVERWRITE
-    string
-    default "OVERWRITE" if OPT_INSTALLER_TARGET_OVERWRITE
-    default "ABORT" if OPT_INSTALLER_TARGET_ABORT
-
-endif
-
+source "kas/installer/Kconfig"
 endif
 
 config KAS_INCLUDE_IMAGE
diff --git a/kas/installer/Kconfig b/kas/installer/Kconfig
new file mode 100644
index 00000000..83380ee2
--- /dev/null
+++ b/kas/installer/Kconfig
@@ -0,0 +1,79 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2025
+#
+# SPDX-License-Identifier: MIT
+
+menu "Installer config"
+
+choice
+	prompt "Image to install"
+	default INSTALL_IMAGE_BASE
+
+config INSTALL_IMAGE_BASE
+	bool "Base image"
+	help
+	  Embed the basic Isar image into the installer image.
+
+config INSTALL_IMAGE_CI
+	bool "CI image"
+	help
+	  Embed the Isar CI image into the installer image.
+
+config INSTALL_IMAGE_DEBUG
+	bool "Debug image"
+	help
+	  Embed the Isar debug image into the installer image.
+
+config INSTALL_EMPTY
+	bool "No installer payload"
+	help
+	  This will generate a installer image without payload. The user of
+	  that image needs then to copy a image to the partition labeled
+	  INSTALLDATA.
+
+endchoice
+
+config INSTALLER_TARGET_IMAGE
+	string
+	default "isar-image-base" if INSTALL_IMAGE_BASE
+	default "isar-image-ci" if INSTALL_IMAGE_CI
+	default "isar-image-debug" if INSTALL_IMAGE_DEBUG
+
+config INSTALL_UNATTENDED
+	bool "Run installer unattended"
+
+if INSTALL_UNATTENDED
+
+config INSTALLER_UNATTENDED
+	string
+	default "1" if INSTALL_UNATTENDED
+	default ""
+
+config INSTALLER_TARGET_DEVICE
+	string "Target device to deploy"
+	default "/dev/sda"
+	help
+          Deploy image to this target device. Accepts comma/colon-separated multiple devices; installs on the first available.
+	  Leave this empty to get prompted during installation
+	  Examples: /dev/sda, /dev/nvme0n1, /dev/sda:/dev/nvme0n1
+
+choice
+	prompt "Overwrite handling"
+	default OPT_INSTALLER_TARGET_OVERWRITE
+
+config OPT_INSTALLER_TARGET_OVERWRITE
+	bool "Overwrite if target is not empty"
+
+config OPT_INSTALLER_TARGET_ABORT
+	bool "Abort if target is not empty"
+
+endchoice
+
+config INSTALLER_TARGET_OVERWRITE
+    string
+    default "OVERWRITE" if OPT_INSTALLER_TARGET_OVERWRITE
+    default "ABORT" if OPT_INSTALLER_TARGET_ABORT
+
+endif
+
+endmenu
-- 
2.39.5

-- 
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/20250922170445.1393839-2-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/6] isar-installer: Added target bootstrapper framework
  2025-09-22 17:04 [PATCH 0/6] Add target bootstrapper framework alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 1/6] isar-installer: Moved installer related Kconfig to separate file alexander.heinisch via isar-users
@ 2025-09-22 17:04 ` alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 3/6] isar-installer: Use target-bootstrapper-service in favour of deploy-image-service alexander.heinisch via isar-users
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: alexander.heinisch via isar-users @ 2025-09-22 17:04 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Heinisch

From: Alexander Heinisch <alexander.heinisch@siemens.com>

Currently the installer deploys images embedded to itself.

In many situations this is fine, but for some more demanding requirements
are in place. e.g.:
- enrollment of keys (e.g. Secure Boot),
- setup for disk encryption,
- collection and reporting of device information (serial number, mac addresses, ...)
- resize / repartition of disk during comissioning
- generation of a commissioning report

While many of these tasks can be done on first-boot doing so during
device setup can be beneficial in many cases.
e.g.
- additional time required for "first-boot" when performing tasks
with high effort on site may not be desired
- the comissioning environment oftentimes allows for failures during
that phase - worst case the device is put aside. On site failures during
the wrong bootstrapping phases (secure boot setup, disk encryption)
can be severe.

This patch extends current installer behaviour to support a flexible
framework to define multiple tasks to be executed in sequence during
the "target (device) bootstrapping" phase.

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 meta-isar/classes/target-bootstrapper.bbclass | 37 ++++++++++++++++
 .../files/target-bootstrapper.override.conf   |  3 ++
 .../target-bootstrapper-service.bb            | 38 ++++++++++++++++
 .../files/target-bootstrapper.sh.tmpl         | 44 +++++++++++++++++++
 .../target-bootstrapper.bb                    | 41 +++++++++++++++++
 5 files changed, 163 insertions(+)
 create mode 100644 meta-isar/classes/target-bootstrapper.bbclass
 create mode 100644 meta-isar/recipes-installer/target-bootstrapper-service/files/target-bootstrapper.override.conf
 create mode 100644 meta-isar/recipes-installer/target-bootstrapper-service/target-bootstrapper-service.bb
 create mode 100644 meta-isar/recipes-installer/target-bootstrapper/files/target-bootstrapper.sh.tmpl
 create mode 100644 meta-isar/recipes-installer/target-bootstrapper/target-bootstrapper.bb

diff --git a/meta-isar/classes/target-bootstrapper.bbclass b/meta-isar/classes/target-bootstrapper.bbclass
new file mode 100644
index 00000000..15974bf8
--- /dev/null
+++ b/meta-isar/classes/target-bootstrapper.bbclass
@@ -0,0 +1,37 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2024-2025
+#
+# SPDX-License-Identifier: MIT
+
+python() {
+    additional_packages = d.getVar('TARGET_BOOTSTRAPPER_ADDITIONAL_PACKAGES').split()
+
+    names    = []
+    workdirs = []
+    scripts  = []
+    efforts  = []
+    effort_total = 0
+
+    for package in additional_packages:
+        additional_package_task = f"TARGET_BOOTSTRAPPER_TASK_{package}"
+
+        names.append(package)
+        workdirs.append(d.getVarFlag(additional_package_task, "workdir") or ".")
+
+        script = d.getVarFlag(additional_package_task, "script")
+        if not script:
+            bb.warn("Script not set for {task_name} - consider setting {task_name}[script] = \"<your-script-for-{task_name}>\"".format(task_name=additional_package_task))
+
+        scripts.append(script or "/bin/true")
+
+        effort = d.getVarFlag(additional_package_task, "effort") or "1"
+        efforts.append(effort)
+
+        effort_total = effort_total + int(effort)
+
+    d.setVar('TMPL_TARGET_BOOTSTRAPPER_TASK_NAMES', ' '.join(names))
+    d.setVar('TMPL_TARGET_BOOTSTRAPPER_TASK_WORKDIRS', ' '.join(workdirs))
+    d.setVar('TMPL_TARGET_BOOTSTRAPPER_TASK_SCRIPTS', ' '.join(scripts))
+    d.setVar('TMPL_TARGET_BOOTSTRAPPER_TASK_EFFORTS', ' '.join(efforts))
+    d.setVar('TMPL_TARGET_BOOTSTRAPPER_TASK_TOTAL_EFFORT', str(effort_total))
+}
diff --git a/meta-isar/recipes-installer/target-bootstrapper-service/files/target-bootstrapper.override.conf b/meta-isar/recipes-installer/target-bootstrapper-service/files/target-bootstrapper.override.conf
new file mode 100644
index 00000000..a7948418
--- /dev/null
+++ b/meta-isar/recipes-installer/target-bootstrapper-service/files/target-bootstrapper.override.conf
@@ -0,0 +1,3 @@
+[Service]
+ExecStart=
+ExecStart=/bin/sh -c "target-bootstrapper.sh || (echo 'Rebooting in 60 s'; sleep 60); reboot"
diff --git a/meta-isar/recipes-installer/target-bootstrapper-service/target-bootstrapper-service.bb b/meta-isar/recipes-installer/target-bootstrapper-service/target-bootstrapper-service.bb
new file mode 100644
index 00000000..c3441494
--- /dev/null
+++ b/meta-isar/recipes-installer/target-bootstrapper-service/target-bootstrapper-service.bb
@@ -0,0 +1,38 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2024-2025
+#
+# SPDX-License-Identifier: MIT
+
+DESCRIPTION = "systemd service to run target bootstrapper on ${TARGET_BOOTSTRAPPER_TTY_SERVICES}"
+
+TARGET_BOOTSTRAPPER_TTY_SERVICES ??= "\
+    getty@tty1 \
+    serial-getty@ttyS0 \
+    "
+
+python(){
+    if not d.getVar('TARGET_BOOTSTRAPPER_TTY_SERVICES'):
+        bb.error("No ttys for target bootstrapper configured - review TARGET_BOOTSTRAPPER_TTY_SERVICES setting")
+
+    if (bb.utils.to_boolean(d.getVar('INSTALLER_UNATTENDED')) and
+        len(d.getVar('TARGET_BOOTSTRAPPER_TTY_SERVICES').split()) != 1):
+        bb.warn("Multiple ttys are configured for target bootstrapper in unattended mode. - potential race condition detected!")
+}
+
+inherit dpkg-raw
+
+SRC_URI = "\
+    file://target-bootstrapper.override.conf \
+    "
+
+DEPENDS += " target-bootstrapper"
+DEBIAN_DEPENDS = "target-bootstrapper"
+
+do_install[cleandirs] = "${D}/usr/lib/systemd/system/"
+do_install() {
+    for svc_name in ${TARGET_BOOTSTRAPPER_TTY_SERVICES}
+    do
+        mkdir -p ${D}/usr/lib/systemd/system/${svc_name}.service.d/
+        install -m 0644 ${WORKDIR}/target-bootstrapper.override.conf ${D}/usr/lib/systemd/system/${svc_name}.service.d/10-target-bootstrapper.override.conf
+    done
+}
diff --git a/meta-isar/recipes-installer/target-bootstrapper/files/target-bootstrapper.sh.tmpl b/meta-isar/recipes-installer/target-bootstrapper/files/target-bootstrapper.sh.tmpl
new file mode 100644
index 00000000..13be023a
--- /dev/null
+++ b/meta-isar/recipes-installer/target-bootstrapper/files/target-bootstrapper.sh.tmpl
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2024
+#
+# SPDX-License-Identifier: MIT
+
+task_names=($TMPL_TARGET_BOOTSTRAPPER_TASK_NAMES)
+task_workdirs=($TMPL_TARGET_BOOTSTRAPPER_TASK_WORKDIRS)
+task_scripts=($TMPL_TARGET_BOOTSTRAPPER_TASK_SCRIPTS)
+task_efforts=($TMPL_TARGET_BOOTSTRAPPER_TASK_EFFORTS)
+handled_effort=0
+total_effort=$TMPL_TARGET_BOOTSTRAPPER_TASK_TOTAL_EFFORT
+
+tasks_total=${#task_names[@]}
+tasks_indices=${!task_names[@]}
+
+echo "Found $tasks_total tasks to execute for target bootstrapping."
+echo ""
+
+for idx in ${tasks_indices}
+do
+  echo "Task $(( idx+1 ))/${tasks_total} - $((handled_effort*100/total_effort))%"
+  echo "Handling task ${task_names[$idx]}"
+
+  echo "Entering workdir ${task_workdirs[$idx]}..."
+  pushd ${task_workdirs[$idx]} > /dev/null
+
+  ## execute task in subshell
+  (./${task_scripts[$idx]})
+  execution_result=$?
+  if [ ${execution_result} -eq 0 ]; then
+    echo "${task_names[$idx]} executed sucessfully"
+  else
+    echo "${task_names[$idx]} failed with ${execution_result}" -> abort!
+    exit ${execution_result}
+  fi
+
+  echo "Leaving workdir ${task_workdirs[$idx]}..."
+  popd > /dev/null
+
+  handled_effort=$((handled_effort+task_efforts[idx]))
+done
+
+echo "All tasks completed!"
diff --git a/meta-isar/recipes-installer/target-bootstrapper/target-bootstrapper.bb b/meta-isar/recipes-installer/target-bootstrapper/target-bootstrapper.bb
new file mode 100644
index 00000000..4c0fa6c3
--- /dev/null
+++ b/meta-isar/recipes-installer/target-bootstrapper/target-bootstrapper.bb
@@ -0,0 +1,41 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2024-2025
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-raw
+inherit target-bootstrapper
+
+DESCRIPTION = "Device bootstrapping framework"
+
+TARGET_BOOTSTRAPPER_ADDITIONAL_PACKAGES ??= "deploy-image"
+TARGET_BOOTSTRAPPER_TASK_deploy-image[script] ??= "deploy-image-wic.sh"
+TARGET_BOOTSTRAPPER_TASK_deploy-image[workdir] ??= "/usr/bin"
+TARGET_BOOTSTRAPPER_TASK_deploy-image[effort] ??= "2"
+
+DEPENDS += " ${@isar_multiarch_packages('TARGET_BOOTSTRAPPER_ADDITIONAL_PACKAGES', d)}"
+DEBIAN_DEPENDS += " \
+  , bash \
+  , ${@ ', '.join(isar_multiarch_packages('TARGET_BOOTSTRAPPER_ADDITIONAL_PACKAGES', d).split())} \
+  "
+
+SRC_URI = " \
+    file://target-bootstrapper.sh.tmpl \
+    "
+
+TEMPLATE_FILES = " \
+    target-bootstrapper.sh.tmpl \
+    "
+
+TEMPLATE_VARS = " \
+    TMPL_TARGET_BOOTSTRAPPER_TASK_NAMES \
+    TMPL_TARGET_BOOTSTRAPPER_TASK_WORKDIRS \
+    TMPL_TARGET_BOOTSTRAPPER_TASK_SCRIPTS \
+    TMPL_TARGET_BOOTSTRAPPER_TASK_EFFORTS \
+    TMPL_TARGET_BOOTSTRAPPER_TASK_TOTAL_EFFORT \
+    "
+
+do_install[cleandirs] = "${D}/usr/bin/"
+do_install() {
+    install -m 0755  ${WORKDIR}/target-bootstrapper.sh ${D}/usr/bin/
+}
-- 
2.39.5

-- 
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/20250922170445.1393839-3-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/6] isar-installer: Use target-bootstrapper-service in favour of deploy-image-service
  2025-09-22 17:04 [PATCH 0/6] Add target bootstrapper framework alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 1/6] isar-installer: Moved installer related Kconfig to separate file alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 2/6] isar-installer: Added target bootstrapper framework alexander.heinisch via isar-users
@ 2025-09-22 17:04 ` alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 4/6] isar-installer: Removed deploy-image-service alexander.heinisch via isar-users
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: alexander.heinisch via isar-users @ 2025-09-22 17:04 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Heinisch

From: Alexander Heinisch <alexander.heinisch@siemens.com>

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 kas/image/isar-image-installer.yaml                   | 6 ++++++
 meta-isar/recipes-core/images/isar-image-installer.bb | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/kas/image/isar-image-installer.yaml b/kas/image/isar-image-installer.yaml
index 970e0a89..336b3942 100644
--- a/kas/image/isar-image-installer.yaml
+++ b/kas/image/isar-image-installer.yaml
@@ -11,3 +11,9 @@ target: mc:isar-installer:isar-image-installer
 local_conf_header:
   installer_multiconfig: |
     BBMULTICONFIG += "isar-installer installer-target"
+
+  target_bootstrapper: |
+    TARGET_BOOTSTRAPPER_ADDITIONAL_PACKAGES ?= "deploy-image"
+    TARGET_BOOTSTRAPPER_TASK_deploy-image[script] ?= "deploy-image-wic.sh"
+    TARGET_BOOTSTRAPPER_TASK_deploy-image[workdir] ?= "/usr/bin"
+    TARGET_BOOTSTRAPPER_TASK_deploy-image[effort] ?= "2"
diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
index db379f5d..f0f0570c 100644
--- a/meta-isar/recipes-core/images/isar-image-installer.bb
+++ b/meta-isar/recipes-core/images/isar-image-installer.bb
@@ -23,6 +23,6 @@ ADDITIONAL_KERNEL_CMDLINE:append:unattended-installer = " \
 
 IMAGER_INSTALL:wic:append = " ${SYSTEMD_BOOTLOADER_INSTALL}"
 
-IMAGE_INSTALL += "deploy-image-service"
+IMAGE_INSTALL += "target-bootstrapper-service"
 
 IMAGE_INSTALL:remove = "expand-on-first-boot"
-- 
2.39.5

-- 
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/20250922170445.1393839-4-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/6] isar-installer: Removed deploy-image-service
  2025-09-22 17:04 [PATCH 0/6] Add target bootstrapper framework alexander.heinisch via isar-users
                   ` (2 preceding siblings ...)
  2025-09-22 17:04 ` [PATCH 3/6] isar-installer: Use target-bootstrapper-service in favour of deploy-image-service alexander.heinisch via isar-users
@ 2025-09-22 17:04 ` alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 5/6] isar-installer: Fixing race between ttys in unattended mode alexander.heinisch via isar-users
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: alexander.heinisch via isar-users @ 2025-09-22 17:04 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Heinisch

From: Alexander Heinisch <alexander.heinisch@siemens.com>

The image is now deployed as part of the target-bootstrapper so there
is no need for a separate service like this.

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 .../deploy-image-service.bb                   | 21 -------------------
 .../files/install.override.conf               |  5 -----
 2 files changed, 26 deletions(-)
 delete mode 100644 meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
 delete mode 100644 meta-isar/recipes-installer/deploy-image-service/files/install.override.conf

diff --git a/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb b/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
deleted file mode 100644
index 0fa3dcf3..00000000
--- a/meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
+++ /dev/null
@@ -1,21 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2024
-#
-# SPDX-License-Identifier: MIT
-
-DESCRIPTION = "systemd service to add target image to rootfs"
-
-
-inherit dpkg-raw
-
-SRC_URI = "file://install.override.conf \
-          "
-DEPENDS += " deploy-image"
-DEBIAN_DEPENDS = "deploy-image"
-
-do_install[cleandirs] = "${D}/usr/lib/systemd/system/getty@tty1.service.d/ \
-                         ${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/"
-do_install() {
-  install -m 0600 ${WORKDIR}/install.override.conf ${D}/usr/lib/systemd/system/getty@tty1.service.d/override.conf
-  install -m 0600 ${WORKDIR}/install.override.conf ${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/override.conf
-}
diff --git a/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf b/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf
deleted file mode 100644
index 357d8662..00000000
--- a/meta-isar/recipes-installer/deploy-image-service/files/install.override.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-[Service]
-ExecStart=
-ExecStart=/bin/sh -c "deploy-image-wic.sh || (echo 'Rebooting in 60 s'; sleep 60); reboot"
-StandardInput=tty
-StandardOutput=tty
-- 
2.39.5

-- 
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/20250922170445.1393839-5-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/6] isar-installer: Fixing race between ttys in unattended mode.
  2025-09-22 17:04 [PATCH 0/6] Add target bootstrapper framework alexander.heinisch via isar-users
                   ` (3 preceding siblings ...)
  2025-09-22 17:04 ` [PATCH 4/6] isar-installer: Removed deploy-image-service alexander.heinisch via isar-users
@ 2025-09-22 17:04 ` alexander.heinisch via isar-users
  2025-09-22 17:04 ` [PATCH 6/6] isar-installer: Added example target bootstrapper task to collect device information alexander.heinisch via isar-users
  2025-10-14 14:59 ` [PATCH 0/6] Add target bootstrapper framework Zhihang Wei
  6 siblings, 0 replies; 8+ messages in thread
From: alexander.heinisch via isar-users @ 2025-09-22 17:04 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Heinisch

From: Alexander Heinisch <alexander.heinisch@siemens.com>

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 kas/image/Kconfig             | 12 ++++++++----
 kas/installer/Kconfig         | 19 +++++++++++++++++--
 kas/installer/unattended.yaml | 18 ++++++++++++++++++
 3 files changed, 43 insertions(+), 6 deletions(-)
 create mode 100644 kas/installer/unattended.yaml

diff --git a/kas/image/Kconfig b/kas/image/Kconfig
index 1ebd056e..1e757ae4 100644
--- a/kas/image/Kconfig
+++ b/kas/image/Kconfig
@@ -37,10 +37,6 @@ config IMAGE_INSTALLER
 
 endchoice
 
-if IMAGE_INSTALLER
-source "kas/installer/Kconfig"
-endif
-
 config KAS_INCLUDE_IMAGE
 	string
 	default "kas/image/isar-image-base.yaml" if IMAGE_BASE
@@ -48,4 +44,12 @@ config KAS_INCLUDE_IMAGE
 	default "kas/image/isar-image-ci.yaml" if IMAGE_CI
 	default "kas/image/isar-image-installer.yaml" if IMAGE_INSTALLER
 
+if IMAGE_INSTALLER
+menu "Installer config"
+
+source "kas/installer/Kconfig"
+
+endmenu
+endif
+
 endmenu
diff --git a/kas/installer/Kconfig b/kas/installer/Kconfig
index 83380ee2..0b891c9a 100644
--- a/kas/installer/Kconfig
+++ b/kas/installer/Kconfig
@@ -3,7 +3,9 @@
 #
 # SPDX-License-Identifier: MIT
 
-menu "Installer config"
+config KAS_INCLUDE_IMAGE
+	string
+	default "kas/image/isar-image-installer.yaml"
 
 choice
 	prompt "Image to install"
@@ -44,6 +46,10 @@ config INSTALL_UNATTENDED
 
 if INSTALL_UNATTENDED
 
+config KAS_INCLUDE_INSTALLER_UNATTENDED
+	string
+	default "kas/installer/unattended.yaml"
+
 config INSTALLER_UNATTENDED
 	string
 	default "1" if INSTALL_UNATTENDED
@@ -76,4 +82,13 @@ config INSTALLER_TARGET_OVERWRITE
 
 endif
 
-endmenu
+config INSTALLER_TTY_SERVICES
+	string "TTY Service to use"
+	default "getty@tty1 serial-getty@ttyS0" if !INSTALL_UNATTENDED
+	default "serial-getty@ttyS0" if INSTALL_UNATTENDED
+	help
+          TTY Service(s) used to execute the installer on.
+	  In case of unattended installers, make sure only one tty
+	  is specified here, else race condition between installer
+	  instances may occur.
+	  Examples: "serial-getty@ttyS0", "getty@tty1" or combinations like "getty@tty1 serial-getty@ttyS0"
diff --git a/kas/installer/unattended.yaml b/kas/installer/unattended.yaml
new file mode 100644
index 00000000..21beac0a
--- /dev/null
+++ b/kas/installer/unattended.yaml
@@ -0,0 +1,18 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2025
+#
+# SPDX-License-Identifier: MIT
+
+header:
+  version: 14
+
+local_conf_header:
+  target_bootstrapper_deploy-image: |
+    INSTALLER_UNATTENDED = "1"
+    INSTALLER_TARGET_DEVICE ?= "/dev/sda:/dev/nvme0n1"
+    INSTALLER_TARGET_OVERWRITE ?= "OVERWRITE"
+
+  target_bootstrapper-tty: |
+    TARGET_BOOTSTRAPPER_TTY_SERVICES ?= "\
+        serial-getty@ttyS0 \
+    "
\ No newline at end of file
-- 
2.39.5

-- 
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/20250922170445.1393839-6-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 6/6] isar-installer: Added example target bootstrapper task to collect device information.
  2025-09-22 17:04 [PATCH 0/6] Add target bootstrapper framework alexander.heinisch via isar-users
                   ` (4 preceding siblings ...)
  2025-09-22 17:04 ` [PATCH 5/6] isar-installer: Fixing race between ttys in unattended mode alexander.heinisch via isar-users
@ 2025-09-22 17:04 ` alexander.heinisch via isar-users
  2025-10-14 14:59 ` [PATCH 0/6] Add target bootstrapper framework Zhihang Wei
  6 siblings, 0 replies; 8+ messages in thread
From: alexander.heinisch via isar-users @ 2025-09-22 17:04 UTC (permalink / raw)
  To: isar-users; +Cc: Alexander Heinisch

From: Alexander Heinisch <alexander.heinisch@siemens.com>

Signed-off-by: Alexander Heinisch <alexander.heinisch@siemens.com>
---
 kas/installer/Kconfig                         | 10 +++++++
 kas/installer/add-device-info-collector.yaml  | 14 ++++++++++
 .../device-info-collector.bb                  | 27 ++++++++++++++++++
 .../files/usr/bin/device-info-collector.sh    | 28 +++++++++++++++++++
 4 files changed, 79 insertions(+)
 create mode 100644 kas/installer/add-device-info-collector.yaml
 create mode 100644 meta-isar/recipes-installer/device-info-collector/device-info-collector.bb
 create mode 100755 meta-isar/recipes-installer/device-info-collector/files/usr/bin/device-info-collector.sh

diff --git a/kas/installer/Kconfig b/kas/installer/Kconfig
index 0b891c9a..ccac6471 100644
--- a/kas/installer/Kconfig
+++ b/kas/installer/Kconfig
@@ -82,6 +82,16 @@ config INSTALLER_TARGET_OVERWRITE
 
 endif
 
+
+config INSTALLER_ADD_DEVICE_INFO_COLLECTOR
+        bool "Add Device Info Collector"
+        default n
+
+config KAS_INCLUDE_INSTALLER_ADD_DEVICE_INFO_COLLECTOR
+	string
+	default "kas/installer/add-device-info-collector.yaml"
+    depends on INSTALLER_ADD_DEVICE_INFO_COLLECTOR
+
 config INSTALLER_TTY_SERVICES
 	string "TTY Service to use"
 	default "getty@tty1 serial-getty@ttyS0" if !INSTALL_UNATTENDED
diff --git a/kas/installer/add-device-info-collector.yaml b/kas/installer/add-device-info-collector.yaml
new file mode 100644
index 00000000..22020679
--- /dev/null
+++ b/kas/installer/add-device-info-collector.yaml
@@ -0,0 +1,14 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2025
+#
+# SPDX-License-Identifier: MIT
+
+header:
+  version: 14
+
+local_conf_header:
+  target_bootstrapper-add-device-info-collector: |
+    TARGET_BOOTSTRAPPER_ADDITIONAL_PACKAGES:append = " device-info-collector"
+    TARGET_BOOTSTRAPPER_TASK_device-info-collector[script] = "device-info-collector.sh"
+    TARGET_BOOTSTRAPPER_TASK_device-info-collector[workdir] = "/usr/bin"
+    TARGET_BOOTSTRAPPER_TASK_device-info-collector[effort] = "1"
diff --git a/meta-isar/recipes-installer/device-info-collector/device-info-collector.bb b/meta-isar/recipes-installer/device-info-collector/device-info-collector.bb
new file mode 100644
index 00000000..e858869c
--- /dev/null
+++ b/meta-isar/recipes-installer/device-info-collector/device-info-collector.bb
@@ -0,0 +1,27 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2024-2025
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-raw
+
+DEBIAN_DEPENDS += "\
+	, dmidecode \
+	, lshw, pci.ids, usb.ids \
+	, pciutils \
+	, usbutils \
+	, util-linux \
+	"
+
+SRC_URI += " \
+	file://usr/bin/device-info-collector.sh \
+	"
+
+do_install[cleandirs] = " \
+	${D}/usr/bin/ \
+	${D}/usr/lib/device-info-collector/ \
+	${D}/install/device-infos/ \
+	"
+do_install() {
+	install -m 0755  ${WORKDIR}/usr/bin/device-info-collector.sh ${D}/usr/bin/device-info-collector.sh
+}
diff --git a/meta-isar/recipes-installer/device-info-collector/files/usr/bin/device-info-collector.sh b/meta-isar/recipes-installer/device-info-collector/files/usr/bin/device-info-collector.sh
new file mode 100755
index 00000000..257d80a1
--- /dev/null
+++ b/meta-isar/recipes-installer/device-info-collector/files/usr/bin/device-info-collector.sh
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2024-2025
+#
+# SPDX-License-Identifier: MIT
+
+BASE_DIR="/install/device-infos"
+
+SERIAL_NUMBER=$(dmidecode -s system-serial-number | tr '[:upper:]' '[:lower:]' | tr -d "[:space:]")
+TARGET_DIR="${BASE_DIR}/${SERIAL_NUMBER}/$(date -u +%4Y-%m-%d_%H-%S)"
+
+echo "Use ${TARGET_DIR} to store the collected device infos."
+mkdir -p ${TARGET_DIR}
+
+echo "Collecting most important device attributes..."
+
+echo "Collecting peripherals"
+lshw >> ${TARGET_DIR}/lshw.out
+lspci >> ${TARGET_DIR}/lspci.out
+lsusb >> ${TARGET_DIR}/lsusb.out
+lsblk >> ${TARGET_DIR}/lsblk.out
+
+echo "Collecting cpu info..."
+lscpu >> ${TARGET_DIR}/lscpu.out
+cat /proc/cpuinfo > ${TARGET_DIR}/proc_cpuinfo
+
+echo "Collecting dmi / smbios..."
+dmidecode --dump-bin ${TARGET_DIR}/dmidecode.dump
-- 
2.39.5

-- 
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/20250922170445.1393839-7-alexander.heinisch%40siemens.com.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/6] Add target bootstrapper framework
  2025-09-22 17:04 [PATCH 0/6] Add target bootstrapper framework alexander.heinisch via isar-users
                   ` (5 preceding siblings ...)
  2025-09-22 17:04 ` [PATCH 6/6] isar-installer: Added example target bootstrapper task to collect device information alexander.heinisch via isar-users
@ 2025-10-14 14:59 ` Zhihang Wei
  6 siblings, 0 replies; 8+ messages in thread
From: Zhihang Wei @ 2025-10-14 14:59 UTC (permalink / raw)
  To: alexander.heinisch, isar-users

Applied to next, thanks.

On 9/22/25 19:04, alexander.heinisch via isar-users wrote:
> From: Alexander Heinisch<alexander.heinisch@siemens.com>
>
> Currently the installer deploys images embedded to itself.
>
> In many situations this is fine, but for some more demanding requirements
> are in place. e.g.:
> - enrollment of keys (e.g. Secure Boot),
> - setup for disk encryption,
> - collection and reporting of device information (serial number, mac addresses, ...)
> - resize / repartition of disk during comissioning
> - generation of a commissioning report
>
> While many of these tasks can be done on first-boot doing so during
> device setup can be beneficial in many cases.
> e.g.
> - additional time required for "first-boot" when performing tasks
> with high effort on site may not be desired
> - the comissioning environment oftentimes allows for failures during
> that phase - worst case the device is put aside. On site failures during
> the wrong bootstrapping phases (secure boot setup, disk encryption)
> can be severe.
>
> This patch extends current installer behaviour to support a flexible
> framework to define multiple tasks to be executed in sequence during
> the "target (device) bootstrapping" phase.
>
> Note: Current patchset uses installer and target-bootstrapper interchangeably.
> Imo the name target-bootstrapper fits better to the actual purpose,
> while installer is already established for some time in isar and changing
> the naming would probably break some downstream. Although, that could be
> fixed in a backwards compatible way, I left this exercise open upon agreement.
>
> Alexander Heinisch (6):
>    isar-installer: Moved installer related Kconfig to separate file.
>    isar-installer: Added target bootstrapper framework
>    isar-installer: Use target-bootstrapper-service in favour of
>      deploy-image-service
>    isar-installer: Removed deploy-image-service
>    isar-installer: Fixing race between ttys in unattended mode.
>    isar-installer: Added example target bootstrapper task to collect
>      device information.
>
>   kas/image/Kconfig                             |  83 ++------------
>   kas/image/isar-image-installer.yaml           |   6 +
>   kas/installer/Kconfig                         | 104 ++++++++++++++++++
>   kas/installer/add-device-info-collector.yaml  |  14 +++
>   kas/installer/unattended.yaml                 |  18 +++
>   meta-isar/classes/target-bootstrapper.bbclass |  37 +++++++
>   .../images/isar-image-installer.bb            |   2 +-
>   .../deploy-image-service.bb                   |  21 ----
>   .../files/install.override.conf               |   5 -
>   .../device-info-collector.bb                  |  27 +++++
>   .../files/usr/bin/device-info-collector.sh    |  28 +++++
>   .../files/target-bootstrapper.override.conf   |   3 +
>   .../target-bootstrapper-service.bb            |  38 +++++++
>   .../files/target-bootstrapper.sh.tmpl         |  44 ++++++++
>   .../target-bootstrapper.bb                    |  41 +++++++
>   15 files changed, 369 insertions(+), 102 deletions(-)
>   create mode 100644 kas/installer/Kconfig
>   create mode 100644 kas/installer/add-device-info-collector.yaml
>   create mode 100644 kas/installer/unattended.yaml
>   create mode 100644 meta-isar/classes/target-bootstrapper.bbclass
>   delete mode 100644 meta-isar/recipes-installer/deploy-image-service/deploy-image-service.bb
>   delete mode 100644 meta-isar/recipes-installer/deploy-image-service/files/install.override.conf
>   create mode 100644 meta-isar/recipes-installer/device-info-collector/device-info-collector.bb
>   create mode 100755 meta-isar/recipes-installer/device-info-collector/files/usr/bin/device-info-collector.sh
>   create mode 100644 meta-isar/recipes-installer/target-bootstrapper-service/files/target-bootstrapper.override.conf
>   create mode 100644 meta-isar/recipes-installer/target-bootstrapper-service/target-bootstrapper-service.bb
>   create mode 100644 meta-isar/recipes-installer/target-bootstrapper/files/target-bootstrapper.sh.tmpl
>   create mode 100644 meta-isar/recipes-installer/target-bootstrapper/target-bootstrapper.bb
>
> --
> 2.39.5
>

-- 
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/03775d5b-497a-4935-91ca-ac4b81086e9b%40ilbers.de.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-10-14 15:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-22 17:04 [PATCH 0/6] Add target bootstrapper framework alexander.heinisch via isar-users
2025-09-22 17:04 ` [PATCH 1/6] isar-installer: Moved installer related Kconfig to separate file alexander.heinisch via isar-users
2025-09-22 17:04 ` [PATCH 2/6] isar-installer: Added target bootstrapper framework alexander.heinisch via isar-users
2025-09-22 17:04 ` [PATCH 3/6] isar-installer: Use target-bootstrapper-service in favour of deploy-image-service alexander.heinisch via isar-users
2025-09-22 17:04 ` [PATCH 4/6] isar-installer: Removed deploy-image-service alexander.heinisch via isar-users
2025-09-22 17:04 ` [PATCH 5/6] isar-installer: Fixing race between ttys in unattended mode alexander.heinisch via isar-users
2025-09-22 17:04 ` [PATCH 6/6] isar-installer: Added example target bootstrapper task to collect device information alexander.heinisch via isar-users
2025-10-14 14:59 ` [PATCH 0/6] Add target bootstrapper framework Zhihang Wei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox