ffff_romimage.py 文件源码

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

项目:bootrom-tools 作者: MotorolaMobilityLLC 项目源码 文件源码
def write(self, out_filename):
        """Create the FFFF file

        Create the FFFF file, write the FFFF ROMimage buffer to it and return
        a success flag.  Appends the default FFFF file extension if omitted
        """
        # Reject the write if we didn't pass the sniff test
        if self.ffff0.header_validity != FFFF_HDR_VALID:
            raise ValueError("Invalid FFFF header 0")
        if self.ffff1.header_validity != FFFF_HDR_VALID:
            raise ValueError("Invalid FFFF header 1")

        # Ensure the output file ends in the default file extension if
        # the user hasn't specified their own extension.
        if rfind(out_filename, ".") == -1:
            out_filename += FFFF_FILE_EXTENSION

        # Output the entire FFFF blob
        with open(out_filename, 'wb') as wf:
            wf.write(self.ffff_buf)
            print("Wrote", out_filename)
            return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号