-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
west.yml: lazy module loading #54276
Comments
Some PRs with associated conversations about this topic |
I think one question is what kinda of means do we convey how a given module is needed. For example, is that via some Kconfig symbols? |
Also, just throwing this out there, but we could consider this as a problem for a GSoC contributor 🤷 |
Thanks @cfriedt for opening up the issue. I think it's probably more important to us than a GSoC proposal, which after all 1) will not necessarily be picked and 2) can fail (not that we can't have a GSoC about it, but then probably we should wait until the GSoC completes with undertaking other attempts; I assume the ideal GSoC project should not be on a critical path, just to avoid unnecessary pressure on the student). I am for an apt-like behaviour w/r to asking the user - i.e. by default it will stop on recomending packages to download and wait for approval, you have to explicitly override that behavior but then everyone assumes you know what you are doing. A --download-all flag would probably make sense too. For determining modules, Kconfig makes sense to me too. |
Yea, I just won't have time to do this myself. So cannot be the assignee unfortunately. A GSoC contributor would be great in terms of someone to offload work to. Even if a GSoC fails, the work could still be used, etc. But yea, it might not necessarily be picked. Getting this right will not be an overnight problem though, by any means. Given that we have 55 modules right now, I would expect that part of the task would be to itemize the packages that each module depends on (pip, .deb, etc). That alone could take a considerable amount of time. |
I welcome someone developing a package manager based on west, but I have disclaimed this assignment already elsewhere. @cfriedt feel free to reopen and assign yourself or someone else if you're aware of a volunteer. |
@mbolivar-nordic - I don't know why this was assigned to you. It was originally an RFC |
Great article |
Lol - I definitely do not want to write a package manager. YAML FTW! Maybe an additional point, for that matter, should be a flag to completely silence package recommendations, because, as the article states, there are many different scenarios, and the YAML would just be a list of recommendations. E.g. if someone wants to build Zephyr on a Linux From Scratch system, and they have built all of the required packages, then they should be able to silence warnings. I think we just want to list recommended packages for the somewhat fixed OS versions that Zephyr supports. |
It wouldn't be easy in the general case. The |
There's an Unfortunately not for the faint of heart... :-(
BTW There is of course another Github label for this sort of optimizations too: |
Move optional modules to a submanifest and make them optional by default. This is just a POC, might require some more thought. The idea is to look at the optional manifest as an area for modules that work with Zephyr, but not needed directly by zephyr. This could be documented somewhere for discovery purposes allowing users to enable such modules in their downstream if desired. See zephyrproject-rtos#54276 Signed-off-by: Anas Nashif <[email protected]>
Move optional modules to a submanifest and make them optional by default. This is just a POC, might require some more thought. The idea is to look at the optional manifest as an area for modules that work with Zephyr, but not needed directly by zephyr. This could be documented somewhere for discovery purposes allowing users to enable such modules in their downstream if desired. See #54276 Signed-off-by: Anas Nashif <[email protected]>
Move optional modules to a submanifest and make them optional by default. This is just a POC, might require some more thought. The idea is to look at the optional manifest as an area for modules that work with Zephyr, but not needed directly by zephyr. This could be documented somewhere for discovery purposes allowing users to enable such modules in their downstream if desired. See zephyrproject-rtos#54276 (cherry picked from commit f30f08a) Original-Signed-off-by: Anas Nashif <[email protected]> GitOrigin-RevId: f30f08a Change-Id: I3bc86795625ca7be3e13acc918772bc3b6682593 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4907227 Tested-by: ChromeOS Prod (Robot) <[email protected]> Reviewed-by: Fabio Baltieri <[email protected]> Commit-Queue: Fabio Baltieri <[email protected]> Tested-by: Fabio Baltieri <[email protected]>
Hi, I just made a start with migrating our project to zephyr 3.5, and found that zscilib was not available. I see that this change has been integrated into v3.5 and I assume I need to add zscilib as an optional include into our west manifest/cmakelists. Any guide as to how I go about this? |
You can enable the module again by running @kartben should we update the 3.5 migration guide and backport it? |
Ya I was thinking just this when reading this earlier. Frankly I am not sure how we missed it but this is very much a "required change" thing. +1 for adding it to the migration guide and making sure this also gets backported. Luckily my guess is that many people will access the migration guide from "/latest" so the only place it will still be missing is the actual 3.5.0. |
Instead of having the full version in the URL of version-specific documentation, would it perhaps make sense to drop the last version component and just use And then the version-specific documentation for a release would always be generated based on stable branch of that release (e.g. v3.5-branch in the case of Zephyr 3.5). That way we could backport important documentation fixes, and have them published on docs.zephyrproject.org. Thoughts? |
Thanks for the quick answer. Luckily my guess is that many people will access the migration guide from "/latest" so the only place it will still be missing is the actual 3.5.0. just checked as a layman and I hit the latest release notes and end up on the latest migration guide. Also hit latest when I go look at the v3.4.0 guide. So in my experience this is true |
Opened #64619 |
Noob here, So all that needs to be done is not to download everything at installation, isn't it? |
This breaks module samples like those in |
But if I didn't select a target environments then there shouldn't be any example in the first place, otherwise it's a waste of space/bandwidth. |
#80782 seems to be progressing nicely, once it's merged, what else do we need to implement for HAL lazy-loading? |
#80782 is convenient but I don't think it will save much bandwidth and disk space and it's not about west projects either. BTW Zephyr modules usually map 1:1 to West projects but they don't have to.
I'm afraid the most blatant gap is still: how does the build system divine the user's intention and needs? Much more worrying: looking beyond Zephyr, I'm not sure this problem has ever been solved in the industry. AFAIK Sometimes the dependency is as simple as
For decades, developers used to perform a somewhat annoying, TWO steps "configure, make" dance with some sort of But to leverage project configuration, this new optimization would have to increase the number of build steps again. Only the first time so it shouldn't hurt convenience much but there would still be a significant impact on the user interface complexity and documentation. So I bet this would be a "CI-first" optimization. A complete Zephyr clone is big but workstation disks are bigger and the time figuring out how to leverage the optimization would probably dwarf the time downloading everything. For sure this has been my experience with optional projects #61505: because I clone rarely from scratch, I've spent more time finding the magic But wait... doesn't the CMake configuration step already have some dependencies? The autotools Apologies for being my usually skeptical self but this one looks like a really tough nut to crack in general. I bet some things can be done but "semi-automated" is probably the best that can be achieved. That could still be useful, especially for CI testing that keeps repeatedly cloning from scratch every time. For interactive use, I think manually defined, documented and configured |
Noob here. Regarding comment above, what if we simply use a package manager to download the selected libraries at given version into project dir on demand, Same way requirements.txt works in python, just into project folder. Compilers could go system wide, still from package manager. (maybe via apt get in background) Like my recipe is
|
Do you mean a brand new, Zephyr-specific, source package manager?
Toolchains aside, how different is that from writing your own, optimized
This issue is very "exploratory", yet it's 100% focused on |
When Cloning can happen in the background with It would be up to the user to version track their selfcontained project. (maybe not even with git, like with automotive MKS) I don't think it's different from STM32 providing HAL files at given version, I copy those into my project at given checkpoint, and I don't care about their version history. |
That's an optimization idea but it's a different one.
Do you mean: deleting git clones? This would save a bit of disk space - but not that much because Deleting |
There are solutions to manage C/C++ dependencies but unlike most other languages, these solutions are not part of the C/C++ standard. To be fair, most other languages don't stretch as far and wide as C/C++ either and rarely care about embedded environments supported by Zephyr. For instance, https://learn.microsoft.com/en-us/vcpkg/get_started/get-started-packaging supports "only" Windows, macOS and Linux. These solutions tend to come with their own build infrastructure that would clash with some or all of what west and the Zephyr build system already do. Interestingly, most solutions seem to start with a... manifest. How rust crates interact with the Zephyr build system is going to be interesting to watch. |
Introduction
This topic should really be of interest for anyone who uses
west
to pull in Zephyr components, which is likely a large majority at this time.Generally though, the topic should be of interest to end users, TSC members, maintainers, product designers, module authors, etc.
Problem description
Modules are the primary vehicle used to scale Zephyr.
At the beginning, it was fairly inconsequential that there were 5-10 modules pulling in maybe ~100 MB of additional repositories, HALs, libraries, etc. However, as Zephyr and the Zephyr Community have grown, it's become a more frequent concern that the default behaviour (
west update
) pulls in several GB of repository data. Moreover, for the a common goal like runninghello_world
on a particular board, the vast majority of modules, and the GB of git repository data downloaded, are largely unused.There was previously an attempt to push the problem onto users by grouping west repositories into categories (
core
,hal
, etc). However, that does not seem to have worked as well we had hoped.Proposed change
In an ideal world, everything would be optional. Our default should be to minimize the required packages to install and the required modules to download.
We propose something along the lines of "lazy module loading". I.e. automatically updating only the the git repositories necessary for a particular app using a particular configuration running on a particular board.
Automatically downloading dependencies during a build phase are generally not a great idea, so this should be an optional feature that is disabled by default.
Some potentially "nice" features to have would be
Additional notes
Detailed RFC
TODO
Proposed change (Detailed)
TODO
Dependencies
TODO
Concerns and Unresolved Questions
TODO
Alternatives
Deja-vu - we have had discussions and solutions about this several times.
The text was updated successfully, but these errors were encountered: