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 15 import glob 16 import os 17 import subprocess 18 import sys 19 20 def RunCommand(commandLine): 21 #print ' '.join(commandLine) 22 return subprocess.call(commandLine) 23 24 for filename in glob.glob(os.path.join('Bin', '*.raw')): 25 os.remove(filename) 26 27 arch = 'ia32' 28 debugType = None 29 output = os.path.join('Bin', 'ResetVec') 30 output += '.' + arch 31 if debugType is not None: 32 output += '.' + debugType 33 output += '.raw' 34 commandLine = ( 35 'nasm', 36 '-D', 'ARCH_%s' % arch.upper(), 37 '-D', 'DEBUG_%s' % str(debugType).upper(), 38 '-o', output, 39 'ResetVectorCode.asm', 40 ) 41 ret = RunCommand(commandLine) 42 print '\tASM\t' + output 43 if ret != 0: sys.exit(ret) 44 45 commandLine = ( 46 'python', 47 'Tools/FixupForRawSection.py', 48 output, 49 ) 50 print '\tFIXUP\t' + output 51 ret = RunCommand(commandLine) 52 if ret != 0: sys.exit(ret) 53 54