diff options
Diffstat (limited to 'scripts/lib/wic/kickstart')
| -rw-r--r-- | scripts/lib/wic/kickstart/__init__.py | 2 | ||||
| -rw-r--r-- | scripts/lib/wic/kickstart/custom_commands/partition.py | 36 |
2 files changed, 19 insertions, 19 deletions
diff --git a/scripts/lib/wic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py index b1406a0457..10959213d1 100644 --- a/scripts/lib/wic/kickstart/__init__.py +++ b/scripts/lib/wic/kickstart/__init__.py | |||
| @@ -74,7 +74,7 @@ def get_image_size(ks, default = None): | |||
| 74 | if p.mountpoint == "/" and p.size: | 74 | if p.mountpoint == "/" and p.size: |
| 75 | __size = p.size | 75 | __size = p.size |
| 76 | if __size > 0: | 76 | if __size > 0: |
| 77 | return int(__size) * 1024L * 1024L | 77 | return int(__size) * 1024L |
| 78 | else: | 78 | else: |
| 79 | return default | 79 | return default |
| 80 | 80 | ||
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): | |||
| 99 | 99 | ||
| 100 | def get_extra_block_count(self, current_blocks): | 100 | def get_extra_block_count(self, current_blocks): |
| 101 | """ | 101 | """ |
| 102 | The --size param is reflected in self.size (in MB), and we already | 102 | The --size param is reflected in self.size (in kB), and we already |
| 103 | have current_blocks (1k) blocks, calculate and return the | 103 | have current_blocks (1k) blocks, calculate and return the |
| 104 | number of (1k) blocks we need to add to get to --size, 0 if | 104 | number of (1k) blocks we need to add to get to --size, 0 if |
| 105 | we're already there or beyond. | 105 | we're already there or beyond. |
| @@ -110,7 +110,7 @@ class Wic_PartData(Mic_PartData): | |||
| 110 | if not self.size: | 110 | if not self.size: |
| 111 | return 0 | 111 | return 0 |
| 112 | 112 | ||
| 113 | requested_blocks = self.size * 1024 | 113 | requested_blocks = self.size |
| 114 | 114 | ||
| 115 | msger.debug("Requested blocks %d, current_blocks %d" % \ | 115 | msger.debug("Requested blocks %d, current_blocks %d" % \ |
| 116 | (requested_blocks, current_blocks)) | 116 | (requested_blocks, current_blocks)) |
| @@ -171,7 +171,7 @@ class Wic_PartData(Mic_PartData): | |||
| 171 | Handle an already-created partition e.g. xxx.ext3 | 171 | Handle an already-created partition e.g. xxx.ext3 |
| 172 | """ | 172 | """ |
| 173 | rootfs = oe_builddir | 173 | rootfs = oe_builddir |
| 174 | du_cmd = "du -Lbms %s" % rootfs | 174 | du_cmd = "du -Lbks %s" % rootfs |
| 175 | out = exec_cmd(du_cmd) | 175 | out = exec_cmd(du_cmd) |
| 176 | rootfs_size = out.split()[0] | 176 | rootfs_size = out.split()[0] |
| 177 | 177 | ||
| @@ -247,8 +247,8 @@ class Wic_PartData(Mic_PartData): | |||
| 247 | print "rootfs_dir: %s" % rootfs_dir | 247 | print "rootfs_dir: %s" % rootfs_dir |
| 248 | 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)) | 248 | 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)) |
| 249 | 249 | ||
| 250 | # get the rootfs size in the right units for kickstart (Mb) | 250 | # get the rootfs size in the right units for kickstart (kB) |
| 251 | du_cmd = "du -Lbms %s" % rootfs | 251 | du_cmd = "du -Lbks %s" % rootfs |
| 252 | out = exec_cmd(du_cmd) | 252 | out = exec_cmd(du_cmd) |
| 253 | rootfs_size = out.split()[0] | 253 | rootfs_size = out.split()[0] |
| 254 | 254 | ||
| @@ -292,8 +292,8 @@ class Wic_PartData(Mic_PartData): | |||
| 292 | if rc: | 292 | if rc: |
| 293 | 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)) | 293 | 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)) |
| 294 | 294 | ||
| 295 | # get the rootfs size in the right units for kickstart (Mb) | 295 | # get the rootfs size in the right units for kickstart (kB) |
| 296 | du_cmd = "du -Lbms %s" % rootfs | 296 | du_cmd = "du -Lbks %s" % rootfs |
| 297 | out = exec_cmd(du_cmd) | 297 | out = exec_cmd(du_cmd) |
| 298 | rootfs_size = out.split()[0] | 298 | rootfs_size = out.split()[0] |
| 299 | 299 | ||
| @@ -341,8 +341,8 @@ class Wic_PartData(Mic_PartData): | |||
| 341 | chmod_cmd = "chmod 644 %s" % rootfs | 341 | chmod_cmd = "chmod 644 %s" % rootfs |
| 342 | exec_cmd(chmod_cmd) | 342 | exec_cmd(chmod_cmd) |
| 343 | 343 | ||
| 344 | # get the rootfs size in the right units for kickstart (Mb) | 344 | # get the rootfs size in the right units for kickstart (kB) |
| 345 | du_cmd = "du -Lbms %s" % rootfs | 345 | du_cmd = "du -Lbks %s" % rootfs |
| 346 | out = exec_cmd(du_cmd) | 346 | out = exec_cmd(du_cmd) |
| 347 | rootfs_size = out.split()[0] | 347 | rootfs_size = out.split()[0] |
| 348 | 348 | ||
| @@ -361,8 +361,8 @@ class Wic_PartData(Mic_PartData): | |||
| 361 | (image_rootfs, rootfs) | 361 | (image_rootfs, rootfs) |
| 362 | exec_native_cmd(pseudo + squashfs_cmd, native_sysroot) | 362 | exec_native_cmd(pseudo + squashfs_cmd, native_sysroot) |
| 363 | 363 | ||
| 364 | # get the rootfs size in the right units for kickstart (Mb) | 364 | # get the rootfs size in the right units for kickstart (kB) |
| 365 | du_cmd = "du -Lbms %s" % rootfs | 365 | du_cmd = "du -Lbks %s" % rootfs |
| 366 | out = exec_cmd(du_cmd) | 366 | out = exec_cmd(du_cmd) |
| 367 | rootfs_size = out.split()[0] | 367 | rootfs_size = out.split()[0] |
| 368 | 368 | ||
| @@ -395,7 +395,7 @@ class Wic_PartData(Mic_PartData): | |||
| 395 | """ | 395 | """ |
| 396 | fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) | 396 | fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) |
| 397 | 397 | ||
| 398 | dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ | 398 | dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ |
| 399 | (fs, self.size) | 399 | (fs, self.size) |
| 400 | exec_cmd(dd_cmd) | 400 | exec_cmd(dd_cmd) |
| 401 | 401 | ||
| @@ -417,11 +417,11 @@ class Wic_PartData(Mic_PartData): | |||
| 417 | """ | 417 | """ |
| 418 | fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) | 418 | fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) |
| 419 | 419 | ||
| 420 | dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ | 420 | dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ |
| 421 | (fs, self.size) | 421 | (fs, self.size) |
| 422 | exec_cmd(dd_cmd) | 422 | exec_cmd(dd_cmd) |
| 423 | 423 | ||
| 424 | mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, rootfs) | 424 | mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size, rootfs) |
| 425 | (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) | 425 | (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) |
| 426 | if rc: | 426 | if rc: |
| 427 | 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)) | 427 | 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): | |||
| 442 | """ | 442 | """ |
| 443 | fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) | 443 | fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) |
| 444 | 444 | ||
| 445 | blocks = self.size * 1024 | 445 | blocks = self.size |
| 446 | 446 | ||
| 447 | dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (fs, blocks) | 447 | dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (fs, blocks) |
| 448 | exec_native_cmd(dosfs_cmd, native_sysroot) | 448 | exec_native_cmd(dosfs_cmd, native_sysroot) |
| @@ -474,8 +474,8 @@ class Wic_PartData(Mic_PartData): | |||
| 474 | 474 | ||
| 475 | os.rmdir(tmpdir) | 475 | os.rmdir(tmpdir) |
| 476 | 476 | ||
| 477 | # get the rootfs size in the right units for kickstart (Mb) | 477 | # get the rootfs size in the right units for kickstart (kB) |
| 478 | du_cmd = "du -Lbms %s" % fs | 478 | du_cmd = "du -Lbks %s" % fs |
| 479 | out = exec_cmd(du_cmd) | 479 | out = exec_cmd(du_cmd) |
| 480 | fs_size = out.split()[0] | 480 | fs_size = out.split()[0] |
| 481 | 481 | ||
| @@ -490,7 +490,7 @@ class Wic_PartData(Mic_PartData): | |||
| 490 | """ | 490 | """ |
| 491 | fs = "%s/fs.%s" % (cr_workdir, self.fstype) | 491 | fs = "%s/fs.%s" % (cr_workdir, self.fstype) |
| 492 | 492 | ||
| 493 | dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ | 493 | dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ |
| 494 | (fs, self.size) | 494 | (fs, self.size) |
| 495 | exec_cmd(dd_cmd) | 495 | exec_cmd(dd_cmd) |
| 496 | 496 | ||
