Patchwork wic: Use mke2fs to create the ext2/3/4 image

login
register
mail settings
Submitter João Henrique Freitas
Date March 8, 2014, 10:23 p.m.
Message ID <1394317437-6551-1-git-send-email-joaohf@gmail.com>
Download mbox | patch
Permalink /patch/68299/
State New
Headers show

Comments

João Henrique Freitas - March 8, 2014, 10:23 p.m.
OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the
populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Tom Zanussi - March 9, 2014, 12:15 a.m.
On Sat, 2014-03-08 at 19:23 -0300, João Henrique Ferreira de Freitas
wrote:
> OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the
> populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.
> 
> Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>

Thanks for updating this.

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

> ---
>  scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
> index 91d751e..e0a82f5 100644
> --- a/scripts/lib/mic/kickstart/custom_commands/partition.py
> +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
> @@ -174,7 +174,6 @@ class Wic_PartData(Mic_PartData):
>          """
>          Prepare content for an ext2/3/4 rootfs partition.
>          """
> -        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
>  
>          image_rootfs = rootfs_dir
>          rootfs = "%s/rootfs.%s" % (cr_workdir, self.fstype)
> @@ -199,11 +198,10 @@ class Wic_PartData(Mic_PartData):
>  
>          extra_imagecmd = "-i 8192"
>  
> -        mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, rootfs)
> +        mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \
> +            (self.fstype, extra_imagecmd, rootfs, image_rootfs)
>          rc, out = exec_native_cmd(mkfs_cmd, native_sysroot)
>  
> -        populate_cmd = populate_script + " " + image_rootfs + " " + rootfs
> -        rc, out = exec_native_cmd(pseudo + populate_cmd, native_sysroot)
>  
>          # get the rootfs size in the right units for kickstart (Mb)
>          du_cmd = "du -Lbms %s" % rootfs
> -- 
> 1.8.3.2
>
Richard Purdie - March 10, 2014, 1:04 a.m.
On Sat, 2014-03-08 at 19:23 -0300, João Henrique Ferreira de Freitas
wrote:
> OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the
> populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.
> 
> Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
> ---
>  scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
> index 91d751e..e0a82f5 100644
> --- a/scripts/lib/mic/kickstart/custom_commands/partition.py
> +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
> @@ -174,7 +174,6 @@ class Wic_PartData(Mic_PartData):
>          """
>          Prepare content for an ext2/3/4 rootfs partition.
>          """
> -        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
>  
>          image_rootfs = rootfs_dir
>          rootfs = "%s/rootfs.%s" % (cr_workdir, self.fstype)
> @@ -199,11 +198,10 @@ class Wic_PartData(Mic_PartData):
>  
>          extra_imagecmd = "-i 8192"
>  
> -        mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, rootfs)
> +        mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \
> +            (self.fstype, extra_imagecmd, rootfs, image_rootfs)
>          rc, out = exec_native_cmd(mkfs_cmd, native_sysroot)
>  
> -        populate_cmd = populate_script + " " + image_rootfs + " " + rootfs
> -        rc, out = exec_native_cmd(pseudo + populate_cmd, native_sysroot)
>  
>          # get the rootfs size in the right units for kickstart (Mb)
>          du_cmd = "du -Lbms %s" % rootfs

Don't we need to be careful to find the binary from the native sysroot
here since that is the one with the root directory option?

Cheers,

Richard
Tom Zanussi - March 11, 2014, 12:05 a.m.
On Sun, 2014-03-09 at 18:04 -0700, Richard Purdie wrote:
> On Sat, 2014-03-08 at 19:23 -0300, João Henrique Ferreira de Freitas
> wrote:
> > OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the
> > populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.
> > 
> > Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
> > ---
> >  scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
> > index 91d751e..e0a82f5 100644
> > --- a/scripts/lib/mic/kickstart/custom_commands/partition.py
> > +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
> > @@ -174,7 +174,6 @@ class Wic_PartData(Mic_PartData):
> >          """
> >          Prepare content for an ext2/3/4 rootfs partition.
> >          """
> > -        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
> >  
> >          image_rootfs = rootfs_dir
> >          rootfs = "%s/rootfs.%s" % (cr_workdir, self.fstype)
> > @@ -199,11 +198,10 @@ class Wic_PartData(Mic_PartData):
> >  
> >          extra_imagecmd = "-i 8192"
> >  
> > -        mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, rootfs)
> > +        mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \
> > +            (self.fstype, extra_imagecmd, rootfs, image_rootfs)
> >          rc, out = exec_native_cmd(mkfs_cmd, native_sysroot)
> >  
> > -        populate_cmd = populate_script + " " + image_rootfs + " " + rootfs
> > -        rc, out = exec_native_cmd(pseudo + populate_cmd, native_sysroot)
> >  
> >          # get the rootfs size in the right units for kickstart (Mb)
> >          du_cmd = "du -Lbms %s" % rootfs
> 
> Don't we need to be careful to find the binary from the native sysroot
> here since that is the one with the root directory option?
> 

