Skip to contentSkip to conversation

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

PATCH In review João Henrique Ferreira de Freitas 3 participants 8 messages Mar 8, 2014 – Mar 12, 2014

lore
Share & tools
lore
#0 lore raw

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

OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +2 -4
index 91d751e..e0a82f5 100644
@@ -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
Signature · 1 line
1.8.3.2
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · João Henrique Ferreira de Freitas

OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

Thanks for updating this.

Quoted 33 lines
---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +2 -4
index 91d751e..e0a82f5 100644
@@ -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
Signature · 1 line
1.8.3.2
#2 lore raw
In reply to João Henrique Ferreira de Freitas
Quoted 24 lines · João Henrique Ferreira de Freitas

OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +0 -1
index 91d751e..e0a82f5 100644
@@ -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"
 

scripts/lib/mic/kickstart/custom_commands/partition.py class Wic_PartData(Mic_PartData): · line 207

Quoted 10 lines
scripts/lib/mic/kickstart/custom_commands/partition.py +2 -3
-        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

#3 lore raw
Quoted 31 lines · Richard Purdie
Quoted 29 lines · João Henrique Ferreira de Freitas

OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +2 -2
index 91d751e..e0a82f5 100644
@@ -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)
 
Quoted 9 lines

scripts/lib/mic/kickstart/custom_commands/partition.py class Wic_PartData(Mic_PartData): · line 207

Quoted 5 lines
scripts/lib/mic/kickstart/custom_commands/partition.py +0 -2
-        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

Quoted 4 lines

Cheers,

Richard

#4 lore raw
Quoted 42 lines · Tom Zanussi
Quoted 31 lines · Richard Purdie
Quoted 29 lines · João Henrique Ferreira de Freitas

OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +2 -2
index 91d751e..e0a82f5 100644
@@ -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)
 
Quoted 9 lines

scripts/lib/mic/kickstart/custom_commands/partition.py class Wic_PartData(Mic_PartData): · line 207

Quoted 5 lines
scripts/lib/mic/kickstart/custom_commands/partition.py +0 -2
-        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?

Quoted 2 lines

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

#5 lore raw
Quoted 46 lines · Richard Purdie
Quoted 42 lines · Tom Zanussi
Quoted 31 lines · Richard Purdie
Quoted 29 lines · João Henrique Ferreira de Freitas

OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +2 -2
index 91d751e..e0a82f5 100644
@@ -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)
 
Quoted 9 lines

scripts/lib/mic/kickstart/custom_commands/partition.py class Wic_PartData(Mic_PartData): · line 207

Quoted 5 lines
scripts/lib/mic/kickstart/custom_commands/partition.py +0 -2
-        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?

Quoted 2 lines

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?

Quoted 7 lines

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?

Good point, it did miss pseudo. Here's a fix to the fix:

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=tzanussi/wic-ext2fs-fix-fix

[PATCH] wic: Use pseudo for ext mkfs command

The switchover from populate-exfs.sh to mke2fs forgot to preserve pseudo, add it back.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +1 -1
index e0a82f5..e15150b 100644
@@ -200,7 +200,7 @@ class Wic_PartData(Mic_PartData):
 
         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)
+        rc, out = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
 
 
         # get the rootfs size in the right units for kickstart (Mb)
Signature · 1 line
1.8.3.1
Quoted 4 lines

Cheers,

Richard

#6 lore raw
Quoted 76 lines · Tom Zanussi
Quoted 46 lines · Richard Purdie
Quoted 42 lines · Tom Zanussi
Quoted 31 lines · Richard Purdie
Quoted 29 lines · João Henrique Ferreira de Freitas

OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +2 -2
index 91d751e..e0a82f5 100644
@@ -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)
 
Quoted 9 lines

scripts/lib/mic/kickstart/custom_commands/partition.py class Wic_PartData(Mic_PartData): · line 207

Quoted 5 lines
scripts/lib/mic/kickstart/custom_commands/partition.py +0 -2
-        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?

Quoted 2 lines

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?

Quoted 7 lines

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?

Good point, it did miss pseudo. Here's a fix to the fix:

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=tzanussi/wic-ext2fs-fix-fix

[PATCH] wic: Use pseudo for ext mkfs command

The switchover from populate-exfs.sh to mke2fs forgot to preserve pseudo, add it back.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +0 -0
index e0a82f5..e15150b 100644

scripts/lib/mic/kickstart/custom_commands/partition.py class Wic_PartData(Mic_PartData): · line 203

Quoted 5 lines
scripts/lib/mic/kickstart/custom_commands/partition.py +1 -1
@@ -200,7 +200,7 @@ class Wic_PartData(Mic_PartData):
 
         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)
+        rc, out = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)

In the original version the full path to mkfs.X was specified, in this version PATH will be used to find it. Will it find the right version?

Cheers,

Richard

#7 lore raw
Quoted 78 lines · Richard Purdie
Quoted 77 lines · Tom Zanussi
Quoted 46 lines · Richard Purdie
Quoted 42 lines · Tom Zanussi
Quoted 31 lines · Richard Purdie
Quoted 29 lines · João Henrique Ferreira de Freitas

OE-core commit f3a95ca6886b55e5819b068bdbd2cceb882d91a6 removed the populate-extfs.sh. So mke2fs should be used to create ext2/3/4 image.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +2 -2
index 91d751e..e0a82f5 100644
@@ -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)
 
Quoted 9 lines

scripts/lib/mic/kickstart/custom_commands/partition.py class Wic_PartData(Mic_PartData): · line 207

Quoted 5 lines
scripts/lib/mic/kickstart/custom_commands/partition.py +0 -2
-        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?

Quoted 2 lines

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?

Quoted 7 lines

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?

Good point, it did miss pseudo. Here's a fix to the fix:

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=tzanussi/wic-ext2fs-fix-fix

[PATCH] wic: Use pseudo for ext mkfs command

The switchover from populate-exfs.sh to mke2fs forgot to preserve pseudo, add it back.

---
 scripts/lib/mic/kickstart/custom_commands/partition.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/mic/kickstart/custom_commands/partition.py +0 -0
index e0a82f5..e15150b 100644
@@ -200,7 +200,7 @@ class Wic_PartData(Mic_PartData):
 
Quoted 8 lines

scripts/lib/mic/kickstart/custom_commands/partition.py class Wic_PartData(Mic_PartData): · line 203

Quoted 4 lines
scripts/lib/mic/kickstart/custom_commands/partition.py +1 -1
         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)
+        rc, out = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)

In the original version the full path to mkfs.X was specified, in this version PATH will be used to find it. Will it find the right version?

Yeah, that's what exec_native_cmd does:

    native_paths = \
        "export PATH=%s/sbin:%s/usr/sbin:%s/usr/bin:$PATH" % \
        (native_sysroot, native_sysroot, native_sysroot)

The original didn't need to specify the full path, not sure why it did...

Tom

Quoted 4 lines

Cheers,

Richard