]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/ResetVector/Vtf0/Build.py
UefiCpuPkg: ResetVector Tool Support for Python 3
[mirror_edk2.git] / UefiCpuPkg / ResetVector / Vtf0 / Build.py
CommitLineData
7798fb83
HT
1## @file\r
2# Automate the process of building the various reset vector types\r
3#\r
6c7d6d4a 4# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>\r
7798fb83 5#\r
0acd8697 6# SPDX-License-Identifier: BSD-2-Clause-Patent\r
7798fb83
HT
7#\r
8\r
9import glob\r
10import os\r
11import subprocess\r
12import sys\r
13\r
14def RunCommand(commandLine):\r
15 #print ' '.join(commandLine)\r
16 return subprocess.call(commandLine)\r
17\r
18for filename in glob.glob(os.path.join('Bin', '*.raw')):\r
19 os.remove(filename)\r
20\r
21for arch in ('ia32', 'x64'):\r
22 for debugType in (None, 'port80', 'serial'):\r
23 output = os.path.join('Bin', 'ResetVector')\r
24 output += '.' + arch\r
25 if debugType is not None:\r
26 output += '.' + debugType\r
27 output += '.raw'\r
28 commandLine = (\r
29 'nasm',\r
30 '-D', 'ARCH_%s' % arch.upper(),\r
31 '-D', 'DEBUG_%s' % str(debugType).upper(),\r
32 '-o', output,\r
5a1f324d 33 'Vtf0.nasmb',\r
7798fb83
HT
34 )\r
35 ret = RunCommand(commandLine)\r
6c7d6d4a 36 print('\tASM\t' + output)\r
7798fb83
HT
37 if ret != 0: sys.exit(ret)\r
38\r
39 commandLine = (\r
40 'python',\r
41 'Tools/FixupForRawSection.py',\r
42 output,\r
43 )\r
6c7d6d4a 44 print('\tFIXUP\t' + output)\r
7798fb83
HT
45 ret = RunCommand(commandLine)\r
46 if ret != 0: sys.exit(ret)\r
47\r