Hmm, exec_native_cmd(mkfs_cmd, native_sysroot) is being used to do the
'mke2fs -d', which should do the right thing... Am I missing something?

Tom


> Cheers,
> 
> Richard
>
Richard Purdie - March 11, 2014, 5:06 a.m.
On Mon, 2014-03-10 at 19:05 -0500, Tom Zanussi wrote:
> On Sun, 2014-03-09 at 18:04 -0700, Richard Purdie wrote:
> > On Sat, 2014-03-08 at 19:23 -0300, João Henrique Ferreira de Freitas
> > wrote:
> > > OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the
> > > populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.
> > > 
> > > Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
> > > ---
> > >  scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
> > > index 91d751e..e0a82f5 100644
> > > --- a/scripts/lib/mic/kickstart/custom_commands/partition.py
> > > +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
> > > @@ -174,7 +174,6 @@ class Wic_PartData(Mic_PartData):
> > >          """
> > >          Prepare content for an ext2/3/4 rootfs partition.
> > >          """
> > > -        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
> > >  
> > >          image_rootfs = rootfs_dir
> > >          rootfs = "%s/rootfs.%s" % (cr_workdir, self.fstype)
> > > @@ -199,11 +198,10 @@ class Wic_PartData(Mic_PartData):
> > >  
> > >          extra_imagecmd = "-i 8192"
> > >  
> > > -        mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, rootfs)
> > > +        mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \
> > > +            (self.fstype, extra_imagecmd, rootfs, image_rootfs)
> > >          rc, out = exec_native_cmd(mkfs_cmd, native_sysroot)
> > >  
> > > -        populate_cmd = populate_script + " " + image_rootfs + " " + rootfs
> > > -        rc, out = exec_native_cmd(pseudo + populate_cmd, native_sysroot)
> > >  
> > >          # get the rootfs size in the right units for kickstart (Mb)
> > >          du_cmd = "du -Lbms %s" % rootfs
> > 
> > Don't we need to be careful to find the binary from the native sysroot
> > here since that is the one with the root directory option?
> > 
> 
> Hmm, exec_native_cmd(mkfs_cmd, native_sysroot) is being used to do the
> 'mke2fs -d', which should do the right thing... Am I missing something?

I hadn't realised that the exec_native_cmd took care of resolving the
prefix for you. The populate_script had a prefix because its used with
pseudo (I'd thought it was so it found the right command). 

That does raise another question though, how does this work now pseudo
isn't used?

Cheers,

Richard

Patch

diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py
index 91d751e..e0a82f5 100644
--- a/scripts/lib/mic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/mic/kickstart/custom_commands/partition.py
@@ -174,7 +174,6 @@  class Wic_PartData(Mic_PartData):
         """
         Prepare content for an ext2/3/4 rootfs partition.
         """
-        populate_script = "%s/usr/bin/populate-extfs.sh" % native_sysroot
 
         image_rootfs = rootfs_dir
         rootfs = "%s/rootfs.%s" % (cr_workdir, self.fstype)
@@ -199,11 +198,10 @@  class Wic_PartData(Mic_PartData):
 
         extra_imagecmd = "-i 8192"
 
-        mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, rootfs)
+        mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \
+            (self.fstype, extra_imagecmd, rootfs, image_rootfs)
         rc, out = exec_native_cmd(mkfs_cmd, native_sysroot)
 
-        populate_cmd = populate_script + " " + image_rootfs + " " + rootfs
-        rc, out = exec_native_cmd(pseudo + populate_cmd, native_sysroot)
 
         # get the rootfs size in the right units for kickstart (Mb)
         du_cmd = "du -Lbms %s" % rootfs