From: Quirin Gylstorff <Quirin.Gylstorff@siemens.com>
To: felix.moessbauer@siemens.com, isar-users@googlegroups.com
Subject: [PATCH v2 2/2] isar-installer: use rootfs-add-files class instead of seperate package
Date: Fri, 22 Mar 2024 15:10:33 +0100 [thread overview]
Message-ID: <20240322141050.256793-3-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <20240322141050.256793-1-Quirin.Gylstorff@siemens.com>
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
This reduces the sstate size and speed up the build.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
.../classes/installer-add-rootfs.bbclass | 43 +++++++++++++++++++
.../images/isar-image-installer.bb | 2 +-
.../deploy-image/deploy-image_0.1.bb | 3 +-
.../store-target-image_0.1.bb | 25 -----------
4 files changed, 45 insertions(+), 28 deletions(-)
create mode 100644 meta-isar/classes/installer-add-rootfs.bbclass
delete mode 100644 meta-isar/recipes-installer/store-target-image/store-target-image_0.1.bb
diff --git a/meta-isar/classes/installer-add-rootfs.bbclass b/meta-isar/classes/installer-add-rootfs.bbclass
new file mode 100644
index 00000000..765e10ac
--- /dev/null
+++ b/meta-isar/classes/installer-add-rootfs.bbclass
@@ -0,0 +1,43 @@
+# Copy the target image to the installer image
+#
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2024
+#
+# SPDX-License-Identifier: MIT
+
+inherit rootfs-add-files
+
+INSTALLER_MC ??= "isar-installer"
+INSTALLER_TARGET_IMAGE ??= "isar-image-base"
+INSTALLER_TARGET_MC ??= "installer-target"
+INSTALLER_TARGET_DISTRO ??= "${DISTRO}"
+INSTALLER_TARGET_MACHINE ??= "${MACHINE}"
+
+IMAGE_DATA_FILE ??= "${INSTALLER_TARGET_IMAGE}-${INSTALLER_TARGET_DISTRO}-${INSTALLER_TARGET_MACHINE}"
+IMAGE_DATA_POSTFIX ??= "wic.zst"
+IMAGE_DATA_POSTFIX:buster ??= "wic.xz"
+IMAGE_DATA_POSTFIX:bullseye ??= "wic.xz"
+
+ROOTFS_ADDITIONAL_FILES ??= "installer-target"
+
+def get_installer_source(d):
+ installer_target_image = d.getVar('INSTALLER_TARGET_IMAGE') or ""
+ if not installer_target_image:
+ return ""
+ deploy_dir = d.getVar('DEPLOY_DIR_IMAGE')
+ image_data = d.getVar('IMAGE_DATA_FILE')
+ image_data_postfix = d.getVar('IMAGE_DATA_POSTFIX')
+ return f"{deploy_dir}/{image_data}.{image_data_postfix}"
+
+def get_installer_destination(d):
+ installer_target_image = d.getVar('INSTALLER_TARGET_IMAGE') or ""
+ if not installer_target_image:
+ return "/install/keep"
+ image_data = d.getVar('IMAGE_DATA_FILE')
+ image_data_postfix = d.getVar('IMAGE_DATA_POSTFIX')
+ return f"/install/{image_data}.{image_data_postfix}"
+
+ROOTFS_ADDITIONAL_FILE_installer-target[source] = "${@ get_installer_source(d)}"
+ROOTFS_ADDITIONAL_FILE_installer-target[destination] = "${@ get_installer_destination(d)}"
+
+do_rootfs_install[mcdepends] += "mc:${INSTALLER_MC}:${INSTALLER_TARGET_MC}:${INSTALLER_TARGET_IMAGE}:do_image_wic"
diff --git a/meta-isar/recipes-core/images/isar-image-installer.bb b/meta-isar/recipes-core/images/isar-image-installer.bb
index 27de03d5..34fb5daf 100644
--- a/meta-isar/recipes-core/images/isar-image-installer.bb
+++ b/meta-isar/recipes-core/images/isar-image-installer.bb
@@ -4,6 +4,7 @@
# SPDX-License-Identifier: MIT
inherit image
+inherit installer-add-rootfs
DESCRIPTION = "Example of a ISAR based Installer Image"
# Use variable to switch easily to another wks
@@ -11,7 +12,6 @@ INSTALLER_WKS_FILE ??= "installer-efi.wks.in"
WKS_FILE = "${INSTALLER_WKS_FILE}"
IMAGER_INSTALL:wic:append = " systemd-boot"
-IMAGE_INSTALL += "store-target-image"
IMAGE_INSTALL += "deploy-image"
IMAGE_INSTALL:remove = "expand-on-first-boot"
diff --git a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
index ea047849..0e61de03 100644
--- a/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
+++ b/meta-isar/recipes-installer/deploy-image/deploy-image_0.1.bb
@@ -11,8 +11,7 @@ inherit dpkg-raw
SRC_URI = "file://deploy-image-wic.sh \
file://install.override.conf \
"
-DEPENDS = "store-target-image"
-DEBIAN_DEPENDS = "store-target-image, bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
+DEBIAN_DEPENDS = "bmap-tools, pv, dialog, util-linux, parted, fdisk, gdisk, pigz, xz-utils, pbzip2, zstd"
do_install[cleandirs] = "${D}/usr/bin/ \
${D}/usr/lib/systemd/system/getty@tty1.service.d/ \
${D}/usr/lib/systemd/system/serial-getty@ttyS0.service.d/"
diff --git a/meta-isar/recipes-installer/store-target-image/store-target-image_0.1.bb b/meta-isar/recipes-installer/store-target-image/store-target-image_0.1.bb
deleted file mode 100644
index 2f72412b..00000000
--- a/meta-isar/recipes-installer/store-target-image/store-target-image_0.1.bb
+++ /dev/null
@@ -1,25 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) Siemens AG, 2024
-#
-# SPDX-License-Identifier: MIT
-
-DESCRIPTION = "Add a given target image to rootfs"
-
-inherit dpkg-raw
-
-INSTALLER_TARGET_IMAGE ??= "isar-image-base"
-IMG_DATA_FILE ??= "${INSTALLER_TARGET_IMAGE}-${DISTRO}-${MACHINE}"
-IMG_DATA_POSTFIX ??= "wic.zst"
-IMG_DATA_POSTFIX:buster ??= "wic.xz"
-IMG_DATA_POSTFIX:bullseye ??= "wic.xz"
-do_install[mcdepends] = "${@ 'mc:isar-installer:installer-target:' + d.getVar('INSTALLER_TARGET_IMAGE') + ':do_image_wic' if d.getVar('INSTALLER_TARGET_IMAGE') else ''}"
-do_install[cleandirs] = "${D}/install/"
-do_install() {
- if [ -f ${DEPLOY_DIR_IMAGE}/${IMG_DATA_FILE}.${IMG_DATA_POSTFIX} ]; then
- install -m 0600 ${DEPLOY_DIR_IMAGE}/${IMG_DATA_FILE}.${IMG_DATA_POSTFIX} ${D}/install/
- install -m 0600 ${DEPLOY_DIR_IMAGE}/${IMG_DATA_FILE}.wic.bmap ${D}/install/
- else
- # mcopy cannot handle .keep or empty directory , therefore use visible file
- touch ${D}/install/keep
- fi
-}
--
2.43.0
prev parent reply other threads:[~2024-03-22 14:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-22 14:10 [PATCH v2 0/2] Isar installer copy installer-target direct to rootfs Quirin Gylstorff
2024-03-22 14:10 ` [PATCH v2 1/2] add new class to add files directly to the rootfs Quirin Gylstorff
2024-03-25 14:45 ` MOESSBAUER, Felix
2024-03-22 14:10 ` Quirin Gylstorff [this message]
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=20240322141050.256793-3-Quirin.Gylstorff@siemens.com \
--to=quirin.gylstorff@siemens.com \
--cc=felix.moessbauer@siemens.com \
--cc=isar-users@googlegroups.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