]>
git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/ResetVector/Vtf0/Build.py
2 # Automate the process of building the various reset vector types
4 # Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
6 # SPDX-License-Identifier: BSD-2-Clause-Patent
13 PAGE_TABLE_2M
= 'PageTable2M'
14 PAGE_TABLE_1G
= 'PageTable1G'
16 ALL_RAW_FORMAT
= '*' + FILE_FORMAT
20 # Pre-Define a Macros for Page Table
22 PAGE_TABLE_2M
: "PAGE_TABLE_2M",
23 PAGE_TABLE_1G
: "PAGE_TABLE_1G"
26 def RunCommand(commandLine
):
27 return subprocess
.call(commandLine
)
29 # Check for all raw binaries and delete them
30 for root
, dirs
, files
in os
.walk('Bin'):
32 if file.endswith(FILE_FORMAT
):
33 os
.remove(os
.path
.join(root
, file))
35 for arch
in ('ia32', 'x64'):
36 for debugType
in (None, 'port80', 'serial'):
37 for pageTable
in PAGE_TABLES
.keys():
39 if arch
.lower() == X64
.lower():
40 directory
= os
.path
.join('Bin', X64
, pageTable
)
42 directory
= os
.path
.join('Bin', IA32
)
44 # output raw binary name with arch type
45 fileName
= 'ResetVector' + '.' + arch
47 if debugType
is not None:
48 fileName
+= '.' + debugType
49 fileName
+= FILE_FORMAT
51 output
= os
.path
.join(directory
, fileName
)
53 # if the directory not exists then create it
54 if not os
.path
.isdir(directory
):
55 os
.makedirs(directory
)
57 # Prepare the command to execute the nasmb
60 '-D', 'ARCH_%s' % arch
.upper(),
61 '-D', 'DEBUG_%s' % str(debugType
).upper(),
62 '-D', PAGE_TABLES
[pageTable
].upper(),
67 print(f
"Command : {' '.join(commandLine)}")
70 ret
= RunCommand(commandLine
)
71 except FileNotFoundError
:
72 print("NASM not found")
77 print(f
"something went wrong while executing {commandLine[-1]}")
79 print('\tASM\t' + output
)
83 'Tools/FixupForRawSection.py',
86 print('\tFIXUP\t' + output
)
87 ret
= RunCommand(commandLine
)
88 if ret
!= 0: sys
.exit(ret
)