Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CLANGPDB to build ARM SBSA #944

Merged
merged 149 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 146 commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
f269592
BRANCH DEPRECATION NOTICE: Use GitHub main branch!
makubacki Oct 14, 2022
4c4912d
Merge branch 'main' of https://github.com/microsoft/mu_tiano_platforms
kuqin12 Apr 3, 2024
9f6675a
Merge branch 'main' of https://github.com/microsoft/mu_tiano_platforms
kuqin12 May 8, 2024
2754751
Submodule update
kuqin12 May 9, 2024
4808172
Use system QEMU and update toolchain tag to use clangpdb
kuqin12 May 9, 2024
d03e157
diusable ffa
kuqin12 May 9, 2024
f8fdcef
work from toolsdef
kuqin12 May 10, 2024
0189d73
fix basecore
kuqin12 May 10, 2024
040d4b6
Merge remote-tracking branch 'github/main' into personal/kuqin/clang_…
kuqin12 May 10, 2024
ccda975
Updated submodule to github
kuqin12 May 10, 2024
993e543
it works like hack but works
kuqin12 May 13, 2024
0358ab6
Update oem sample to mainline
kuqin12 May 14, 2024
5948401
Update config to mainline
kuqin12 May 14, 2024
9db0636
Test build with clang pdb
kuqin12 May 14, 2024
9fce794
simplify the logic
kuqin12 May 14, 2024
0f25b59
test pipeline
kuqin12 May 14, 2024
eb92622
Removed some steps temporarily
kuqin12 May 14, 2024
10a9920
Using the correct branch
kuqin12 May 14, 2024
732b584
Fixing the tool chain tag?
kuqin12 May 14, 2024
9f57eb1
missed the point
kuqin12 May 14, 2024
cb79fcc
uncrustify
kuqin12 May 14, 2024
925cba8
once more
kuqin12 May 14, 2024
7ab0f0b
see if this tells anything?
kuqin12 May 14, 2024
cce4d35
Use the feeds
kuqin12 May 14, 2024
13be08e
missing some crap
kuqin12 May 15, 2024
94caedd
Update again
kuqin12 May 15, 2024
f82f36f
Does this work?
kuqin12 May 15, 2024
33036d7
Update again by reversion
kuqin12 May 15, 2024
e64fe53
See if this is better
kuqin12 May 15, 2024
ad0535c
How about now?
kuqin12 May 15, 2024
ef1ba4a
try this?
kuqin12 May 15, 2024
9bf0158
Update TFA?
kuqin12 May 15, 2024
f049d61
Updated tfa
kuqin12 May 16, 2024
1b414be
Fixing the tfa?
kuqin12 May 16, 2024
c037dda
does this work?
kuqin12 May 16, 2024
07d6594
see if this hack works?
kuqin12 May 16, 2024
faa2384
that will do?
kuqin12 May 17, 2024
1cd11b0
clang path
kuqin12 May 17, 2024
54a5adc
that will do 2?
kuqin12 May 17, 2024
75da310
another set
kuqin12 May 17, 2024
b6200c8
Finishing the where?
kuqin12 May 17, 2024
f8ca6f4
another hack?
kuqin12 May 18, 2024
f437564
add more logs
kuqin12 May 20, 2024
4e8206c
how about now?
kuqin12 May 20, 2024
7dd83bf
again..
kuqin12 May 21, 2024
762d4cf
back to the beginning?
kuqin12 May 21, 2024
252f430
how is that?
kuqin12 May 21, 2024
33c3fbb
this should do?
kuqin12 May 21, 2024
561061e
Update the path
kuqin12 May 21, 2024
8c1707f
Update tfa
kuqin12 May 21, 2024
ad40db4
Update tfa and remove fip tool build
kuqin12 May 21, 2024
ab469ad
Finishing the yml
kuqin12 May 21, 2024
f7fc021
remvoe v=1
kuqin12 May 22, 2024
18c78d4
How is now?
kuqin12 May 22, 2024
8b97ce1
update tfa for more pritns
kuqin12 May 22, 2024
5caa933
more crap
kuqin12 May 22, 2024
eeca747
drop more crap[
kuqin12 May 22, 2024
22fa016
one more
kuqin12 May 22, 2024
26364b7
quick test?
kuqin12 May 22, 2024
b979af4
Even quicker?
kuqin12 May 22, 2024
3fc6ff4
Fixing the build?
kuqin12 May 22, 2024
371e467
how about this junk?
kuqin12 May 22, 2024
9224499
see if this will do?
kuqin12 May 23, 2024
5f2879b
Updte tfa printing
kuqin12 May 23, 2024
7f10bac
clabg bin
kuqin12 May 23, 2024
3daeb15
not chck out other submodules
kuqin12 May 23, 2024
b0551db
one more piece
kuqin12 May 23, 2024
8ef27f2
that aint work
kuqin12 May 23, 2024
88ba998
How is that
kuqin12 May 23, 2024
ef4f94c
this is really getting annoying
kuqin12 May 23, 2024
0b37b8f
last try
kuqin12 May 23, 2024
7368c8a
how abhout this?
kuqin12 May 23, 2024
232a5ff
This should be better?
kuqin12 May 23, 2024
b795f9d
Print more staff from TFA
kuqin12 May 23, 2024
6a82353
print more crap
kuqin12 May 23, 2024
60ae3f5
finish tfa
kuqin12 May 23, 2024
6b43df5
remove everything?
kuqin12 May 24, 2024
573267f
flush path
kuqin12 May 24, 2024
6a9e4b0
now should do
kuqin12 May 24, 2024
05c2741
now?
kuqin12 May 24, 2024
14d9797
make fip as well
kuqin12 May 24, 2024
5e46001
add back the path?
kuqin12 May 24, 2024
7a0bbea
Put it back to post build
kuqin12 May 24, 2024
4728e32
add top of tfa
kuqin12 May 24, 2024
b09ad91
simplfy the make
kuqin12 May 24, 2024
ac69a8b
why do i need to update basecore all this time?
kuqin12 May 24, 2024
afb0c5b
fix?
kuqin12 May 24, 2024
1105284
more
kuqin12 May 25, 2024
56b8759
oops
kuqin12 May 25, 2024
347fe97
it works now?
kuqin12 May 27, 2024
665fbe1
update tfa
kuqin12 May 27, 2024
8de62e8
what about now?
kuqin12 May 27, 2024
2c5a1d6
another shot?
kuqin12 May 28, 2024
3ed9c18
come on...
kuqin12 May 28, 2024
2949473
Merge remote-tracking branch 'github/main' into personal/kuqin/clang_…
kuqin12 May 28, 2024
2ffeb76
added more prints
kuqin12 May 28, 2024
e76c8f4
try it here
kuqin12 May 29, 2024
6f1ea13
update TFA
kuqin12 May 29, 2024
21fddcb
Revert some junk
kuqin12 May 29, 2024
3b65673
revert more
kuqin12 May 29, 2024
fbb19c1
Update basecore
kuqin12 Jun 4, 2024
5c46571
Merge remote-tracking branch 'github/main' into personal/kuqin/clang_…
kuqin12 Jun 4, 2024
2ca2ae6
4 cores by default
kuqin12 Jun 4, 2024
a78f52a
removed some junk
kuqin12 Jun 4, 2024
620cffe
Updated mu
kuqin12 Jun 4, 2024
ccabc2c
Update mu basecore
kuqin12 Jun 4, 2024
fd6c219
Add them back
kuqin12 Jun 4, 2024
db3332f
Update yml
kuqin12 Jun 4, 2024
1c824fd
Merge remote-tracking branch 'github/main' into personal/kuqin/clang_…
kuqin12 Jun 4, 2024
7aeeb4c
revert changes after discussion
kuqin12 Jun 5, 2024
b1a6a91
Merge remote-tracking branch 'github/main' into personal/kuqin/clang_…
kuqin12 Jun 5, 2024
21f4386
update submodule
kuqin12 Jun 5, 2024
30be150
update to new basecore
kuqin12 Jun 5, 2024
91c5657
revert some changes
kuqin12 Jun 5, 2024
d1b0e0a
added back more
kuqin12 Jun 5, 2024
e98fc7e
complete that
kuqin12 Jun 5, 2024
55680ea
more changes
kuqin12 Jun 5, 2024
2a4994f
more changes
kuqin12 Jun 5, 2024
194f426
test change
kuqin12 Jun 5, 2024
4e5ed6c
bottom line
kuqin12 Jun 5, 2024
f32abaf
default back to gcc
kuqin12 Jun 5, 2024
4e9cfe9
remove unused ones
kuqin12 Jun 5, 2024
af69257
update mu_plus
kuqin12 Jun 5, 2024
932ec4d
Fix normal gcc5 build for Q35
kuqin12 Jun 5, 2024
f5179f6
fixing gcc
kuqin12 Jun 5, 2024
db691b3
fixing some more of the scripts
kuqin12 Jun 5, 2024
2b47aa7
pick up correct mu_plus
kuqin12 Jun 5, 2024
dcbc7ba
remove 2 step
kuqin12 Jun 5, 2024
f82e9c5
updated supv to fix an error
kuqin12 Jun 5, 2024
84c194b
removed clang bin
kuqin12 Jun 6, 2024
1a76ea6
Upadted mu
kuqin12 Jun 6, 2024
fa215a4
alright, add lib..
kuqin12 Jun 6, 2024
b2e35b4
updated fiptool...
kuqin12 Jun 6, 2024
2df9c01
how is this
kuqin12 Jun 6, 2024
ced9f45
Merge remote-tracking branch 'github/main' into personal/kuqin/clang_…
kuqin12 Jun 6, 2024
7d478f7
supv update
kuqin12 Jun 6, 2024
f43f012
revert it back?
kuqin12 Jun 6, 2024
5960d07
move the comment
kuqin12 Jun 6, 2024
59f1335
clean up the py
kuqin12 Jun 6, 2024
22f23da
remove some junk
kuqin12 Jun 6, 2024
d5d274a
hmm
kuqin12 Jun 6, 2024
752a80c
remove it so that i can add it back
kuqin12 Jun 6, 2024
af4b153
add it back
kuqin12 Jun 6, 2024
983d059
remove the rogue lib
kuqin12 Jun 6, 2024
3ece963
more odd stuff
kuqin12 Jun 6, 2024
a95699f
get the build to mainline
kuqin12 Jun 7, 2024
2eaf05f
fixing the dsc
kuqin12 Jun 7, 2024
bb53262
Merge branch 'main' into personal/kuqin/clang_test
kuqin12 Jun 8, 2024
3ce9c15
Merge branch 'main' into personal/kuqin/clang_test
kuqin12 Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .azurepipelines/Platform-Build-Job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:

- template: Steps/BuildPlatform.yml@mu_devops
parameters:
tool_chain_tag: $(tool_chain_tag)
tool_chain_tag: ${{ parameters.tool_chain_tag }}
build_pkg: ${{ item.Value.BuildPackage }}
build_target: ${{ item.Value.BuildTarget }}
build_file: ${{ item.Value.BuildFile }}
Expand All @@ -100,7 +100,7 @@ jobs:
run_timeout: ${{ parameters.run_timeout }}
extra_install_step: ${{ parameters.extra_install_step }}
install_tools: ${{ and(ne(item.Value.SelfHostAgent, true), eq(parameters.container_image, '')) }}
artifacts_identifier: '${{ item.Value.BuildPackage }} $(tool_chain_tag) ${{ item.Value.BuildTarget }} ${{ item.Value.BuildExtraTag }}'
artifacts_identifier: '${{ item.Value.BuildPackage }} ${{ parameters.tool_chain_tag }} ${{ item.Value.BuildTarget }} ${{ item.Value.BuildExtraTag }}'
artifacts_binary: ${{ item.Value.BuildArtifactsBinary }}
${{ if or(eq(item.Value.Run, true), eq(parameters.os_type, 'Linux'), EndsWith(item.Key, 'CODE_COVERAGE')) }}:
artifacts_other: ${{ item.Value.BuildArtifactsOther }}
Expand Down
67 changes: 67 additions & 0 deletions .azurepipelines/Platform-Build-VS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,70 @@ jobs:
displayName: Install Report Generator
BuildArtifactsOther: "**/Coverage/**"
Run: false

- template: Platform-Build-Job.yml
cfernald marked this conversation as resolved.
Show resolved Hide resolved
parameters:
extra_install_step:
- template: Steps/InstallCoverageTools.yml@mu_devops
tool_chain_tag: 'CLANGPDB'
vm_image: $(vm_image)
os_type: Windows_NT
build_matrix:
QemuQ35_DEBUG_CLANGPDB:
BuildPackage: QemuQ35Pkg
BuildFile: "Platforms/QemuQ35Pkg/PlatformBuild.py"
BuildFlags: ""
BuildTarget: "DEBUG"
BuildExtraTag: ""
BuildExtraStep:
- template: Steps/RustSetupSteps.yml@mu_devops
Run: true
RunFlags: "SHUTDOWN_AFTER_RUN=TRUE QEMU_HEADLESS=TRUE EMPTY_DRIVE=TRUE BLD_*_QEMU_CORE_NUM=2 TEST_REGEX=*TestApp*.efi RUN_TESTS=TRUE"
BuildArtifactsBinary: |
**/QEMUQ35_*.fd
BuildArtifactsOther: "**/unit_test_results/*"

QemuQ35_RELEASE_CLANGPDB:
BuildPackage: QemuQ35Pkg
BuildFile: "Platforms/QemuQ35Pkg/PlatformBuild.py"
BuildFlags: ""
BuildTarget: "RELEASE"
BuildExtraTag: ""
BuildExtraStep:
- template: Steps/RustSetupSteps.yml@mu_devops
Run: true
RunFlags: "SHUTDOWN_AFTER_RUN=TRUE QEMU_HEADLESS=TRUE EMPTY_DRIVE=TRUE BLD_*_QEMU_CORE_NUM=2 TEST_REGEX=*TestApp*.efi RUN_TESTS=TRUE"
BuildArtifactsBinary: |
**/QEMUQ35_*.fd
BuildArtifactsOther: "**/unit_test_results/*"

QemuSbsa_DEBUG_CLANGPDB:
BuildPackage: QemuSbsaPkg
BuildFile: "Platforms/QemuSbsaPkg/PlatformBuild.py"
BuildTarget: "DEBUG"
BuildExtraTag: ""
BuildExtraStep:
- template: Steps/RustSetupSteps.yml@mu_devops
- template: Steps/SetupToolChainTagPreReqs.yml@mu_devops
Run: true
RunFlags: "SHUTDOWN_AFTER_RUN=TRUE QEMU_HEADLESS=TRUE EMPTY_DRIVE=TRUE TEST_REGEX=*TestApp*.efi RUN_TESTS=TRUE"
BuildArtifactsBinary: |
**/QEMU_EFI.fd
**/SECURE_FLASH0.fd
BuildArtifactsOther: "**/unit_test_results/*"

QemuSbsa_RELEASE_CLANGPDB:
BuildPackage: QemuSbsaPkg
BuildFile: "Platforms/QemuSbsaPkg/PlatformBuild.py"
BuildFlags: ""
BuildTarget: "RELEASE"
BuildExtraTag: ""
BuildExtraStep:
- template: Steps/RustSetupSteps.yml@mu_devops
- template: Steps/SetupToolChainTagPreReqs.yml@mu_devops
Run: true
RunFlags: "SHUTDOWN_AFTER_RUN=TRUE QEMU_HEADLESS=TRUE EMPTY_DRIVE=TRUE TEST_REGEX=*TestApp*.efi RUN_TESTS=TRUE"
BuildArtifactsBinary: |
**/QEMU_EFI.fd
**/SECURE_FLASH0.fd
BuildArtifactsOther: "**/unit_test_results/*"
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
[submodule "Features/MM_SUPV"]
path = Features/MM_SUPV
url = https://github.com/microsoft/mu_feature_mm_supv.git
[submodule "Features/DEBUGGER"]
path = Features/DEBUGGER
url = https://github.com/microsoft/mu_feature_debugger.git
[submodule "Features/DEBUGGER"]
path = Features/DEBUGGER
url = https://github.com/microsoft/mu_feature_debugger.git
kuqin12 marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion MU_BASECORE
3 changes: 2 additions & 1 deletion Platforms/QemuQ35Pkg/QemuQ35Pkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -1533,4 +1533,5 @@ QemuQ35Pkg/Library/ResetSystemLib/StandaloneMmResetSystemLib.inf
# protection of DXE_SMM_DRIVER/SMM_CORE modules
[BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER, BuildOptions.common.EDKII.SMM_CORE, BuildOptions.common.EDKII.DXE_DRIVER, BuildOptions.common.EDKII.DXE_CORE, BuildOptions.common.EDKII.UEFI_DRIVER, BuildOptions.common.EDKII.UEFI_APPLICATION, BuildOptions.common.EDKII.MM_CORE_STANDALONE, BuildOptions.common.EDKII.MM_STANDALONE]
MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
GCC:*_GCC5_*_DLINK_FLAGS = -z common-page-size=0x1000
GCC:*_CLANGPDB_*_DLINK_FLAGS = /ALIGN:4096
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
#include <Generated/ConfigClientGenerated.h>
#include <Generated/ConfigDataGenerated.h>

PROFILE gProfileData = { 0 };
UINTN gNumProfiles = 0;
PROFILE gProfileData = { 0 };
UINTN gNumProfiles = 0;
CHAR8 *gProfileFlavorNames[] = { NULL };
104 changes: 96 additions & 8 deletions Platforms/QemuSbsaPkg/PlatformBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from edk2toolext.invocables.edk2_update import UpdateSettingsManager
from edk2toolext.invocables.edk2_parse import ParseSettingsManager
from edk2toollib.utility_functions import RunCmd
from edk2toollib.windows.locate_tools import QueryVcVariables
from edk2toollib.utility_functions import GetHostInfo

# Declare test whose failure will not return a non-zero exit code
FAILURE_EXEMPT_TESTS = {
Expand All @@ -40,7 +42,7 @@ class CommonPlatform():
PackagesSupported = ("QemuSbsaPkg",)
ArchSupported = ("AARCH64",)
TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")
Scopes = ('qemu', 'qemusbsa', 'gcc_aarch64_linux', 'edk2-build', 'cibuild', 'configdata', 'rust-ci')
Scopes = ('qemu', 'qemusbsa', 'edk2-build', 'cibuild', 'configdata', 'rust-ci')
WorkspaceRoot = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
PackagesPath = (
"Platforms",
Expand Down Expand Up @@ -113,7 +115,13 @@ def GetWorkspaceRoot(self):

def GetActiveScopes(self):
''' return tuple containing scopes that should be active for this process '''
return CommonPlatform.Scopes
scopes = CommonPlatform.Scopes
actual_tool_chain_tag = shell_environment.GetBuildVars().GetValue(
"TOOL_CHAIN_TAG", ""
)
if actual_tool_chain_tag.upper().startswith("GCC"):
scopes += ("gcc_aarch64_linux",)
return scopes

def FilterPackagesToTest(self, changedFilesList: list, potentialPackagesList: list) -> list:
''' Filter other cases that this package should be built
Expand Down Expand Up @@ -157,13 +165,54 @@ class PlatformBuilder(UefiBuilder, BuildSettingsManager):
def __init__(self):
UefiBuilder.__init__(self)

# Helper function to query the VC variables of interest and inject them into the environment
def InjectVcVarsOfInterests(self, vcvars: list):
HostInfo = GetHostInfo()

# check to see if host is configured
# HostType for VS tools should be (defined in tools_def):
# x86 == 32bit Intel
# x64 == 64bit Intel
# arm == 32bit Arm
# arm64 == 64bit Arm
#
HostType = shell_environment.GetEnvironment().get_shell_var("CLANG_VS_HOST")
if HostType is not None:
HostType = HostType.lower()
logging.info(
f"CLANG_VS_HOST defined by environment. Value is {HostType}")
else:
#figure it out based on host info
if HostInfo.arch == "x86":
if HostInfo.bit == "32":
HostType = "x86"
elif HostInfo.bit == "64":
HostType = "x64"
else:
# anything other than x86 or x64 is not supported
raise NotImplementedError()

# CLANG_VS_HOST options are not exactly the same as QueryVcVariables. This translates.
VC_HOST_ARCH_TRANSLATOR = {
"x86": "x86", "x64": "AMD64", "arm": "not supported", "arm64": "not supported"}

# now get the environment variables for the platform
shell_env = shell_environment.GetEnvironment()
# Use the tools lib to determine the correct values for the vars that interest us.
vs_vars = QueryVcVariables(
vcvars, VC_HOST_ARCH_TRANSLATOR[HostType])
for (k, v) in vs_vars.items():
shell_env.set_shell_var(k, v)

def CleanTree(self, RemoveConfTemplateFilesToo=False):
# If this is a Windows Clang build, we need to inject the VC variables of interest
if self.env.GetValue("TOOL_CHAIN_TAG") == "CLANGPDB" and os.name == 'nt':
self.InjectVcVarsOfInterests(["VCToolsInstallDir", "Path", "LIB"])

# Add a step to clean up BL31 as well, if asked
cmd = "make"
args = "distclean"
ret = RunCmd(cmd, args, workingdir= self.env.GetValue("ARM_TFA_PATH"))
if ret != 0:
return ret
RunCmd(cmd, args, workingdir=self.env.GetValue("ARM_TFA_PATH"))

return super().CleanTree(RemoveConfTemplateFilesToo)

Expand All @@ -182,7 +231,13 @@ def GetPackagesPath(self):

def GetActiveScopes(self):
''' return tuple containing scopes that should be active for this process '''
return CommonPlatform.Scopes
scopes = CommonPlatform.Scopes
actual_tool_chain_tag = shell_environment.GetBuildVars().GetValue(
"TOOL_CHAIN_TAG", ""
)
if actual_tool_chain_tag.upper().startswith("GCC"):
scopes += ("gcc_aarch64_linux",)
return scopes

def GetName(self):
''' Get the name of the repo, platform, or product being build '''
Expand Down Expand Up @@ -278,8 +333,39 @@ def PlatformPostBuild(self):
op_fv = os.path.join(self.env.GetValue("BUILD_OUTPUT_BASE"), "FV")

logging.info("Building TF-A")

shell_environment.CheckpointBuildVars() # checkpoint our config before we mess with it
if self.env.GetValue("TOOL_CHAIN_TAG") == "CLANGPDB":
if os.name == 'nt':
# If this is a Windows build, we need to demolish the path and inject the VC variables of interest
# otherwise the build could pick up wrong tools
shell_environment.GetEnvironment().set_path('')
self.InjectVcVarsOfInterests(["LIB", "Path"])

clang_exe = "clang.exe"
choco_path = shell_environment.GetEnvironment().get_shell_var("CHOCOLATEYINSTALL")
shell_environment.GetEnvironment().insert_path(os.path.join(choco_path, "bin"))
shell_environment.GetEnvironment().insert_path(shell_environment.GetEnvironment().get_shell_var("CLANG_BIN"))

# Need to build fiptool separately because the build system will override LIB with LIBC for firmware builds
cmd = "make"
args = " fiptool MAKEFLAGS= LIB=\"" + shell_environment.GetEnvironment().get_shell_var("LIB") + "\""
ret = RunCmd(cmd, args, workingdir=self.env.GetValue("ARM_TFA_PATH"))
if ret != 0:
return ret
# Then we can make the firmware images with the fiptool built above
else:
clang_exe = "clang"

cmd = "make"
args = "CROSS_COMPILE=" + shell_environment.GetEnvironment().get_shell_var("GCC5_AARCH64_PREFIX")
if self.env.GetValue("TOOL_CHAIN_TAG") == "CLANGPDB":
args = "CC="+clang_exe
elif self.env.GetValue("TOOL_CHAIN_TAG") == "GCC5":
args = "CROSS_COMPILE=" + shell_environment.GetEnvironment().get_shell_var("GCC5_AARCH64_PREFIX")
args += " -j $(nproc)"
else:
logging.error("Unsupported toolchain")
return -1
args += " PLAT=" + self.env.GetValue("QEMU_PLATFORM").lower()
args += " ARCH=" + self.env.GetValue("TARGET_ARCH").lower()
args += " DEBUG=" + str(1 if self.env.GetValue("TARGET").lower() == 'debug' else 0)
Expand All @@ -288,11 +374,13 @@ def PlatformPostBuild(self):
# args += " FEATURE_DETECTION=1" # Enforces support for features enabled.
args += " BL32=" + os.path.join(op_fv, "BL32_AP_MM.fd")
args += " all fip"
args += " -j $(nproc)"
ret = RunCmd(cmd, args, workingdir= self.env.GetValue("ARM_TFA_PATH"))
if ret != 0:
return ret

# Revert the build vars to the original state
shell_environment.RevertBuildVars()

# Now that BL31 is built with BL32 supplied, patch BL1 and BL31 built fip.bin into the SECURE_FLASH0.fd
op_tfa = os.path.join (
self.env.GetValue("ARM_TFA_PATH"), "build",
Expand Down
21 changes: 14 additions & 7 deletions Platforms/QemuSbsaPkg/QemuSbsaPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,6 @@
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
!if $(TARGET) != RELEASE
DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
!endif
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
ResetSystemLib|MdeModulePkg/Library/RuntimeResetSystemLib/RuntimeResetSystemLib.inf

Expand Down Expand Up @@ -626,9 +623,15 @@
#
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x40
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x0
!if $(TOOL_CHAIN_TAG) == GCC5 # This is really odd on why CLANGPDB has runtime memory consumption differences
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x505
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x258
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x260
!else
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x30
kuqin12 marked this conversation as resolved.
Show resolved Hide resolved
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x40
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x300
!endif
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|0x5DC
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|0x2EE0
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|0x14
Expand Down Expand Up @@ -1365,7 +1368,7 @@
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf {
<LibraryClasses>
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
NULL|MdeModulePkg/Library/VarCheckPolicyLib/VarCheckPolicyLibStandaloneMm.inf
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
Expand Down Expand Up @@ -1394,12 +1397,16 @@
RVCT:*_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES
GCC:*_*_*_CC_FLAGS = -DDISABLE_NEW_DEPRECATED_INTERFACES

[BuildOptions.common.EDKII.SEC,BuildOptions.common.EDKII.MM_CORE_STANDALONE]
GCC:*_CLANGPDB_*_DLINK_FLAGS = /ALIGN:0x1000 /FILEALIGN:0x1000

[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION,BuildOptions.common.EDKII.MM_CORE_STANDALONE,BuildOptions.common.EDKII.MM_STANDALONE]
GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
GCC:*_GCC5_*_DLINK_FLAGS = -z common-page-size=0x1000
GCC:*_CLANGPDB_*_DLINK_FLAGS = /ALIGN:0x1000

[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
GCC:*_*_ARM_DLINK_FLAGS = -z common-page-size=0x1000
GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
GCC:*_GCC5_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
GCC:*_CLANGPDB_AARCH64_DLINK_FLAGS = /ALIGN:0x10000
RVCT:*_*_ARM_DLINK_FLAGS = --scatter $(EDK_TOOLS_PATH)/Scripts/Rvct-Align4K.sct

[BuildOptions.AARCH64.EDKII.MM_CORE_STANDALONE,BuildOptions.AARCH64.EDKII.MM_STANDALONE]
Expand Down
Loading