All of lore.kernel.org
 help / color / mirror / Atom feed
* Allow specifying sub directories for rootfs when using wic -e
@ 2017-11-17 16:19 Volker Vogelhuber
  2017-11-17 16:19 ` [PATCH] Allow specifying subdir " Volker Vogelhuber
  0 siblings, 1 reply; 3+ messages in thread
From: Volker Vogelhuber @ 2017-11-17 16:19 UTC (permalink / raw)
  To: yocto

I currently have an image with six different partitions. See the 
following partition configuration:

># bootloader
>part /boot/EFI --source bootimg-efi --sourceparams="loader=systemd-boot" --ondisk mmcblk --fstype=vfat --label boot --active --align 1024 --size 20 --overhead-factor=1.0 --uuid="1EFC2AC2-449B-6ABB-AA63-7EA004446DF1"
>
>#--use-uuid
># primary / recovery image
>part / --source rootfs --rootfs-dir=image --exclude-path opt/something/ opt/else/ opt/somemore/ --ondisk mmcblk --fstype=ext4 --label primary_rootfs --align 1024 --size 768 --overhead-factor=1.0 --uuid="2779D408-1362-AEF5-AEB1-00BF5674C065"
>part /recovery --source rootfs --rootfs-dir=image-recovery --ondisk mmcblk --fstype=ext4 --label recovery_rootfs --align 1024 --size 640 --overhead-factor=1.0 --uuid="528B6F25-5143-47B3-8D12-391820EAF1CF"
>
># additional partitions
>part /opt/something --source rootfs --rootfs-dir=image --rootfs-subdir=opt/something --ondisk mmcblk --fstype=ext4 --label persist --align 1024 --size 64 --overhead-factor=1.0 --use-uuid
>part /opt/else --source rootfs --rootfs-dir=image --rootfs-subdir=opt/else --ondisk mmcblk --fstype=ext4 --label de --align 1024 --size 256 --overhead-factor=1.0 --use-uuid
>part /opt/somemore --source rootfs --rootfs-dir=image --rootfs-subdir=opt/somemore --ondisk mmcblk --fstype=ext4 --label data --align 1024 --size 1700 --overhead-factor=1.0 --use-uuid
>
>bootloader --timeout=0 --ptable gpt --configfile="disk.cfg"

My problem is now that if I use the wic -e option to specify an image 
name as rootfs-dir I can not extract subdirectories from the rootfs 
to different partitions. Or at least I didn't found out a way.
That's why I added a rootfs-subdir option to wic that allows appending 
a rootfs dir to the one received by IMAGE_ROOTFS. I read something 
about spliting should be done on recipe level 
(https://lists.yoctoproject.org/pipermail/yocto/2016-March/029301.html), 
but I couldn't figure out how that should be done and that patch seems 
much easier for me.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Allow specifying subdir for rootfs when using wic -e
  2017-11-17 16:19 Allow specifying sub directories for rootfs when using wic -e Volker Vogelhuber
@ 2017-11-17 16:19 ` Volker Vogelhuber
  2017-11-17 18:19   ` Leonardo Sandoval
  0 siblings, 1 reply; 3+ messages in thread
From: Volker Vogelhuber @ 2017-11-17 16:19 UTC (permalink / raw)
  To: yocto; +Cc: Volker Vogelhuber

---
 scripts/lib/wic/ksparser.py              | 1 +
 scripts/lib/wic/partition.py             | 1 +
 scripts/lib/wic/plugins/source/rootfs.py | 7 ++++---
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 99b66eebc5..a9e07fcd2f 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -146,6 +146,7 @@ class KickStart():
         part.add_argument("--overhead-factor", type=overheadtype)
         part.add_argument('--part-type')
         part.add_argument('--rootfs-dir')
+        part.add_argument('--rootfs-subdir')
 
         # --size and --fixed-size cannot be specified together; options
         # ----extra-space and --overhead-factor should also raise a parser
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index b623bb9e6d..b42529ce48 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -53,6 +53,7 @@ class Partition():
         self.overhead_factor = args.overhead_factor
         self.part_type = args.part_type
         self.rootfs_dir = args.rootfs_dir
+        self.rootfs_subdir = args.rootfs_subdir
         self.size = args.size
         self.fixed_size = args.fixed_size
         self.source = args.source
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index aec720fb22..8dcf5a2872 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -83,7 +83,7 @@ class RootfsPlugin(SourcePlugin):
 
         part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
 
-        new_rootfs = None
+        new_rootfs = part.rootfs_dir
         # Handle excluded paths.
         if part.exclude_path is not None:
             # We need a new rootfs directory we can delete files from. Copy to
@@ -121,6 +121,7 @@ class RootfsPlugin(SourcePlugin):
                 else:
                     # Delete whole directory.
                     shutil.rmtree(full_path)
-
+        if not part.rootfs_subdir is None:
+            new_rootfs = os.path.join(new_rootfs, part.rootfs_subdir)
         part.prepare_rootfs(cr_workdir, oe_builddir,
-                            new_rootfs or part.rootfs_dir, native_sysroot)
+                            new_rootfs, native_sysroot)
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Allow specifying subdir for rootfs when using wic -e
  2017-11-17 16:19 ` [PATCH] Allow specifying subdir " Volker Vogelhuber
