当前位置: 首页>>代码示例>>Python>>正文


Python misc.exec_native_cmd函数代码示例

本文整理汇总了Python中wic.utils.oe.misc.exec_native_cmd函数的典型用法代码示例。如果您正苦于以下问题:Python exec_native_cmd函数的具体用法?Python exec_native_cmd怎么用?Python exec_native_cmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了exec_native_cmd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prepare_rootfs_vfat

    def prepare_rootfs_vfat(self, rootfs, oe_builddir, rootfs_dir,
                            native_sysroot, pseudo):
        """
        Prepare content for a vfat rootfs partition.
        """
        du_cmd = "du -bks %s" % rootfs_dir
        out = exec_cmd(du_cmd)
        blocks = int(out.split()[0])

        extra_blocks = self.get_extra_block_count(blocks)
        if extra_blocks < self.extra_space:
            extra_blocks = self.extra_space

        blocks += extra_blocks

        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
                    (extra_blocks, self.mountpoint, blocks))

        label_str = "-n boot"
        if self.label:
            label_str = "-n %s" % self.label

        dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
        exec_native_cmd(dosfs_cmd, native_sysroot)

        mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
        exec_native_cmd(mcopy_cmd, native_sysroot)

        chmod_cmd = "chmod 644 %s" % rootfs
        exec_cmd(chmod_cmd)
开发者ID:sat8,项目名称:yocto-tinkerboard,代码行数:30,代码来源:partition.py

