Reviewed-by: Nate DeSimone <nathaniel.l.desim...@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Agyeman, Prince
Sent: Friday, May 3, 2019 4:19 PM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A <michael.a.kuba...@intel.com>; Desimone, Nathaniel L 
<nathaniel.l.desim...@intel.com>; Sinha, Ankit <ankit.si...@intel.com>; Kinney, 
Michael D <michael.d.kin...@intel.com>; Oram, Isaac W <isaac.w.o...@intel.com>; 
Gao, Liming <liming....@intel.com>
Subject: [edk2-devel] [edk2-platforms/devel-MinPlatform] [PATCH v3 0/2] Adding 
python build script.

Cc: Michael Kubacki <michael.a.kuba...@intel.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Cc: Ankit Sinha <ankit.si...@intel.com>
Cc: Michael D Kinney <michael.d.kin...@intel.com>
Cc: Isaac W Oram <isaac.w.o...@intel.com>
Cc: Liming Gao <liming....@intel.com>

Contributed-under: TianoCore Contribution Agreement 0.1
Signed-off-by: Agyeman <prince.agye...@intel.com>


changes from v2:
- fixed pep8 violations
- implemented v2 review recommendations
- added clean flag to clean specified platform

Overview:
WORKSPACE
    |
    |------edk2
    |------edk2-non-osi
    |------edk2-platforms
    |       |--Platform
    |       |---Intel
    |       |        |------build.cfg: Default build settings. These are 
overridden by
    |       |        |                 platform specific settings 
(build_config.cfg) and
    |       |        |                 then command-line settings.
    |       |        |
    |       |        |------build_bios.py: Main build script. Generic 
pre-build, build,
    |       |        |                     post-build, and clean functions.
    |       |        |
    |       |        |------ClevoOpenBoardPkg
    |       |        |        |------N1xxWU
    |       |        |                |---build_config.cfg: N1xxWU specific 
build
    |       |        |                                      settings 
environment variables.
    |       |        |
    |       |        |------KabylakeOpenBoardPkg
    |       |        |        |------KabylakeRvp3
    |       |        |                  |---build_config.cfg: KabylakeRvp3 
specific
    |       |        |                  |                     build settings, 
environment variables.
    |       |        |                  |---build_board.py: Optional 
board-specific pre-build, build
    |       |        |                                      and clean 
post-build functions.
    |       |        |------PurleyOpenBoardPkg
    |       |        |       |------BoardMtOlympus
    |       |        |                |---build_config.cfg: BoardMtOlympus 
specific
    |       |        |                                      build settings, 
environment variables.
    |       |        |                |---build_board.py: Optional 
board-specific pre-build,
    |       |        |                |                   build, post-build and 
clean functions.
    |------FSP


-------------------
Details:
-------------------
What it is
----------
These patches add python BIOS build scripts and build configuration files to 
build platforms under Intel/Platform.


Why
----
The reason behind this implementation is to use a cross platform build script 
to build minplaform BIOS.


How it is done
----------------
The python files:
-----------------
build_bios.py: The main build file. This script sets up the edk2 build 
enviroment using the default build.cfg settings and platform specific settings. 
It uses the configurations found in the build.cfg file to locate the platforms 
that are configured to use this build script.
The path to each of the platform settings can be found under the "PLATFORMS"
field within the build.cfg file. The platform specific settings are located in 
the platform's main directory.
Example edk2-platforms/Platform/Intel/ClevoOpenBoardPkg/N1xxWU/build_config.cfg.

The build_bios.py script contains the four main functions:
- pre_build: Sets up the edk2 build enviroment variables, target.txt file
- build: Uses the configurations to Build BIOS
- post_build: Does post build processes like cleaning up files
             generated during the build process
- clean: Cleans up the build directory.

There are four addtional functions that dynamically import functions from the 
board's Optional/Additional python script if specified in board settings file's 
ADDITIONAL_SCRIPTS These four functions are the pre_build_board, build_board, 
post_build_board, clean_ex functions


