1#!/usr/bin/env python3
2#
3# Copyright 2018 The Hafnium Authors.
4#
5# Use of this source code is governed by a BSD-style
6# license that can be found in the LICENSE file or at
7# https://opensource.org/licenses/BSD-3-Clause.
8
9"""Convert a file to binary format.
10
11Calls objcopy to convert a file into raw binary format.
12"""
13
14import argparse
15import os
16import subprocess
17import sys
18
19OBJCOPY = "llvm-objcopy"
20
21def Main():
22    parser = argparse.ArgumentParser()
23    parser.add_argument("--input", required=True)
24    parser.add_argument("--output", required=True)
25    args = parser.parse_args()
26    subprocess.check_call([
27        OBJCOPY, "-O", "binary", args.input, args.output
28    ])
29    return 0
30
31
32if __name__ == "__main__":
33    sys.exit(Main())
34