189 Commits

Author SHA1 Message Date
Sherry Fan
75cce8c66f BaseTools: fix mdlint issues
Fix markdownlint formatting issues in READMEs.

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2026-03-04 22:02:33 +00:00
Michael Kubacki
eb1e2f5434 BaseTools: Update wiki links
The wiki has moved and this change updates links in BaseTools to
reflect the new location.

- New location: https://github.com/tianocore/tianocore-wiki.github.io
  - Rendered version: https://www.tianocore.org/tianocore-wiki.github.io/
- Old location: https://github.com/tianocore/tianocore.github.io/wiki

More details: https://github.com/tianocore/edk2/discussions/11969

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-02-10 05:44:46 +00:00
Mike Beaton
a9d076d7d0 BaseTools/PatchCheck.py: Disallow commit subject lines that end with period
Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2026-01-12 12:37:59 +00:00
Michael D Kinney
3980808abf BaseTools/Scripts: KEEP .prmexportdescriptor data sections
Update GCC linker script to always keep .prmexportdescriptor
sections and merge them into the .data section.

The .prmexportdescriptor section is only used by PRM modules
for the PRM Export Descriptor Structure that must be kept
in the final image to support adding the PRM Export
Descriptor Structure and its associated PRM Handlers APIs
to a PE/COFF DLL Export section.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-10-17 06:23:17 +00:00
Oliver Smith-Denny
2ff173af12 BaseTools: Remove ARM32 Support
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 code from BaseTools.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
Oliver Smith-Denny
6093cfcdd1 BaseTools: PatchCheck.py: Allow MultiPkg Commits For Subject Check
Subject Check was added to PatchCheck.py to enforce that if a package
was touched in a commit that it be referenced in the subject line.

However, this is impractical for multipackage commits with many
packages, e.g. when stack cookies were added, every package was
touched, but in a rote way, and it is not reasonable to put every
package in a subject line.

This updates PatchCheck.py to check if ignore_multi_package is set
and if so only require that package names be included in the subject
if there are fewer than 3 packages touched. Otherwise, PatchCheck will
require the message to start with `Global:` to indicate it touches
more than 3 packages.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-05 06:32:06 +00:00
Oliver Smith-Denny
d250191042 BaseTools/PatchCheck.py: Check CI Options Before Parsing
PatchCheck.py currently parses the CI options as the last
step it does before reporting results. This means that the
other checking logic cannot use any of the CI options that
are passed in.

This updates the order of operations to process CI options
before running other checks so that they can be used in
performing checks.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-05 06:32:06 +00:00
Leif Lindholm
87a4bfd28c BaseTools/PatchCheck.py: permit at least 20 characters after ':'
Commit b55530ad44
("BaseTools/PatchCheck.py: verify commit message lists package(s)")
introduced a check for the requirement to enumerate all modified packages
in the commit subject line. But it did leave the maximum line length at
75 characters (for non-CVE commits), which can get a bit cramped for
changes to several packages.

Introduce a new arbitrary "at least 20 characters after the :" limit.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-07-02 20:14:21 +00:00
Leif Lindholm
2bcad87004 BaseTools/PatchCheck.py: clean up subject line length handling
Use a temporary variable for max subject line length and log
result of test in one location.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-07-02 20:14:21 +00:00
Leif Lindholm
27d44c1abd BaseTools/PatchCheck.py: drop redundant line count check
Before doing the subject line length check, the script checks that the
number of lines in the commit message (including subject) is not less
than or equal to zero - and returns if it is.

However, then the test for whether the subject line starts with a CVE
tag inexplicably also checks for whether the number of lines are
greater than or equal to one. This is just clutter, so drop it.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-07-02 20:14:21 +00:00
Leif Lindholm
b55530ad44 BaseTools/PatchCheck.py: verify commit message lists package(s)
Verify that the subject line matches the basic
{Package}[,Package]:
format _or_ the
Revert "<subject of commit to revert>"
format.

Non-package top-level directories are treated as packages.

Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-06-25 16:22:25 +00:00
Leif Lindholm
c44efa0fbd BaseTools/PatchCheck.py: pass list of packages to CommitMessageCheck
In order to enable subject line format compliance checking in following
patches, pass through a list of modified packages to CommitMessageCheck.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-06-25 16:22:25 +00:00
Leif Lindholm
a2e20bc4b0 BaseTools/PatchCheck.py: make get_parent_packages return directory names
The get_parent_packages function in CheckGitCommits returns the path of
non-package directories, but in fact returns the path of the .dec file
for actual packages.

Align the handling to be more consistent and return only directory names,
regarding of how it was found.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-06-25 16:22:25 +00:00
Gary Beihl
431da739a0 BaseTools: Add line number to PatchCheck error messages
PatchCheck error messages can be improved by adding the line number.
The line itself may consist of only whitespace for some errors.
Adding the line number can help better locate the error source.

