-
Notifications
You must be signed in to change notification settings - Fork 345
EDK II Development Process
First check out Getting Started with EDK II for downloading the latest EDK II development project with your build environment.
Are you new to using git? If so, then the New to git page may be helpful.
Note: Commands that you should directly type into a terminal are preceded with
>$
. Unless otherwise noted, these commands are OS agnostic.
If you are new to GitHub or looking for ways to make you GitHub workflow more efficient, please read GitHub & PR Tips.
At a high-level, getting started with code development in the EDK II repo consists of the following activities:
- Tool Setup - Performed once per development machine.
- Workspace Setup - Performed once per development workspace.
- Development and Test - Performed on every code contribution.
- Code Review and CI - Performed on every code contribution.
Refer to the Build Instructions documentation. After following those instructions, you should have a workspace setup and understand how to build and test the code.
This remainder of this page focuses source management details and how to prepare for code review.
-
Create and checkout a topic branch for your change.
>$ git checkout -b <new-dev-branch> origin/master
-
Make changes in the working tree.
-
Break up working tree changes into independent commits that do not break git bisect.
-
To stage all modifications:
>$ git add -u
-
To add new files:
>$ git add <path-to-new-file>
-
To have git prompt you to selectively stage changes:
>$ git add -p
-
Follow the commit message template given below when writing commit messages.
-
To commit staged changes:
>$ git commit
- Tip: Add the
-s
parameter to automatically append yourSigned-off-by
tag to the commit message.
- Tip: Add the
-
Note any TianoCore Bugzilla items in the commit message.
-
Use the
PatchCheck.py
script underedk2/BaseTools/Scripts
directory to verify the commits are correctly formatted.-
To check the latest
<N>
changes:>$ python BaseTools/Scripts/PatchCheck.py -<N>
- For example, 2 changes would be:
>$ python BaseTools/Scripts/PatchCheck.py -2
- For example, 2 changes would be:
-
It is strongly recommended that you run
PatchCheck.py
after each commit. You can then easily amend the commit to correct any issues.
-
-
Get the latest changes from the remote (
origin
).>$ git fetch origin
Note: This updates
origin/master
, but not your localmaster
branch. (origin/master
may have newer commits thanmaster
). -
Rebase the topic branch onto
master
branch.>$ git rebase origin/master
-
Run the automated code formatting tool (Uncrustify) against your changes.
-
The changes must pass local CI which includes a code formatting check in order to be merged into the code base.
-
It is strongly recommended that you format the code after each commit. The code can then be easily amended with the formatted output. Some developers might also prefer to format frequently while writing the code using the plugin instructions described in the code formatting wiki page.
-
Compile and run local CI checks.
-
If you encounter a CI failure, you can use Stuart to run CI checks locally.
-
Stuart can both compile your code and run CI plugins that check other aspects of the code outside compilation.
-
These are the same CI checks that will run against the code when you create a pull request. By running the tests locally you will be able to get results much more quickly and reduce overhead on CI resources.
-
However, some aspects of what is used in CI versus your local setup might be different depending on what parameters you pass to Stuart. For example, if CI is using VS2019 and you are using VS2017, you might get different compilation results.
-
If you are new to the Stuart build system, first learn about the basics of Stuart in the link above and then read the "I just want to check if my changes will pass all the non-compiler checks in CI" section to learn how to get CI results without having to wait through compilation.
-
Push changes to the developer's fork of the EDK II project repository.
-
How to create a GitHub fork
-
NOTE: A GitHub fork can also be created using the command line utility called
gh
.- See
gh repo fork
.
- See
-
NOTE: A GitHub fork can also be created using the command line utility called
-
Add remote to the developer's fork of the EDK II project.
>$ git remote add <developer-id> https://github.com/<developer-id>/edk2.git
-
Push the integration branch.
>$ git push <developer-id> <new-integration-branch>
-
-
Create a GitHub pull request from the developer's
<new-integration-branch>
toedk2/master
.-
How to create a GitHub pull request.
-
If a pull request is only being created to run CI checks, create a draft pull request.
-
The relevant reviewers and maintainers need to be added to the pull request.
- If you are a maintainer, you should add the appropriate PR reviewers yourself.
- See the step in Maintainer Process
- Otherwise, a maintainer will do this for you.
- If you are a maintainer, you should add the appropriate PR reviewers yourself.
-
Resolve GitHub pull request issues if failures are reported. Common failures are shown below.
-
A merge conflict is detected. You may attempt to resolve the merge conflicts outside of GitHub by rebasing
<new-integration-branch>
withedk2/master
and resolving any conflicts that need manual resolution. After amending the relevant commits with the changes needed, a force push to<new-integration-branch>
automatically restarts the checks. -
The pull request fails the
PatchCheck.py
check. Resolve the issues reported byPatchCheck.py
. A force push to<new-integration-branch>
can be used to automatically restart the checks. -
The pull request fails Windows or Ubuntu checks. The GitHub pull request provides links to the Azure Pipelines results that are used to view test results for checks that failed.
-
-
If you are unsure how to resolve a PR failure, leave a comment in the PR to ask for help.
-
-
Modify local commits based on the review feedbacks and repeat steps 2 to 10.
-
For the latest commit, you can use
>$ git commit --amend
-
For multiple commits use
>$ git rebase -i origin/master
-
Create a GitHub discussion or consult your git gurus on edk2-devel or irc channel if you have git questions.
-
Follow the PR Conversation Resolution Process to resolve feedback conversations.
-
-
Update TianoCore Bugzilla issue(s) resolved by the change(s).
-
Add a pointer to the GitHub pull request (e.g. Readme.md: Update EDK II CI build branch name).
-
Add the PR merged to
edk2/master
(e.g.Completed in PR https://github.com/tianocore/edk2/pull/153
). -
Mark BZ issues as Resolved/Fixed.
-
-
It is recommended to register for email notifications for pull requests, pushes, and check status results by setting up notifications for the EDK II repository (tianocore/edk2).
-
Add the relevant reviewers and maintainers as reviewers to the pull request.
-
You can find the reiewers and maintainers for the code areas touched by the changes in Maintainers.txt.
-
You can also use the GetMaintainer.py script to find the list of reviewers to add.
-
-
Verify that the Pull Request title and description succinctly describe the changes.
-
PR titles and descriptions are used in repo searches and show up in release notes. More precise titles make finding changes easier in the future. High quality descriptions make it much easier to understand a set of changes in the PR.
If you are familiar with the previous mailing list based process, you can think of the PR descritpion like the cover letter.
-
-
Verify that the commit(s) can individually be submitted to
edk2/master
. Squashing commits is not allowed. -
Review the files relevant to you. Once all files are reviewed and any feedback you left is addressed, mark the PR as approved.
-
If you are leaving general feedback (not on a line of code) and you would like to ensure that your feedback is acknowledged and resolved, use a file comment by clicking the button shown below.
- Unlike a generic comment left in the PR, a comment in a code file must be resolved before the PR can be completed.
-
If you would like to leave a comment on a specific commit, it is recommended to leave a comment on the file and simply reference the commit in the comment. For example, "this change should be in commit
<commit A title>
instead of commit<commit B title>
". -
Ensure conversations in the PR follow the PR Conversation Resolution Process.
-
Note: An approval means you approve of all the changes applicable to you in the PR.
-
Apart from generic comments left in the PR and the comments left on specific files mentioned above, you can also leave a comment at the time you "Approve" or "Request changes". In the GitHub Web UI, click the "Files changed" tab and then "Review changes", select the appropriate radio box, leave your comment, and then click "Submit review".
-
-
Each code area modified in the PR will have a list of reviewers and maintainers assigned to the path in Maintainers.txt. If at least one reviewer assigned to each code area has approved the PR, the
"push"
label may be added to complete the PR.- Note: All PR status checks must succeed and there must be no merge conflicts for the PR to complete.
All conversations must be resolved for a PR to be completed. This is the process used to resolve conversations.
- A PR author is allowed to resolve conversations after they have addressed feedback.
- After addressing feedback, a PR author is expected to leave a comment describing their resolution in the conversations.
- A conversation cannot be resolved until the PR author and commenter have reached an agreed upon resolution.
EDK II BaseTools project is a Tianocore-maintained project consisting of the python source files that make up EDK2 basetools. It provides an easy way to organize and share python code to facilitate reuse across environments, tools, and scripts. In the future, this project will be the only location of the EDK II BaseTools python source code, and the EDK II project will remove all BaseTools python source code.
Now, we are in the phase where the BaseTools python code is in both the edk2 repository and the edk2-basetools repository. The BaseTools maintainer should follow the following steps to keep the code in sync.
- After the patch gets reviewed, the maintainer creates a PR to the
edk-basetools
repo, and merges it into theedk2-basetools
repo if the CI checks pass. - Wait for the new version pip module generated in pypi.org.
- Update the
edk2-basetools
value to the latest basetools pip module version from theedk2/pip-requirements.txt
file. Create a PR to the edk2 repo to trigger edk2 CI to do the packages build tests. - Create a pip-requirement patch and send it to community review.
- Get the Reviewed-by from the reviewers.
- Create a PR and merge the pip-requirement change to edk2 repository.
- Create a PR and merge the basetools patch to edk2 repository.
Home
Getting Started with EDK II
Build Instructions
EDK II Platforms
EDK II Documents
EDK II Release Planning
Reporting Issues
Reporting Security Issues
Community Information
Inclusive Language
Additional Projects & Tasks
Training
Community Support
Community Virtual Meetings
GHSA GitHub Security Advisories Proceess (Draft)