wic: partition plugin wrongly assumes it is rootfs
PATCH 1/2 wic: partition plugin wrongly assumes it is rootfs
The partition plugin is used as the base for other plugins. One of the methods the plugins use, is the prepare_rootfs method.
The prepare_rootfs method wrongly assumes that the value ROOTFS_SIZE from bitbake datastore is relevant to every invocation of prepare_rootfs, which it clearly is not, for example in the bootimg-partition case.
This commit adds an optional argument to prepare_rootfs where a caller can tell prepare_rootfs if it is an actual rootfs and whether related rootfs information retrieved from bitbake is valid. The default behavior of this optional argument is to assume that the invocation is an actual rootfs, to maintain compatibility with previous implementations.
--- scripts/lib/wic/partition.py | 4 ++-- scripts/lib/wic/plugins/source/bootimg-partition.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
scripts/lib/wic/partition.py +2 -2
@@ -199,7 +199,7 @@ class Partition(): (self.mountpoint, self.size, self.fixed_size)) def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir, - native_sysroot): + native_sysroot, real_rootfs = True): """ Prepare content for a rootfs partition i.e. create a partition and fill it from a /rootfs dir.
@@ -223,7 +223,7 @@ class Partition(): os.remove(rootfs) # Get rootfs size from bitbake variable if it's not set in .ks file - if not self.size: + if not self.size and real_rootfs: # Bitbake variable ROOTFS_SIZE is calculated in # Image._get_rootfs_size method from meta/lib/oe/image.py # using IMAGE_ROOTFS_SIZE, IMAGE_ROOTFS_ALIGNMENT,
scripts/lib/wic/plugins/source/bootimg-partition.py +1 -1
@@ -129,4 +129,4 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Prepare boot partition using rootfs in %s', hdddir) part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, - native_sysroot) + native_sysroot, False)
Signature · 1 line
2.14.1
PATCH 2/2 wic: Set a miniumum FAT16 volume size.
Set a miniumum FAT16 volume size because images are not valid to parted if this minimum value is not respected.
The value set is determined experimentally forr a logical sector size of 512. This fixed my local problem but, there may be better solutions.
--- scripts/lib/wic/partition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/wic/partition.py +1 -1
@@ -319,7 +319,7 @@ class Partition(): dosfs_cmd = "mkdosfs %s -i %s %s %s -C %s %d" % \ (label_str, self.fsuuid, size_str, extraopts, rootfs, - rootfs_size) + max(8250, rootfs_size)) exec_native_cmd(dosfs_cmd, native_sysroot) mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
Signature · 1 line
2.14.1