All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Zanussi <tom.zanussi@intel.com>
To: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH v2] wic: squashfs partition support
Date: Thu, 24 Jul 2014 19:00:56 -0500	[thread overview]
Message-ID: <1406246456.6205.11.camel@empanada> (raw)
In-Reply-To: <1406203910-16569-1-git-send-email-maciej.borzecki@open-rnd.pl>

On Thu, 2014-07-24 at 14:11 +0200, Maciej Borzecki wrote:
> It is possible to instruct wic to create a squashfs partition by setting
> --fstype=squashfs in *.wks. For now this is only useable for rootfs
> partitions (note that you must have squashfs support in the kernel). An
> attempt to create an empty partition will produce a warning.
> 
> Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>

Acked-by: Tom Zanussi <tom.zanussi@intel.com>

> ---
>  .../lib/mic/kickstart/custom_commands/partition.py | 61 ++++++++++++++++++++++
>  1 file changed, 61 insertions(+)
> 
> diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
> index d0f1b78..ce90aa1 100644
> --- a/scripts/lib/mic/kickstart/custom_commands/partition.py
> +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
> @@ -25,6 +25,8 @@
>  #
>  
>  import shutil
> +import os
> +import tempfile
>  
>  from pykickstart.commands.partition import *
>  from mic.utils.oe.misc import *
> @@ -192,6 +194,10 @@ class Wic_PartData(Mic_PartData):
>              return self.prepare_rootfs_vfat(cr_workdir, oe_builddir,
>                                              rootfs_dir, native_sysroot,
>                                              pseudo)
> +        elif self.fstype.startswith("squashfs"):
> +            return self.prepare_rootfs_squashfs(cr_workdir, oe_builddir,
> +                                                rootfs_dir, native_sysroot,
> +                                                pseudo)
>  
>      def prepare_rootfs_ext(self, cr_workdir, oe_builddir, rootfs_dir,
>                             native_sysroot, pseudo):
> @@ -324,6 +330,28 @@ class Wic_PartData(Mic_PartData):
>          self.set_size(rootfs_size)
>          self.set_source_file(rootfs)
>  
> +    def prepare_rootfs_squashfs(self, cr_workdir, oe_builddir, rootfs_dir,
> +                                native_sysroot, pseudo):
> +        """
> +        Prepare content for a squashfs rootfs partition.
> +        """
> +        image_rootfs = rootfs_dir
> +        rootfs = "%s/rootfs_%s.%s" % (cr_workdir, self.label ,self.fstype)
> +
> +        squashfs_cmd = "mksquashfs %s %s -noappend" % \
> +                       (image_rootfs, rootfs)
> +        rc, out = exec_native_cmd(pseudo + squashfs_cmd, native_sysroot)
> +
> +        # get the rootfs size in the right units for kickstart (Mb)
> +        du_cmd = "du -Lbms %s" % rootfs
> +        rc, out = exec_cmd(du_cmd)
> +        rootfs_size = out.split()[0]
> +
> +        self.size = rootfs_size
> +        self.source_file = rootfs
> +
> +        return 0
> +
>      def prepare_empty_partition(self, cr_workdir, oe_builddir, native_sysroot):
>          """
>          Prepare an empty partition.
> @@ -337,6 +365,9 @@ class Wic_PartData(Mic_PartData):
>          elif self.fstype.startswith("vfat"):
>              return self.prepare_empty_partition_vfat(cr_workdir, oe_builddir,
>                                                       native_sysroot)
> +        elif self.fstype.startswith("squashfs"):
> +            return self.prepare_empty_partition_squashfs(cr_workdir, oe_builddir,
> +                                                         native_sysroot)
>  
>      def prepare_empty_partition_ext(self, cr_workdir, oe_builddir,
>                                      native_sysroot):
> @@ -398,6 +429,36 @@ class Wic_PartData(Mic_PartData):
>  
>          return 0
>  
> +    def prepare_empty_partition_squashfs(self, cr_workdir, oe_builddir,
> +                                         native_sysroot):
> +        """
> +        Prepare an empty squashfs partition.
> +        """
> +        msger.warning("Creating of an empty squashfs %s partition was attempted. " \
> +                      "Proceeding as requested." % self.mountpoint)
> +
> +        fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
> +
> +        # it is not possible to create a squashfs without source data,
> +        # thus prepare an empty temp dir that is used as source
> +        tmpdir = tempfile.mkdtemp()
> +
> +        squashfs_cmd = "mksquashfs %s %s -noappend" % \
> +                       (tmpdir, fs)
> +        rc, out = exec_native_cmd(squashfs_cmd, native_sysroot)
> +
> +        os.rmdir(tmpdir)
> +
> +        # get the rootfs size in the right units for kickstart (Mb)
> +        du_cmd = "du -Lbms %s" % fs
> +        rc, out = exec_cmd(du_cmd)
> +        fs_size = out.split()[0]
> +
> +        self.size = fs_size
> +        self.source_file = fs
> +
> +        return 0
> +
>      def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot):
>          """
>          Prepare a swap partition.




      reply	other threads:[~2014-07-25  0:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 10:37 [PATCH] wic: squashfs partition support Maciej Borzecki
2014-07-23 20:21 ` Tom Zanussi
2014-07-23 20:33   ` Maciek Borzecki
2014-07-23 20:39     ` Tom Zanussi
2014-07-24 12:11       ` [PATCH v2] " Maciej Borzecki
2014-07-25  0:00         ` Tom Zanussi [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=1406246456.6205.11.camel@empanada \
    --to=tom.zanussi@intel.com \
    --cc=maciej.borzecki@open-rnd.pl \
    --cc=openembedded-core@lists.openembedded.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.