@ 2017-11-17 18:19   ` Leonardo Sandoval
  0 siblings, 0 replies; 3+ messages in thread
From: Leonardo Sandoval @ 2017-11-17 18:19 UTC (permalink / raw)
  To: Volker Vogelhuber; +Cc: yocto

wic stuff goes into the openembededde-core mailing list. in fact, most files under the scripts folder goes into the latter.

On Fri, 17 Nov 2017 17:19:48 +0100
Volker Vogelhuber <v.vogelhuber@digitalendoscopy.de> wrote:

> ---
>  scripts/lib/wic/ksparser.py              | 1 +
>  scripts/lib/wic/partition.py             | 1 +
>  scripts/lib/wic/plugins/source/rootfs.py | 7 ++++---
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
> index 99b66eebc5..a9e07fcd2f 100644
> --- a/scripts/lib/wic/ksparser.py
> +++ b/scripts/lib/wic/ksparser.py
> @@ -146,6 +146,7 @@ class KickStart():
>          part.add_argument("--overhead-factor", type=overheadtype)
>          part.add_argument('--part-type')
>          part.add_argument('--rootfs-dir')
> +        part.add_argument('--rootfs-subdir')
>  
>          # --size and --fixed-size cannot be specified together; options
>          # ----extra-space and --overhead-factor should also raise a parser
> diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
> index b623bb9e6d..b42529ce48 100644
> --- a/scripts/lib/wic/partition.py
> +++ b/scripts/lib/wic/partition.py
> @@ -53,6 +53,7 @@ class Partition():
>          self.overhead_factor = args.overhead_factor
>          self.part_type = args.part_type
>          self.rootfs_dir = args.rootfs_dir
> +        self.rootfs_subdir = args.rootfs_subdir
>          self.size = args.size
>          self.fixed_size = args.fixed_size
>          self.source = args.source
> diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
> index aec720fb22..8dcf5a2872 100644
> --- a/scripts/lib/wic/plugins/source/rootfs.py
> +++ b/scripts/lib/wic/plugins/source/rootfs.py
> @@ -83,7 +83,7 @@ class RootfsPlugin(SourcePlugin):
>  
>          part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
>  
> -        new_rootfs = None
> +        new_rootfs = part.rootfs_dir
>          # Handle excluded paths.
>          if part.exclude_path is not None:
>              # We need a new rootfs directory we can delete files from. Copy to
> @@ -121,6 +121,7 @@ class RootfsPlugin(SourcePlugin):
>                  else:
>                      # Delete whole directory.
>                      shutil.rmtree(full_path)
> -
> +        if not part.rootfs_subdir is None:
> +            new_rootfs = os.path.join(new_rootfs, part.rootfs_subdir)
>          part.prepare_rootfs(cr_workdir, oe_builddir,
> -                            new_rootfs or part.rootfs_dir, native_sysroot)
> +                            new_rootfs, native_sysroot)
> -- 
> 2.11.0
> 
> -- 
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-17 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-17 16:19 Allow specifying sub directories for rootfs when using wic -e Volker Vogelhuber
2017-11-17 16:19 ` [PATCH] Allow specifying subdir " Volker Vogelhuber
2017-11-17 18:19   ` Leonardo Sandoval

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.