Board additional (Optional) python build script:
------------------------------------------------
These are python scripts located in the board's main directory, An example 
Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_board.py
If added, its path must be specified in board's settings file, under the field 
ADDITIONAL_SCRIPTS.
Example ADDITIONAL_SCRIPTS = PurleyOpenBoardPkg/BoardMtOlympus/build_board.py
If specified, the build_board, pre_build_board, post_build_board, clean_ex must 
be defined even if they are not use


The config files
-----------------
build.cfg:
-----------
This is file contains the default BIOS build configuration.

The default configurations are defined under the "DEFAULT_CONFIG" section of 
the file.
Each of these can be overridden by the board specific setting as defined in the 
board's build config file. All paths must be separated by forward slashes.
All the paths in the main build.cfg are relative to the minplaform WORKSPACE.
Example:
--------
[DEFAULT_CONFIG]
    MIN_PACKAGE_TOOLS = edk2-platforms/Platform/Intel/MinPlatformPkg/Tools

The PLATFORMS field in the build.cfg file informs build_bios.py about the 
available platforms that can be built with the build_bios.py.
The path to the board specific config file must be relative to location of 
build_bios.py, Platform/Intel. It is in the format Boardname = BoardPath

Example:
--------
[PLATFORMS]
    KabylakeRvp3 = KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg


Board Specific Build Settings file:
----------------------------------------
This file is located in the board's main directory.
The CONFIG field contains all the build enviroment variables.
These values will override any the were specific under DEFAULT_CONFIG in the 
default build.cfg file.
Example is Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg


Building BIOS
-------------

python build_bios.py -p BOARDNAME -t TOOLCHAIN 

usage: build_bios.py [-h] --platform {N1xxWU,KabylakeRvp3,BoardMtOlympus}
                    [--toolchain TOOLCHAIN] [--DEBUG] [--RELEASE]
                    [--TEST_RELEASE] [--RELEASE_PDB] [--list] [--cleanall]
                    [--capsule] [--silent] [--performance] [--fsp] Build Help

optional arguments:
  -h, --help            show this help message and exit
  --platform {N1xxWU,KabylakeRvp3,BoardMtOlympus}, -p 
{N1xxWU,KabylakeRvp3,BoardMtOlympus}
                        the platform to build
  --toolchain TOOLCHAIN, -t TOOLCHAIN
                        using the Tool Chain Tagname to build the
                        platform, overriding target.txt's TOOL_CHAIN_TAG
                        definition
  --DEBUG, -d           debug flag
  --RELEASE, -r         release flag
  --TEST_RELEASE, -tr   test release flag
  --RELEASE_PDB, -rp    release flag
  --list, -l            lists available platforms
  --cleanall            cleans all
  --clean               cleans specific platform 
  --capsule             capsule build enabled
  --silent              silent build enabled
  --performance         performance build enabled
  --fsp                 fsp build enabled

Agyeman (2):
  Platform/Intel: Added python build script.
  Updated the build instructions to include the python script build
    instructions

 .../ClevoOpenBoardPkg/N1xxWU/build_config.cfg |  33 +
 .../KabylakeRvp3/build_board.py               |  68 ++
 .../KabylakeRvp3/build_config.cfg             |  34 +
 .../BoardMtOlympus/build_board.py             | 177 ++++
 .../BoardMtOlympus/build_config.cfg           |  32 +
 Platform/Intel/build.cfg                      |  56 +
 Platform/Intel/build_bios.py                  | 976 ++++++++++++++++++
 ReadMe.md                                     |  76 ++
 8 files changed, 1452 insertions(+)
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/build_config.cfg
 create mode 100644 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_board.py
 create mode 100644 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/build_config.cfg
 create mode 100644 
Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/build_board.py
 create mode 100644 
Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/build_config.cfg
 create mode 100644 Platform/Intel/build.cfg  create mode 100644 
Platform/Intel/build_bios.py

--
2.19.1.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39971): https://edk2.groups.io/g/devel/message/39971
Mute This Topic: https://groups.io/mt/31489353/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to