summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/kickstart/custom_commands/partition.py
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-02-04 23:45:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-07 18:52:45 +0000
commit3d4da9186016d54b76ad2fa710646de253f0f063 (patch)
treeaec1c90fd97d03402878acc5f877eb2bd20fa9f6 /scripts/lib/wic/kickstart/custom_commands/partition.py
parentd7ef9e49b1c687279f6eb2c7abc32ff915714177 (diff)
downloadopenembedded-core-3d4da9186016d54b76ad2fa710646de253f0f063.tar.gz
openembedded-core-3d4da9186016d54b76ad2fa710646de253f0f063.tar.bz2
openembedded-core-3d4da9186016d54b76ad2fa710646de253f0f063.zip
wic: use kB for the partitions size
Use kB instead of MB for the partition size to get a better granularity. This is needed on some SoC (i.mx, omap) where it is necessary to create partitions as small as 64kB. Keep the backward compatibility by assuming MB when no unit is provided. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Tested-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/lib/wic/kickstart/custom_commands/partition.py')
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/partition.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index 54a494e033..7a307065f2 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -99,7 +99,7 @@ class Wic_PartData(Mic_PartData):
def get_extra_block_count(self, current_blocks):
"""
- The --size param is reflected in self.size (in MB), and we already
+ The --size param is reflected in self.size (in kB), and we already
have current_blocks (1k) blocks, calculate and return the
number of (1k) blocks we need to add to get to --size, 0 if
we're already there or beyond.
@@ -110,7 +110,7 @@ class Wic_PartData(Mic_PartData):
if not self.size:
return 0
- requested_blocks = self.size * 1024
+ requested_blocks = self.size
msger.debug("Requested blocks %d, current_blocks %d" % \
(requested_blocks, current_blocks))
@@ -171,7 +171,7 @@ class Wic_PartData(Mic_PartData):
Handle an already-created partition e.g. xxx.ext3
"""
rootfs = oe_builddir
- du_cmd = "du -Lbms %s" % rootfs
+ du_cmd = "du -Lbks %s" % rootfs
out = exec_cmd(du_cmd)
rootfs_size = out.split()[0]
@@ -247,8 +247,8 @@ class Wic_PartData(Mic_PartData):
print "rootfs_dir: %s" % rootfs_dir
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))
- # get the rootfs size in the right units for kickstart (Mb)
- du_cmd = "du -Lbms %s" % rootfs
+ # get the rootfs size in the right units for kickstart (kB)
+ du_cmd = "du -Lbks %s" % rootfs
out = exec_cmd(du_cmd)
rootfs_size = out.split()[0]
@@ -292,8 +292,8 @@ class Wic_PartData(Mic_PartData):
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))
- # get the rootfs size in the right units for kickstart (Mb)
- du_cmd = "du -Lbms %s" % rootfs
+ # get the rootfs size in the right units for kickstart (kB)
+ du_cmd = "du -Lbks %s" % rootfs
out = exec_cmd(du_cmd)
rootfs_size = out.split()[0]
@@ -341,8 +341,8 @@ class Wic_PartData(Mic_PartData):
chmod_cmd = "chmod 644 %s" % rootfs
exec_cmd(chmod_cmd)
- # get the rootfs size in the right units for kickstart (Mb)
- du_cmd = "du -Lbms %s" % rootfs
+ # get the rootfs size in the right units for kickstart (kB)
+ du_cmd = "du -Lbks %s" % rootfs
out = exec_cmd(du_cmd)
rootfs_size = out.split()[0]
@@ -361,8 +361,8 @@ class Wic_PartData(Mic_PartData):
(image_rootfs, rootfs)
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
+ # get the rootfs size in the right units for kickstart (kB)
+ du_cmd = "du -Lbks %s" % rootfs
out = exec_cmd(du_cmd)
rootfs_size = out.split()[0]
@@ -395,7 +395,7 @@ class Wic_PartData(Mic_PartData):
"""
fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
- dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
+ dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
(fs, self.size)
exec_cmd(dd_cmd)
@@ -417,11 +417,11 @@ class Wic_PartData(Mic_PartData):
"""
fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
- dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
+ dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
(fs, self.size)
exec_cmd(dd_cmd)
- mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, rootfs)
+ 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))
@@ -442,7 +442,7 @@ class Wic_PartData(Mic_PartData):
"""
fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
- blocks = self.size * 1024
+ blocks = self.size
dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (fs, blocks)
exec_native_cmd(dosfs_cmd, native_sysroot)
@@ -474,8 +474,8 @@ class Wic_PartData(Mic_PartData):
os.rmdir(tmpdir)
- # get the rootfs size in the right units for kickstart (Mb)
- du_cmd = "du -Lbms %s" % fs
+ # get the rootfs size in the right units for kickstart (kB)
+ du_cmd = "du -Lbks %s" % fs
out = exec_cmd(du_cmd)
fs_size = out.split()[0]
@@ -490,7 +490,7 @@ class Wic_PartData(Mic_PartData):
"""
fs = "%s/fs.%s" % (cr_workdir, self.fstype)
- dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \
+ dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
(fs, self.size)
exec_cmd(dd_cmd)