]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/ResetVector/Build.py
OvmfPkg/README: Add information about OVMF flash layout
[mirror_edk2.git] / OvmfPkg / ResetVector / Build.py
CommitLineData
c90e37b5
JJ
1## @file
2# Automate the process of building the various reset vector types
3#
4# Copyright (c) 2009 - 2013, 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
27ThisDir = os.path.realpath(os.path.split(sys.argv[0])[0])
28WorkspaceDir = os.path.realpath(os.path.join(ThisDir, '..', '..'))
29UefiCpuPkgVtf0Dir = os.path.join(WorkspaceDir, 'UefiCpuPkg', 'ResetVector', 'Vtf0')
30
31for arch in ('x64',):
32 for debugType in (None,):
33 output = os.path.join('Bin', 'ResetVector')
34 output += '.' + arch
35 if debugType is not None:
36 output += '.' + debugType
37 output += '.raw'
38 commandLine = (
39 'nasm',
40 '-D', 'ARCH_%s' % arch.upper(),
41 '-D', 'DEBUG_%s' % str(debugType).upper(),
42 '-I', UefiCpuPkgVtf0Dir + os.path.sep,
43 '-o', output,
44 'ResetVectorCode.asm',
45 )
46 ret = RunCommand(commandLine)
47 print '\tASM\t' + output
48 if ret != 0: sys.exit(ret)
49
50 commandLine = (
51 'python',
52 'Tools/FixupForRawSection.py',
53 output,
54 )
55 print '\tFIXUP\t' + output
56 ret = RunCommand(commandLine)
57 if ret != 0: sys.exit(ret)
58