• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## @file
2#  Automate the process of building the various reset vector types
3#
4#  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
5#
6#  This program and the accompanying materials
7#  are licensed and made available under the terms and conditions of the BSD License
8#  which accompanies this distribution.  The full text of the license may be found at
9#  http://opensource.org/licenses/bsd-license.php
10#
11#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13#
14
15import glob
16import os
17import subprocess
18import sys
19
20def RunCommand(commandLine):
21    #print ' '.join(commandLine)
22    return subprocess.call(commandLine)
23
24for filename in glob.glob(os.path.join('Bin', '*.raw')):
25    os.remove(filename)
26
27arch = 'ia32'
28debugType = None
29output = os.path.join('Bin', 'ResetVec')
30output += '.' + arch
31if debugType is not None:
32    output += '.' + debugType
33output += '.raw'
34commandLine = (
35    'nasm',
36    '-D', 'ARCH_%s' % arch.upper(),
37    '-D', 'DEBUG_%s' % str(debugType).upper(),
38    '-o', output,
39    'ResetVectorCode.asm',
40    )
41ret = RunCommand(commandLine)
42print '\tASM\t' + output
43if ret != 0: sys.exit(ret)
44
45commandLine = (
46    'python',
47    'Tools/FixupForRawSection.py',
48    output,
49    )
50print '\tFIXUP\t' + output
51ret = RunCommand(commandLine)
52if ret != 0: sys.exit(ret)
53
54