All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Q. Gylstorff" <Quirin.Gylstorff@siemens.com>,
	cip-dev@lists.cip-project.org
Subject: Re: [cip-dev][isar-cip-core][RFC 1/8] Add new class to create a squashfs based root file system
Date: Fri, 12 Nov 2021 13:41:44 +0100	[thread overview]
Message-ID: <84cdc4e8-b077-ec4a-ef97-eab061bab14f@siemens.com> (raw)
In-Reply-To: <20211112115017.401779-2-Quirin.Gylstorff@siemens.com>

On 12.11.21 12:50, Q. Gylstorff wrote:
> 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 | 42 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 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..f827e8c
> --- /dev/null
> +++ b/classes/squashfs-img.bbclass
> @@ -0,0 +1,42 @@
> +#
> +# 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 ?= " "

Blank line after this.

> +# Generate squashfs filesystem image

I don't think the anonymous function does that...

> +python __anonymous() {
> +    exclude_directories = (d.getVar('SQUASHFS_EXCLUDE_DIRS') or "").split()
> +    if len(exclude_directories) == 0:
> +        return
> +    args=d.getVar('SQUASHFS_CREATION_ARGS')
> +    args+=" -wildcards"
> +    # use wildcard to exclude only content of the the directory
> +    # this allows to use the directory as a mount point
> +    for dir in exclude_directories:
> +        args+=" -e {dir}/* ".format(dir=dir)
> +    d.setVar('SQUASHFS_CREATION_ARGS', args)

How about d.appendVar?

And Python style for python functions, please.

> +}
> +
> +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
> 

This should also qualify as generic Isar class. It can start here, though.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


  reply	other threads:[~2021-11-12 12:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12 11:50 [cip-dev][isar-cip-core][RFC 0/8] Read-only root file system with dm-verity Q. Gylstorff
2021-11-12 11:50 ` [cip-dev][isar-cip-core][RFC 1/8] Add new class to create a squashfs based root file system Q. Gylstorff
2021-11-12 12:41   ` Jan Kiszka [this message]
2021-11-12 11:50 ` [PATCH] recipes-core/swupdate: Update the SRC_URI and SWUPDATE_BUILD_PROFILES append for buster Q. Gylstorff
2021-11-12 11:58   ` [cip-dev] " Gylstorff Quirin
2021-11-12 11:50 ` [cip-dev][isar-cip-core][RFC 2/8] Add classes for dm-verity based rootfs Q. Gylstorff
2021-11-12 11:50 ` [cip-dev][isar-cip-core][RFC 3/8] linux-cip-common: Add options necessary for dm-verity Q. Gylstorff
2021-11-12 12:46   ` Jan Kiszka
2021-11-16 10:43     ` Gylstorff Quirin
2021-11-12 11:50 ` [cip-dev][isar-cip-core][RFC 4/8] Create a initrd with support " Q. Gylstorff
2021-11-12 12:47   ` Jan Kiszka
     [not found]   ` <39f049c6-510a-5ac4-6e73-8a865e95405e@siemens.com>
2021-11-15 18:43     ` Gylstorff Quirin
2021-11-12 11:50 ` [cip-dev][isar-cip-core][RFC 5/8] Create an read-only rootfs with dm-verity Q. Gylstorff
2021-11-12 12:53   ` Jan Kiszka
2021-11-12 11:50 ` [cip-dev][isar-cip-core][RFC 6/8] Create systemd mount units for a etc overlay Q. Gylstorff
2021-11-12 11:50 ` [cip-dev][isar-cip-core][RFC 7/8] Mount writable home partition Q. Gylstorff
2021-11-12 11:50 ` [cip-dev][isar-cip-core][RFC 8/8] 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=84cdc4e8-b077-ec4a-ef97-eab061bab14f@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Quirin.Gylstorff@siemens.com \
    --cc=cip-dev@lists.cip-project.org \
    /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.