All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Q. Gylstorff" <Quirin.Gylstorff@siemens.com>
To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com,
	christian.storm@siemens.com
Subject: [cip-dev][isar-cip-core][RFC v3 1/9] Add new class to create a squashfs based root file system
Date: Tue, 23 Nov 2021 15:57:39 +0100	[thread overview]
Message-ID: <20211123145747.101549-2-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <20211123145747.101549-1-Quirin.Gylstorff@siemens.com>

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

This file system is read only and use a reduced image size.

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

diff --git a/classes/squashfs-img.bbclass b/classes/squashfs-img.bbclass
new file mode 100644
index 0000000..0fcfca5
--- /dev/null
+++ b/classes/squashfs-img.bbclass
@@ -0,0 +1,41 @@
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2021
+#
+# Authors:
+#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+SQUASHFS_IMAGE_FILE = "${IMAGE_FULLNAME}.squashfs.img"
+
+IMAGER_INSTALL += "squashfs-tools"
+
+SQUASHFS_EXCLUDE_DIRS ?= ""
+SQUASHFS_CONTENT ?= "${PP_ROOTFS}"
+SQUASHFS_CREATION_ARGS ?= " "
+# Generate squashfs filesystem image
+python __anonymous() {
+    exclude_directories = (d.getVar('SQUASHFS_EXCLUDE_DIRS') or "").split()
+    if len(exclude_directories) == 0:
+        return
+    # use wildcard to exclude only content of the the directory
+    # this allows to use the directory as a mount point
+    args = " -wildcards"
+    for dir in exclude_directories:
+        args += " -e {dir}/* ".format(dir=dir)
+    d.appendVar('SQUASHFS_CREATION_ARGS', args)
+}
+
+do_squashfs_image() {
+    rm -f '${DEPLOY_DIR_IMAGE}/${SQUASHFS_IMAGE_FILE}'
+
+    image_do_mounts
+
+    sudo chroot "${BUILDCHROOT_DIR}" /bin/mksquashfs  \
+        "${SQUASHFS_CONTENT}" "${PP_DEPLOY}/${SQUASHFS_IMAGE_FILE}" \
+        ${SQUASHFS_CREATION_ARGS}
+}
+addtask do_squashfs_image before do_image after do_image_tools do_excl_directories
-- 
2.30.2



  reply	other threads:[~2021-11-23 14:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 14:57 [cip-dev][isar-cip-core][RFC v3 0/9] Read-only root file system with dm-verity Q. Gylstorff
2021-11-23 14:57 ` Q. Gylstorff [this message]
2021-11-23 14:57 ` [cip-dev][isar-cip-core][RFC v3 2/9] Add verity-img.bbclass for dm-verity based rootfs Q. Gylstorff
2021-11-23 14:57 ` [cip-dev][isar-cip-core][RFC v3 3/9] linux-cip-common: Add options necessary for dm-verity Q. Gylstorff
2021-11-23 14:57 ` [cip-dev][isar-cip-core][RFC v3 4/9] Create a initrd with support " Q. Gylstorff
2021-11-23 14:57 ` [cip-dev][isar-cip-core][RFC v3 5/9] Create an read-only rootfs with dm-verity Q. Gylstorff
2021-11-24 11:43   ` Jan Kiszka
2021-11-23 14:57 ` [cip-dev][isar-cip-core][RFC v3 6/9] Create systemd mount units for a etc overlay Q. Gylstorff
2021-11-23 14:57 ` [cip-dev][isar-cip-core][RFC v3 7/9] Mount writable home partition Q. Gylstorff
2021-11-23 14:57 ` [cip-dev][isar-cip-core][RFC v3 8/9] kas: Patch isar for correct permissions in var and home Q. Gylstorff
2021-11-23 14:57 ` [cip-dev][isar-cip-core][RFC v3 9/9] swupdate: Backport patches from SWUpdate Master Q. Gylstorff

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=20211123145747.101549-2-Quirin.Gylstorff@siemens.com \
    --to=quirin.gylstorff@siemens.com \
    --cc=christian.storm@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=jan.kiszka@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.