示例2: prepare_rootfs_btrfs

    def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir,
                             native_sysroot, pseudo):
        """
        Prepare content for a btrfs rootfs partition.

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

        extra_blocks = self.get_extra_block_count(actual_rootfs_size)
        if extra_blocks < self.extra_space:
            extra_blocks = self.extra_space

        rootfs_size = actual_rootfs_size + extra_blocks
        rootfs_size *= self.overhead_factor

        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
                    (extra_blocks, self.mountpoint, rootfs_size))

        exec_cmd("truncate %s -s %d" % (rootfs, rootfs_size * 1024))

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

        mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \
            (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs)
        exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
开发者ID:biannm,项目名称:Poky,代码行数:30,代码来源:partition.py

示例3: do_install_disk

    def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
                        bootimg_dir, kernel_dir, native_sysroot):
        """
        Called after all partitions have been prepared and assembled into a
        disk image.  In this case, we insert/modify the MBR using isohybrid
        utility for booting via BIOS from disk storage devices.
        """

        full_path = creator._full_path(workdir, disk_name, "direct")
        iso_img = "%s.p1" % full_path
        full_path_iso = creator._full_path(workdir, disk_name, "iso")

        isohybrid_cmd = "isohybrid -u %s" % iso_img
        msger.debug("running command: %s" % \
                    isohybrid_cmd)
        exec_native_cmd(isohybrid_cmd, native_sysroot)

        # Replace the image created by direct plugin with the one created by
        # mkisofs command. This is necessary because the iso image created by
        # mkisofs has a very specific MBR is system area of the ISO image, and
        # direct plugin adds and configures an another MBR.
        msger.debug("Replaceing the image created by direct plugin\n")
        os.remove(full_path)
        shutil.copy2(iso_img, full_path_iso)
        shutil.copy2(full_path_iso, full_path)

        # Remove temporary ISO file
        os.remove(iso_img)
开发者ID:KenChenIEC,项目名称:openbmc,代码行数:28,代码来源:isoimage-isohybrid.py

示例4: prepare_empty_partition_squashfs

    def prepare_empty_partition_squashfs(self, cr_workdir, oe_builddir,
                                         native_sysroot):
        """
        Prepare an empty squashfs partition.
        """
        msger.warning("Creating of an empty squashfs %s partition was attempted. " \
                      "Proceeding as requested." % self.mountpoint)

        path = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
        os.path.isfile(path) and os.remove(path)

        # it is not possible to create a squashfs without source data,
        # thus prepare an empty temp dir that is used as source
        tmpdir = tempfile.mkdtemp()

        squashfs_cmd = "mksquashfs %s %s -noappend" % \
                       (tmpdir, path)
        exec_native_cmd(squashfs_cmd, native_sysroot)

        os.rmdir(tmpdir)

        # get the rootfs size in the right units for kickstart (kB)
        du_cmd = "du -Lbks %s" % path
        out = exec_cmd(du_cmd)
        fs_size = out.split()[0]

        self.size = fs_size
开发者ID:biannm,项目名称:Poky,代码行数:27,代码来源:partition.py

示例5: finalize

    def finalize(self):
        """
        Finalize the disk image.

        For example, prepare the image to be bootable by e.g.
        creating and installing a bootloader configuration.

        """
        source_plugin = self.get_default_source_plugin()
        if source_plugin:
            self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods)
            for disk_name, disk in self.__image.disks.items():
                self._source_methods["do_install_disk"](disk, disk_name, self,
                                                        self.workdir,
                                                        self.oe_builddir,
                                                        self.bootimg_dir,
                                                        self.kernel_dir,
                                                        self.native_sysroot)

        for disk_name, disk in self.__image.disks.items():
            full_path = self._full_path(self.__imgdir, disk_name, "direct")
            # Generate .bmap
            if self.bmap:
                msger.debug("Generating bmap file for %s" % disk_name)
                exec_native_cmd("bmaptool create %s -o %s.bmap" % (full_path, full_path),
                                self.native_sysroot)
            # Compress the image
            if self.compressor:
                msger.debug("Compressing disk %s with %s" % (disk_name, self.compressor))
                exec_cmd("%s %s" % (self.compressor, full_path))
开发者ID:agangidi53,项目名称:openbmc,代码行数:30,代码来源:direct.py

示例6: prepare_rootfs_ext

    def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir,
                           native_sysroot, pseudo):
        """
        Prepare content for an ext2/3/4 rootfs partition.
        """
        du_cmd = "du -ks %s" % rootfs_dir
        out = exec_cmd(du_cmd)
        actual_rootfs_size = int(out.split()[0])

        extra_blocks = self.get_extra_block_count(actual_rootfs_size)
        if extra_blocks < self.extra_space:
            extra_blocks = self.extra_space

        rootfs_size = actual_rootfs_size + extra_blocks
        rootfs_size *= self.overhead_factor

        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
                    (extra_blocks, self.mountpoint, rootfs_size))

        dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \
            (rootfs, rootfs_size)
        exec_cmd(dd_cmd)

        extra_imagecmd = "-i 8192"

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

        mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
            (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir)
        exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
开发者ID:KenChenIEC,项目名称:openbmc,代码行数:32,代码来源:partition.py

示例7: prepare_rootfs_ext

    def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir,
                           native_sysroot, pseudo):
        """
        Prepare content for an ext2/3/4 rootfs partition.
        """
        du_cmd = "du -ks %s" % rootfs_dir
        out = exec_cmd(du_cmd)
        actual_rootfs_size = int(out.split()[0])

        extra_blocks = self.get_extra_block_count(actual_rootfs_size)
        if extra_blocks < self.extra_space:
            extra_blocks = self.extra_space

        rootfs_size = actual_rootfs_size + extra_blocks
        rootfs_size *= self.overhead_factor

        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
                    (extra_blocks, self.mountpoint, rootfs_size))

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

        extra_imagecmd = "-i 8192"

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

        mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
            (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir)
        exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
开发者ID:ostroproject,项目名称:ostro-os,代码行数:31,代码来源:partition.py

示例8: prepare_rootfs_squashfs

 def prepare_rootfs_squashfs(self, rootfs, oe_builddir, rootfs_dir,
                             native_sysroot, pseudo):
     """
     Prepare content for a squashfs rootfs partition.
     """
     squashfs_cmd = "mksquashfs %s %s -noappend" % \
                    (rootfs_dir, rootfs)
     exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
开发者ID:biannm,项目名称:Poky,代码行数:8,代码来源:partition.py

示例9: prepare_empty_partition_btrfs

    def prepare_empty_partition_btrfs(self, rootfs, oe_builddir, native_sysroot):
        """
        Prepare an empty btrfs partition.
        """
        dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % (rootfs, self.size)
        exec_cmd(dd_cmd)

        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)
开发者ID:shenki,项目名称:poky,代码行数:13,代码来源:partition.py

示例10: prepare_empty_partition_btrfs

    def prepare_empty_partition_btrfs(self, rootfs, oe_builddir,
                                      native_sysroot):
        """
        Prepare an empty btrfs partition.
        """
        exec_cmd("truncate %s -s %d" % (rootfs, self.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)
开发者ID:biannm,项目名称:Poky,代码行数:14,代码来源:partition.py

示例11: prepare_swap_partition

    def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot):
        """
        Prepare a swap partition.
        """
        path = "%s/fs.%s" % (cr_workdir, self.fstype)

        exec_cmd("truncate %s -s %d" % (path, 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)
开发者ID:biannm,项目名称:Poky,代码行数:14,代码来源:partition.py

示例12: prepare_swap_partition

    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)
开发者ID:kacf,项目名称:poky,代码行数:15,代码来源:partition.py

示例13: prepare_empty_partition_ext

    def prepare_empty_partition_ext(self, rootfs, oe_builddir, native_sysroot):
        """
        Prepare an empty ext2/3/4 partition.
        """
        dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % (rootfs, self.size)
        exec_cmd(dd_cmd)

        extra_imagecmd = "-i 8192"

        label_str = ""
        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)
开发者ID:shenki,项目名称:poky,代码行数:15,代码来源:partition.py

示例14: prepare_empty_partition_btrfs

    def prepare_empty_partition_btrfs(self, rootfs, oe_builddir,
                                      native_sysroot):
        """
        Prepare an empty btrfs partition.
        """
        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 = "mkfs.%s -b %d %s %s" % \
            (self.fstype, self.size * 1024, label_str, rootfs)
        exec_native_cmd(mkfs_cmd, native_sysroot)
开发者ID:ostroproject,项目名称:ostro-os,代码行数:15,代码来源:partition.py

示例15: prepare_empty_partition_vfat

    def prepare_empty_partition_vfat(self, rootfs, oe_builddir, native_sysroot):
        """
        Prepare an empty vfat partition.
        """
        blocks = self.size

        label_str = "-n boot"
        if self.label:
            label_str = "-n %s" % self.label

        dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
        exec_native_cmd(dosfs_cmd, native_sysroot)

        chmod_cmd = "chmod 644 %s" % rootfs
        exec_cmd(chmod_cmd)
开发者ID:shenki,项目名称:poky,代码行数:15,代码来源:partition.py


注:本文中的wic.utils.oe.misc.exec_native_cmd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。