Replace basic sys.argv argument parsing with argparse module to provide:
- Change the Zephyr version argument from a positional argument to an
explicit -v/--version option, making the intent clearer at the command
line.
- Proper -h/--help option with usage information.
- Better error messages for invalid version format.
- Usage examples in help text.
- Improved user experience.
- Update README.md with usage.
The script now displays helpful information when called with --help:
$ generate-version.py --help
usage: generate-version.py [-h] -v VERSION
Generate Zephyr kernel source include file for a specific version
options:
-h, --help show this help message and exit
-v VERSION, --version VERSION
Zephyr version in the form x.y.z (e.g., 3.7.0, 4.3.0)
Example:
generate-version.py -v 3.7.0
generate-version.py --version 4.3.0
AI-Generated: GitHub Copilot (Claude Sonnet 4.6)
Signed-off-by: Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com>
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Update script to generate correct SRCREV and other info to match
poky variable updates.
Also use "version" instead of "short_version" for SRC_URI_PATCHES.
Signed-off-by: Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com>
To simplify the logic to resolve Git tags to SHAs, and so that it works
with non-Github repositories, use git ls-remote instead of the Github
API.
Make the resolve_revision function available as a Jinja filter and move
the version resolution to the template.
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
The "yocto" toolchain requires a downstream patch to be carried and
maintained. The upstream "cross-compile" toolchain is equivalent so this
is no longer needed.
Remove the toolchain-specific inc file and the downstream patch.
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
Certain SRC_URI_* variables may collide with other recipes, e.g.
SRC_URI_TRUSTED_FIRMWARE_A. Namespace these variables under
SRC_URI_ZEPHYR so that the SRC_URIs of Zephyr modules can be
independently tweaked from local.conf or the environment.
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
Add a Python script which can be used to automatically generate
configuration for new Zephyr versions. This script:
* Takes the Zephyr version as a single argument
* Uses the Github API to find the version tag's SHA1
* Uses West as a library to parse the version's manifest file
* Uses a Jinja template to generate a .inc file for the version
* Outputs the .inc file directly into the zephyr-kernel directory
The generated .inc file includes:
* SRCREVs for all modules
* Separate SRC_URI_x variables for each module, to make it easier to
swap out a specific URL for a fork or mirror
* A version-specific SRC_URI, containing only the modules defined in
the release
* A list of the ZEPHYR_MODULES
Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
Tested-by: Jon Mason <jon.mason@arm.com>
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>