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

Minor updates to the porting readme #881

Merged
merged 5 commits into from
Sep 16, 2024
Merged
Changes from all commits
Commits
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
79 changes: 46 additions & 33 deletions docs/user/integrate/porting.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ First we will start by creating our workspace.
```bash
mkdir rpi
cd rpi
git init
git init --initial-branch=main
```

We'll add a `.gitignore` to keep things sensible.
Expand Down Expand Up @@ -101,18 +101,25 @@ To be clear, **don't use EDK2 and MU_BASECORE in the same tree**. They overlap
since MU_BASECORE has EDK2 as an upstream.

We'll want to make sure we have the same commit so for each of the submodules,
we'll checkout a specific commit hash.
we'll checkout a specific commit hash. Don't worry about submodules within
the submodules, those will be pulled in a later step to demonstrate stuart_update.

```bash
cd ~/rpi
cd edk2
cd ~/rpi/edk2
git checkout edk2-stable201911
cd ..
cd platforms
cd ../platforms
git checkout 0e6e3fc4af678d5241b4e8f8c14c126212ff2522
cd ..
cd non-osi
cd ../non-osi
git checkout d580026dbbe87c081dce26b1872df83fa79cd740
cd ..
```

And the current scripts require at least one entry in the Git repository history,
so commit all changes so far to your local repo.

```bash
git add -A
git commit -m "Initial commit"
```

At this point, we're almost ready. Our tree should look like this:
Expand All @@ -126,16 +133,17 @@ rpi
|---edk2
| |...
|
|---platform
| |
|---platforms
| |---Drivers
| |---Platform
| |---Silicon
| |...
|
|---non-osi
| |---Emulator
| |---Platform
| |---Silicon
| |...
|
```

Expand Down Expand Up @@ -232,11 +240,9 @@ class RpiSettingsManager(UpdateSettingsManager, SetupSettingsManager, BuildSetti
If no RequiredSubmodules return an empty iterable
'''
return [
RequiredSubmodule("MU_BASECORE"),
RequiredSubmodule("Common/MU_OEM"),
RequiredSubmodule("Common/MU"),
RequiredSubmodule("Common/TIANO"),
RequiredSubmodule("Silicon/ARM/MU_TIANO"),
RequiredSubmodule("edk2"),
RequiredSubmodule("non-osi"),
RequiredSubmodule("platforms"),
]

def GetArchitecturesSupported(self):
Expand Down Expand Up @@ -380,21 +386,25 @@ PROGRESS - Success

### Build

If you were to try a platform build, it would fail saying `RuntimeError:
UefiBuild Not Found`. Stuart provides a helper class that scaffolds out the
build step. There's a few ways to implement the UefiBuilder. It can be a
separate class in your `PlatformBuild.py`, it can be the same class as your
SettingsManager, or it can be a separate file all together. For the sake of
simplicity, we're going to have it as a separate class in the same file.
If you were to try a platform build running `stuart_build -c RpiPlatformBuild.py`,
it would fail saying `RuntimeError: UefiBuild Not Found`. Stuart provides a helper
class that scaffolds out the build step. There's a few ways to implement the
UefiBuilder. It can be a separate class in your `PlatformBuild.py`, it can be
the same class as your SettingsManager, or it can be a separate file all together.
For the sake of simplicity, we're going to have it as a separate class in the same file.

```python
...

class SettingsManager(UpdateSettingsManager, SetupSettingsManager, BuildSettingsManager):
#
#==========================================================================
# PLATFORM BUILD ENVIRONMENT CONFIGURATION
#
class RpiSettingsManager(UpdateSettingsManager, SetupSettingsManager, BuildSettingsManager):
def __init__(self):
....

#--------------------------------------------------------------------------------------------------------
...
...
...
#
#==========================================================================
# Subclass the UEFI builder and add platform specific functionality.
#
class PlatformBuilder(UefiBuilder):
Expand All @@ -409,12 +419,15 @@ provide the paths to the EDK2 system. We need to provide absolute paths, so we
join each path to our workspace root.

```python
class SettingsManager(UpdateSettingsManager, SetupSettingsManager, BuildSettingsManager):
#
#==========================================================================
# PLATFORM BUILD ENVIRONMENT CONFIGURATION
#
class RpiSettingsManager(UpdateSettingsManager, SetupSettingsManager, BuildSettingsManager):
def __init__(self):
....
def GetTargetsSupported(self):
....

...
...
...
def GetPackagesPath(self):
''' get module packages path '''
pp = ['edk2', "non-osi", 'platforms']
Expand All @@ -426,7 +439,7 @@ Now when we run it, we'll see that we get an error from our UefiBuild itself.
(Replace your toolchain tag with whatever toolchain you are using.)

```log
~/rpi$ stuart_build -c Platform/RaspberryPi/RPi3/PlatformBuild.py TOOL_CHAIN_TAG=******
~/rpi$ stuart_build -c RpiPlatformBuild.py TOOL_CHAIN_TAG=******
SECTION - Init SDE
SECTION - Loading Plugins
SECTION - Start Invocable Tool
Expand Down