Build.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. # SPDX-License-Identifier: BSD-2-Clause-Patent
  7. #
  8. import glob
  9. import os
  10. import subprocess
  11. import sys
  12. def RunCommand(commandLine):
  13. #print ' '.join(commandLine)
  14. return subprocess.call(commandLine)
  15. for filename in glob.glob(os.path.join('Bin', '*.raw')):
  16. os.remove(filename)
  17. arch = 'ia32'
  18. debugType = None
  19. output = os.path.join('Bin', 'ResetVec')
  20. output += '.' + arch
  21. if debugType is not None:
  22. output += '.' + debugType
  23. output += '.raw'
  24. commandLine = (
  25. 'nasm',
  26. '-D', 'ARCH_%s' % arch.upper(),
  27. '-D', 'DEBUG_%s' % str(debugType).upper(),
  28. '-o', output,
  29. 'ResetVectorCode.asm',
  30. )
  31. ret = RunCommand(commandLine)
  32. print '\tASM\t' + output
  33. if ret != 0: sys.exit(ret)
  34. commandLine = (
  35. 'python',
  36. 'Tools/FixupForRawSection.py',
  37. output,
  38. )
  39. print '\tFIXUP\t' + output
  40. ret = RunCommand(commandLine)
  41. if ret != 0: sys.exit(ret)