partition.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:isar 作者: ilbers 项目源码 文件源码
def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir):
        """
        Prepare content for a btrfs rootfs partition.

        Currently handles ext2/3/4 and btrfs.
        """
        du_cmd = "sudo du -ks %s" % rootfs_dir
        out = exec_cmd(du_cmd)
        actual_rootfs_size = int(out.split()[0])

        rootfs_size = self.get_rootfs_size(actual_rootfs_size)

        with open(rootfs, 'w') as sparse:
            os.ftruncate(sparse.fileno(), rootfs_size * 1024)

        label_str = ""
        if self.label:
            label_str = "-L %s" % self.label

        mkfs_cmd = "sudo mkfs.%s -b %d -r %s %s %s" % \
            (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs)
        exec_cmd(mkfs_cmd)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号