Signed-off-by: Gary Beihl <garybeihl@microsoft.com>
2025-06-06 18:50:54 +00:00
Ying-Chun Liu (PaulLiu)
d985bd4b97 BaseTools: Scripts: efi_debugging.py: search for EFI_SYSTEM_TABLE_POINTER
Add code to search for gST via EFI_SYSTEM_TABLE_POINTER.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
2025-04-29 02:33:45 +00:00
Ard Biesheuvel
f2b42c83dd BaseTools/Scripts/GccBase.lds: Use separate R-W and RW- ELF segments
To prevent the ELF linkers from complaining about emitted ELF segments
that require both writable and executable permissions, define two
separate R-X and RW- ELF segments, and emit the output sections
explicitly into those segments as appropriate.

Note that this has no bearing on the PE image, and using a single RW-
segment would probably be fine too.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-02-02 09:20:53 +00:00
Ard Biesheuvel
e5d95c786b BaseTools/Scripts: Merge GCC and Clang ELF linker scripts
The original reason for creating a separate version of the ELF linker
script for Clang was the difference between COMMONPAGESIZE and
MAXPAGESIZE, which can we provided on the command line to the respective
linkers (ld.bfd versus lld). That difference no longer exists, and both
use COMMONPAGE_SIZE. So there is no longer a need to maintain a fork,
which has already been going out of sync with the original for no good
reason.

So merge the two and call it GccBase.lds

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-02-02 09:20:53 +00:00
Ard Biesheuvel
f5d585b46b BaseTools/Scripts/ClangBase.lds: Move .entry into .text section
The GccBase.lds and ClangBase.lds ELF linker scripts have been laid out
very carefully to ensure that the memory mappings of .text and .data are
such that they can be preserved in the PE/COFF memory image. This
removes the need to update any place-relative ELF relocations when
generating the PE/COFF image, making its job much easier, and
potentially allowing it to disregard static ELF relocations altogether,
and rely solely on dynamic ELF relocations.

Adding an arbitrary .entry section before .text breaks those
assumptions, so instead of emitting it as a separate section, move its
payload to the start of .text.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-02-02 09:20:53 +00:00
William Leara
f8f29a4a6a BaseTools: fix spelling error
No functional change.

Signed-off-by: William Leara <william.leara@dell.com>
2024-12-11 09:01:03 +08:00
Dhaval
aca75d3c08 BaseTools: Update alignment for entry seg for Clang
It does 3 things:
1. Use separate linker file for clang vs GCC for RISCV64.
2. Use common page size instead of max page to ensure -z option align values are properly applied.
3. Enforce alignment for .entry segment as per -z option.

When we want to have -z option aligned images, clang while
alignes .text and .data segments correctly, .entry segment
is by default not aligned unless explicitly specified.
This patch makes it explicit to clang that entry seg
should also be aligned to requirements. Somehow GCC does not require such explicit
entry. Hence detachiong both ld files.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2024-12-11 08:43:53 +08:00
Nhi Pham
7bac0a940e BaseTools/SetupGit.py: Fix invalid choice 'edk2-test'
This fixes missing 'edk2-test' in the choices of the repo name option.

Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
2024-10-09 10:53:19 +00:00
Oliver Smith-Denny
61f9695f20 BaseTools: Remove Pip BaseTools
BaseTools was moved out to a separate repo and consumed as a pip
module by edk2 CI. This process has not led to the desired goals
of doing so, so this patch removes the pip based BaseTools from
edk2 CI.

The original goal of moving BaseTools to a pip module was
primarily to speed up the development process, as the old edk2
mailing list was slow. However, with edk2 moving to PRs, it now
actually slows the BaseTools development process to have to do
a PR in another repo, publish the module, and then make a PR
in edk2 to consume the new BaseTools. It also holds up using
the features in a new BaseTools in other PRs.

There were other goals of moving, such as allowing projects to
use the BaseTools outside of edk2. This can still be accomplished
outside of this PR, this PR simply stops edk2 CI from using the
pip module.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-09-10 00:41:53 +00:00
Antaeus Kleinert-Strand
71b9bda1ac BaseTools/Scripts/BinToPcd.py: Update regex strings to use raw strings.
With Python 3.12 invalid escape sequences now generate warning messages.
This change fixes the problem exposed by the warning message.

```
BaseTools/Scripts\BinToPcd.py:40: SyntaxWarning: invalid escape sequence
BaseTools\Scripts\BinToPcd.py:46: SyntaxWarning: invalid escape sequence
```

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-08-01 11:04:09 +00:00
Michael Kubacki
3f0c4cee94 BaseTools/GetMaintainer.py: Add GitHub username argument
Adds a new `-g` parameter so that output will also include the GitHub
username.

This change uses a simple regular expression as opposed to directly
returning the original line from the file to make the extraction of
GitHub usernames more robust to other changes on the line in the
maintainers text file.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-25 02:28:49 +00:00
Joey Vagedes
8c09d862bf BaseTools: BinToPcd: Remove xdrlib dependency
The xdrlib dependency was removed in commit
5cadb8ce21 but the actual import of the
module was not removed. This commit removes the import of xdrlib and
sorts the imports.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-06-30 23:45:58 +00:00