* [PATCH 1/4] wic: fix empty btrfs partitions
2015-02-09 23:46 [PATCH 0/4] More wic cleanup and features Alexandre Belloni
@ 2015-02-09 23:46 ` Alexandre Belloni
2015-02-09 23:46 ` [PATCH 2/4] wic: remove useless calls to __write_fstab Alexandre Belloni
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2015-02-09 23:46 UTC (permalink / raw)
To: Tom Zanussi; +Cc: openembedded-core
btrfs emtpy partition creation is currently not working because of the
usage of the non existant variables rootfs ans extra_imagecmd. It also
as an incorrect size.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
scripts/lib/wic/kickstart/custom_commands/partition.py | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index 44df20c58a25..315c6128849d 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -425,12 +425,7 @@ class Wic_PartData(Mic_PartData):
(fs, self.size)
exec_cmd(dd_cmd)
- mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size, rootfs)
- (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot)
- if rc:
- msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc))
-
- mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs)
+ mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, fs)
(rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot)
if rc:
msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc))
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] wic: remove useless calls to __write_fstab
2015-02-09 23:46 [PATCH 0/4] More wic cleanup and features Alexandre Belloni
2015-02-09 23:46 ` [PATCH 1/4] wic: fix empty btrfs partitions Alexandre Belloni
@ 2015-02-09 23:46 ` Alexandre Belloni
2015-02-18 16:48 ` Alexandre Belloni
2015-02-09 23:46 ` [PATCH 3/4] wic: properly label filesystems Alexandre Belloni
2015-02-09 23:46 ` [PATCH 4/4] wic: add GPT support Alexandre Belloni
3 siblings, 1 reply; 7+ messages in thread
From: Alexandre Belloni @ 2015-02-09 23:46 UTC (permalink / raw)
To: Tom Zanussi; +Cc: openembedded-core
__write_fstab() is already iterating over parts. There is no need to
call it fort each parts.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
scripts/lib/wic/imager/direct.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 38d4e78e6273..c605e6423826 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -136,7 +136,7 @@ class DirectImageCreator(BaseImageCreator):
fstab_lines.append(fstab_entry)
def _write_fstab(self, fstab, fstab_lines):
- fstab = open(fstab, "w")
+ fstab = open(fstab + ".new", "w")
for line in fstab_lines:
fstab.write(line)
fstab.close()
@@ -258,12 +258,9 @@ class DirectImageCreator(BaseImageCreator):
# self.assemble() calls Image.assemble() which calls
# __write_partitition() for each partition to dd the fs
# into the partitions.
- fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
-
p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir,
self.bootimg_dir, self.kernel_dir, self.native_sysroot)
- self._restore_fstab(fstab)
self.__image.add_partition(int(p.size),
p.disk,
@@ -277,6 +274,9 @@ class DirectImageCreator(BaseImageCreator):
no_table = p.no_table,
part_type = p.part_type)
+ fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
+ self._restore_fstab(fstab)
+
self.__image.layout_partitions(self._ptable_format)
self.__imgdir = self.workdir
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] wic: properly label filesystems
2015-02-09 23:46 [PATCH 0/4] More wic cleanup and features Alexandre Belloni
2015-02-09 23:46 ` [PATCH 1/4] wic: fix empty btrfs partitions Alexandre Belloni
2015-02-09 23:46 ` [PATCH 2/4] wic: remove useless calls to __write_fstab Alexandre Belloni
@ 2015-02-09 23:46 ` Alexandre Belloni
2015-02-09 23:46 ` [PATCH 4/4] wic: add GPT support Alexandre Belloni
3 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2015-02-09 23:46 UTC (permalink / raw)
To: Tom Zanussi; +Cc: openembedded-core
Use the partition label option, when available, to label the filesystem.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
.../lib/wic/kickstart/custom_commands/partition.py | 42 +++++++++++++++++-----
1 file changed, 34 insertions(+), 8 deletions(-)
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index 315c6128849d..4f5a1e5ce4c0 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -246,8 +246,12 @@ class Wic_PartData(Mic_PartData):
extra_imagecmd = "-i 8192"
- mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \
- (self.fstype, extra_imagecmd, rootfs, image_rootfs)
+ label_str = ""
+ if (self.label):
+ label_str = "-L %s" % self.label
+
+ mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
+ (self.fstype, extra_imagecmd, rootfs, label_str, image_rootfs)
(rc, out) = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
if rc:
print "rootfs_dir: %s" % rootfs_dir
@@ -291,8 +295,12 @@ class Wic_PartData(Mic_PartData):
(rootfs, rootfs_size)
exec_cmd(dd_cmd)
- mkfs_cmd = "mkfs.%s -b %d -r %s %s" % \
- (self.fstype, rootfs_size * 1024, image_rootfs, rootfs)
+ label_str = ""
+ if (self.label):
+ label_str = "-L %s" % self.label
+
+ mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \
+ (self.fstype, rootfs_size * 1024, image_rootfs, label_str, rootfs)
(rc, out) = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot)
if rc:
msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details) when creating filesystem from rootfs directory: %s" % (self.fstype, rc, rootfs_dir))
@@ -334,7 +342,11 @@ class Wic_PartData(Mic_PartData):
if blocks % 16 != 0:
blocks += (16 - (blocks % 16))
- dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (rootfs, blocks)
+ label_str = "-n boot"
+ if (self.label):
+ label_str = "-n %s" % self.label
+
+ dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
exec_native_cmd(dosfs_cmd, native_sysroot)
mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, image_rootfs)
@@ -405,7 +417,12 @@ class Wic_PartData(Mic_PartData):
extra_imagecmd = "-i 8192"
- mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs)
+ label_str = ""
+ if (self.label):
+ label_str = "-L %s" % self.label
+
+ mkfs_cmd = "mkfs.%s -F %s %s %s" % \
+ (self.fstype, extra_imagecmd, label_str, fs)
(rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot)
if rc:
msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc))
@@ -425,7 +442,12 @@ class Wic_PartData(Mic_PartData):
(fs, self.size)
exec_cmd(dd_cmd)
- mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, fs)
+ label_str = ""
+ if (self.label):
+ label_str = "-L %s" % self.label
+
+ mkfs_cmd = "mkfs.%s -b %d %s %s" % \
+ (self.fstype, self.size * 1024, label_str, fs)
(rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot)
if rc:
msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc))
@@ -443,7 +465,11 @@ class Wic_PartData(Mic_PartData):
blocks = self.size
- dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (fs, blocks)
+ label_str = "-n boot"
+ if (self.label):
+ label_str = "-n %s" % self.label
+
+ dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, fs, blocks)
exec_native_cmd(dosfs_cmd, native_sysroot)
chmod_cmd = "chmod 644 %s" % fs
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] wic: add GPT support
2015-02-09 23:46 [PATCH 0/4] More wic cleanup and features Alexandre Belloni
` (2 preceding siblings ...)
2015-02-09 23:46 ` [PATCH 3/4] wic: properly label filesystems Alexandre Belloni
@ 2015-02-09 23:46 ` Alexandre Belloni
3 siblings, 0 replies; 7+ messages in thread
From: Alexandre Belloni @ 2015-02-09 23:46 UTC (permalink / raw)
To: Tom Zanussi; +Cc: openembedded-core
Add GPT partition table support.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
scripts/lib/wic/utils/partitionedfs.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 87d2929f6c8a..162f8e1b9c6a 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -29,6 +29,9 @@ from wic.utils.oe.misc import *
# Overhead of the MBR partitioning scheme (just one sector)
MBR_OVERHEAD = 1
+# Overhead of the GPT partitioning scheme
+GPT_OVERHEAD = 34
+
# Size of a sector in bytes
SECTOR_SIZE = 512
@@ -122,7 +125,7 @@ class Image:
msger.debug("Assigning %s partitions to disks" % ptable_format)
- if ptable_format not in ('msdos'):
+ if ptable_format not in ('msdos', 'gpt'):
raise ImageError("Unknown partition table format '%s', supported " \
"formats are: 'msdos'" % ptable_format)
@@ -156,6 +159,8 @@ class Image:
if d['numpart'] == 1:
if ptable_format == "msdos":
overhead = MBR_OVERHEAD
+ elif ptable_format == "gpt":
+ overhead = GPT_OVERHEAD
# Skip one sector required for the partitioning scheme overhead
d['offset'] += overhead
@@ -214,6 +219,8 @@ class Image:
# minumim disk sizes.
for disk_name, d in self.disks.items():
d['min_size'] = d['offset']
+ if d['ptable_format'] == "gpt":
+ d['min_size'] += GPT_OVERHEAD
d['min_size'] *= self.sector_size
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread