Skip to content

Commit

Permalink
Add Windows ARM 64-bit base tools (#376)
Browse files Browse the repository at this point in the history
Please ensure you have read the [contribution
docs](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md) prior
to submitting the pull request. In particular,
[pull request
guidelines](https://github.com/microsoft/mu/blob/master/CONTRIBUTING.md#pull-request-best-practices).

This change is a part of
#305 feature work.

The change expanded the accepted target architecture for VS builds with
`AARCH64` option, which will output native Windows ARM64 binaries.

Note that the warnings due to integer conversions are suppressed for
this specific target to avoid too much local changes carried in MU. The
formal change should drop all these binaries and move to pythonic
scripts.

For each item, place an "x" in between `[` and `]` if true. Example:
`[x]`.
_(you can also check items in the GitHub UI)_

- [x] Impacts functionality?
- **Functionality** - Does the change ultimately impact how firmware
functions?
- Examples: Add a new library, publish a new PPI, update an algorithm,
...
- [ ] Impacts security?
- **Security** - Does the change have a direct security impact on an
application,
    flow, or firmware?
  - Examples: Crypto algorithm change, buffer overflow fix, parameter
    validation improvement, ...
- [ ] Breaking change?
- **Breaking change** - Will anyone consuming this change experience a
break
    in build or boot behavior?
- Examples: Add a new library class, move a module to a different repo,
call
    a function in a new library class in a pre-existing module, ...
- [ ] Includes tests?
  - **Tests** - Does the change include any explicit test code?
  - Examples: Unit tests, integration tests, robot tests, ...
- [ ] Includes documentation?
- **Documentation** - Does the change contain explicit documentation
additions
    outside direct code modifications (and comments)?
- Examples: Update readme file, add feature readme file, link to
documentation
    on an a separate Web page, ...

This was tested on Windows ARM64 hardware systems.

N/A
  • Loading branch information
kuqin12 authored and kenlautner committed Oct 18, 2023
1 parent 0872698 commit 3694015
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
10 changes: 8 additions & 2 deletions .azurepipelines/BaseTools-Build-For-Publication.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ name: BaseTools_Bin_$(release_version)_$(Rev:r)
variables:
linux_build_output_path: '$(Build.Repository.LocalPath)/BaseTools/Source/C/bin'
linux_artifact_name: 'LinuxOutput'
windows_build_output_path: '$(Build.Repository.LocalPath)\BaseTools\Bin\Win32'
windows_build_output_path: '$(Build.Repository.LocalPath)\BaseTools\Bin'
windows_artifact_name: 'WindowsOutput'
temp_publication_directory: 'PackageStaging'
package_artifact_name: 'NugetReleasePackage'
Expand Down Expand Up @@ -86,8 +86,13 @@ jobs:
matrix:
TARGET_x86:
Build.Targets: 'IA32'
Build.TargetFolder: 'Win32'
TARGET_ARM:
Build.Targets: 'ARM'
Build.TargetFolder: 'Win32'
TARGET_AArch64:
Build.Targets: 'AARCH64'
Build.TargetFolder: 'Win64'

pool:
vmImage: windows-latest
Expand Down Expand Up @@ -126,7 +131,7 @@ jobs:
extra_parameters: '--skip_path_env -a $(Build.Targets)'
tool_chain_tag: 'VS2022'

- publish: $(windows_build_output_path)
- publish: '$(windows_build_output_path)\$(Build.TargetFolder)'
artifact: $(windows_artifact_name)_$(Build.Targets)
displayName: Publish To Pipeline
condition: SucceededOrFailed()
Expand Down Expand Up @@ -188,6 +193,7 @@ jobs:
mv $(Pipeline.Workspace)/$(linux_artifact_name)_AARCH64 $(Build.StagingDirectory)/$(temp_publication_directory)/Linux-ARM-64;
mv $(Pipeline.Workspace)/$(windows_artifact_name)_IA32 $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-x86;
mv $(Pipeline.Workspace)/$(windows_artifact_name)_ARM $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-ARM;
mv $(Pipeline.Workspace)/$(windows_artifact_name)_AARCH64 $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-ARM-64;
displayName: Stage Package Files

- powershell:
Expand Down
3 changes: 2 additions & 1 deletion BaseTools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ Source/C/VfrCompile/VfrTokens.h
Source/C/bin/
Source/C/libs/
Bin/Win32
Bin/Win64
Lib
BaseToolsBuild/
BaseToolsBuild/
12 changes: 11 additions & 1 deletion BaseTools/Edk2ToolsBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,19 @@ def Go(self):
if self.target_arch == "IA32":
VcToolChainArch = "x86"
TargetInfoArch = "x86"
OutputDir = "Win32"
elif self.target_arch == "ARM":
VcToolChainArch = "x86_arm"
TargetInfoArch = "ARM"
OutputDir = "Win32"
elif self.target_arch == "X64":
VcToolChainArch = "amd64"
TargetInfoArch = "x86"
OutputDir = "Win64"
elif self.target_arch == "AARCH64":
VcToolChainArch = "amd64_arm64"
TargetInfoArch = "ARM"
OutputDir = "Win64"
else:
raise NotImplementedError()
# MU_CHANGE
Expand All @@ -166,7 +176,7 @@ def Go(self):
shell_env.set_shell_var('HOST_ARCH', self.target_arch)

self.OutputDir = os.path.join(
shell_env.get_shell_var("EDK_TOOLS_PATH"), "Bin", "Win32")
shell_env.get_shell_var("EDK_TOOLS_PATH"), "Bin", OutputDir)

# compiled tools need to be added to path because antlr is referenced
# MU_CHANGE: Added logic to support cross compilation scenarios
Expand Down
12 changes: 11 additions & 1 deletion BaseTools/Source/C/Makefiles/ms.common
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,23 @@ LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64

# MU_CHANGE Starts: Adding support to build base tools for ARM
# MU_CHANGE Starts: Adding support to build base tools for ARM and AARCH64
!ELSEIF "$(HOST_ARCH)"=="ARM"
ARCH_INCLUDE = $(SOURCE_PATH)\Include\Arm
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
!ELSEIF "$(HOST_ARCH)"=="AARCH64"
ARCH_INCLUDE = $(SOURCE_PATH)\Include\AArch64
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
# Note: These are bit-width conversion related warning suppressions we carry to avoid much more
# overrides in the C code. The future plan is to replace all of these binary based tools
# with python scripts, when it happens in tianocore..
CFLAGS = $(CFLAGS) /wd4267 /wd4244 /wd4334
# MU_CHANGE Ends

!ELSE
Expand Down

0 comments on commit 3694015

Please sign in to comment.