class="s2">"" if self.label: label_str = "-L %s" % self.label mkfs_cmd = "mkfs.%s -F %s %s %s" % \ (self.fstype, extra_imagecmd, label_str, rootfs) exec_native_cmd(mkfs_cmd, native_sysroot) def prepare_empty_partition_btrfs(self, rootfs, oe_builddir, native_sysroot): """ Prepare an empty btrfs partition. """ size = self.disk_size with open(rootfs, 'w') as sparse: os.ftruncate(sparse.fileno(), size * 1024) 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, rootfs) exec_native_cmd(mkfs_cmd, native_sysroot) def prepare_empty_partition_msdos(self, rootfs, oe_builddir, native_sysroot): """ Prepare an empty vfat partition. """ blocks = self.disk_size label_str = "-n boot" if self.label: label_str = "-n %s" % self.label size_str = "" if self.fstype == 'msdos': size_str = "-F 16" # FAT 16 dosfs_cmd = "mkdosfs %s -S 512 %s -C %s %d" % (label_str, size_str, rootfs, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) chmod_cmd = "chmod 644 %s" % rootfs exec_cmd(chmod_cmd) prepare_empty_partition_vfat = prepare_empty_partition_msdos def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): """ Prepare a swap partition. """ path = "%s/fs.%s" % (cr_workdir, self.fstype) with open(path, 'w') as sparse: os.ftruncate(sparse.fileno(), self.size * 1024) import uuid label_str = "" if self.label: label_str = "-L %s" % self.label mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path) exec_native_cmd(mkswap_cmd, native_sysroot)