* [PATCH] wic: squashfs partition support @ 2014-07-23 10:37 Maciej Borzecki 2014-07-23 20:21 ` Tom Zanussi 0 siblings, 1 reply; 6+ messages in thread From: Maciej Borzecki @ 2014-07-23 10:37 UTC (permalink / raw) To: openembedded-core Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> --- .../lib/mic/kickstart/custom_commands/partition.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py index d0f1b78..c4d0113 100644 --- a/scripts/lib/mic/kickstart/custom_commands/partition.py +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py @@ -192,6 +192,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 +328,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. -- 1.9.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] wic: squashfs partition support 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 0 siblings, 1 reply; 6+ messages in thread From: Tom Zanussi @ 2014-07-23 20:21 UTC (permalink / raw) To: Maciej Borzecki; +Cc: openembedded-core Hi, please include a description for this. Also, it looks like this is missing the empty_partition() part? Thanks, Tom On Wed, 2014-07-23 at 12:37 +0200, Maciej Borzecki wrote: > Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> > --- > .../lib/mic/kickstart/custom_commands/partition.py | 26 ++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py > index d0f1b78..c4d0113 100644 > --- a/scripts/lib/mic/kickstart/custom_commands/partition.py > +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py > @@ -192,6 +192,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 +328,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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wic: squashfs partition support 2014-07-23 20:21 ` Tom Zanussi @ 2014-07-23 20:33 ` Maciek Borzecki 2014-07-23 20:39 ` Tom Zanussi 0 siblings, 1 reply; 6+ messages in thread From: Maciek Borzecki @ 2014-07-23 20:33 UTC (permalink / raw) To: Tom Zanussi; +Cc: openembedded-core On śro, 2014-07-23 at 15:21 -0500, Tom Zanussi wrote: > Hi, please include a description for this. Ok, will update with the rest of the patches. > > Also, it looks like this is missing the empty_partition() part? That's intentional. Squashfs, being read-only, is not really useful for a partition that is empty. You wouldn't be able to create files nor actually use it in a meaningful manner, unless it's combined with one of the merging filesystems like {union/au/overlay}fs. In this case the whole fs setup would be described in fstab. Though, it might make sense to raise a warning at least. > > Thanks, > > Tom > > On Wed, 2014-07-23 at 12:37 +0200, Maciej Borzecki wrote: > > Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> > > --- > > .../lib/mic/kickstart/custom_commands/partition.py | 26 ++++++++++++++++++++++ > > 1 file changed, 26 insertions(+) > > > > diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py > > index d0f1b78..c4d0113 100644 > > --- a/scripts/lib/mic/kickstart/custom_commands/partition.py > > +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py > > @@ -192,6 +192,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 +328,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. > > -- Maciej Borzęcki Senior Software Developer at Open-RnD Sp. z o.o., Poland www.open-rnd.pl mobile: +48 889 117 365, fax: +48 42 657 9079 Niniejsza wiadomość wraz z załącznikami może zawierać chronione prawem lub poufne informacje i została wysłana wyłącznie do wiadomości i użytku osób, do których została zaadresowana. Jeśli wiadomość została otrzymana przypadkowo zabrania się jej kopiowania lub rozsyłania do osób trzecich. W takim przypadku uprasza się o natychmiastowe zniszczenie wiadomości oraz poinformowanie nadawcy o zaistniałej sytuacji za pomocą wiadomości zwrotnej. Dziękujemy. This message, including any attachments hereto, may contain privileged or confidential information and is sent solely for the attention and use of the intended addressee(s). If you are not an intended addressee, you may neither use this message nor copy or deliver it to anyone. In such case, you should immediately destroy this message and kindly notify the sender by reply email. Thank you. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] wic: squashfs partition support 2014-07-23 20:33 ` Maciek Borzecki @ 2014-07-23 20:39 ` Tom Zanussi 2014-07-24 12:11 ` [PATCH v2] " Maciej Borzecki 0 siblings, 1 reply; 6+ messages in thread From: Tom Zanussi @ 2014-07-23 20:39 UTC (permalink / raw) To: maciej.borzecki; +Cc: openembedded-core On Wed, 2014-07-23 at 22:33 +0200, Maciek Borzecki wrote: > On śro, 2014-07-23 at 15:21 -0500, Tom Zanussi wrote: > > Hi, please include a description for this. > Ok, will update with the rest of the patches. > > > > > Also, it looks like this is missing the empty_partition() part? > That's intentional. Squashfs, being read-only, is not really useful for > a partition that is empty. You wouldn't be able to create files nor > actually use it in a meaningful manner, unless it's combined with one of > the merging filesystems like {union/au/overlay}fs. In this case the > whole fs setup would be described in fstab. > > Though, it might make sense to raise a warning at least. > Yeah, makes sense, please do add a warning in that case. Thanks, Tom > > > > > Thanks, > > > > Tom > > > > On Wed, 2014-07-23 at 12:37 +0200, Maciej Borzecki wrote: > > > Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> > > > --- > > > .../lib/mic/kickstart/custom_commands/partition.py | 26 ++++++++++++++++++++++ > > > 1 file changed, 26 insertions(+) > > > > > > diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py > > > index d0f1b78..c4d0113 100644 > > > --- a/scripts/lib/mic/kickstart/custom_commands/partition.py > > > +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py > > > @@ -192,6 +192,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 +328,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. > > > > > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] wic: squashfs partition support 2014-07-23 20:39 ` Tom Zanussi @ 2014-07-24 12:11 ` Maciej Borzecki 2014-07-25 0:00 ` Tom Zanussi 0 siblings, 1 reply; 6+ messages in thread From: Maciej Borzecki @ 2014-07-24 12:11 UTC (permalink / raw) To: openembedded-core 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> --- .../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. -- 1.9.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] wic: squashfs partition support 2014-07-24 12:11 ` [PATCH v2] " Maciej Borzecki @ 2014-07-25 0:00 ` Tom Zanussi 0 siblings, 0 replies; 6+ messages in thread From: Tom Zanussi @ 2014-07-25 0:00 UTC (permalink / raw) To: Maciej Borzecki; +Cc: openembedded-core 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-25 0:01 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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.