public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "alexander.heinisch via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Alexander Heinisch <alexander.heinisch@siemens.com>
Subject: [PATCH 6/6] isar-installer: Added example target bootstrapper task to collect device information.
Date: Mon, 22 Sep 2025 19:04:45 +0200	[thread overview]
Message-ID: <20250922170445.1393839-7-alexander.heinisch@siemens.com> (raw)
In-Reply-To: <20250922170445.1393839-1-alexander.heinisch@siemens.com>

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.

  parent reply	other threads:[~2025-09-22 17:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` alexander.heinisch via isar-users [this message]
2025-10-14 14:59 ` [PATCH 0/6] Add target bootstrapper framework Zhihang Wei

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=20250922170445.1393839-7-alexander.heinisch@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=alexander.heinisch@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