Open stephanosio opened 3 years ago
cc @galak @nashif @tejlmand @carlescufi @ioannisg
I'm in favor of this proposal, especially the flexibility of releasing new versions of the host tools and toolchain independently.
One additional thought for helping brand new users get up and running, what are people's thoughts on bundling a Linux virtual machine that already has the all the necessary host tools, toolchains, and even the Zephyr source already installed? The distributed source could be tied to the latest LTS release.
what are people's thoughts on bundling a Linux virtual machine that already has the all the necessary host tools, toolchains, and even the Zephyr source already installed?
We've been using that docker image for quite some time now, mostly Just Works: https://github.com/thesofproject/sof/commit/40c9bb2e304d0 https://github.com/thesofproject/sof/blob/40c9bb2e30/zephyr/docker-build.sh
what are people's thoughts on bundling a Linux virtual machine that already has the all the necessary host tools, toolchains, and even the Zephyr source already installed?
We are already doing something similar with the Docker image, but the main problem with Docker is that it is painfully slow. There is an ongoing discussion about this.
There is an ongoing discussion about this.
I haven't seen much about docker performance at that link.
Isn't the whole point of containers to be leaner and faster than virtual machines? Can you elaborate?
I haven't much about docker performance at that link.
I meant there is an ongoing discussion about container-based (including Docker) approach there (sorry for the confusion, I could have phrased it better).
Isn't the whole point of containers to be leaner and faster than virtual machines? Can you elaborate?
In theory, yes; but, I (and many others who I work with) have seen Docker-based build process taking almost 2x as long as native or VM-based build. I assume the performance issues are mostly I/O-bound.
Outside Docker:
$ scripts/twister -v -N -p mps2_an521 -T tests/lib/cmsis_dsp
ZEPHYR_BASE unset, using "/home/stephanos/Dev/zephyrproject/zephyr"
Renaming output directory to /home/stephanos/Dev/zephyrproject/zephyr/twister-out.17
INFO - Zephyr version: zephyr-v2.6.0-1471-gedb78537f9cf
INFO - JOBS: 60
INFO - Using 'zephyr' toolchain.
INFO - Building initial testcase list...
INFO - 29 test scenarios (29 configurations) selected, 9 configurations discarded due to filters.
INFO - Adding tasks to the queue...
INFO - Added initial list of jobs to queue
INFO - 1/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.unary_f32 PASSED (qemu 2.332s)
INFO - 2/20 mps2_an521 tests/lib/cmsis_dsp/complexmath/libraries.cmsis_dsp.complexmath PASSED (qemu 2.328s)
INFO - 3/20 mps2_an521 tests/lib/cmsis_dsp/statistics/libraries.cmsis_dsp.statistics PASSED (qemu 2.413s)
INFO - 4/20 mps2_an521 tests/lib/cmsis_dsp/transform/libraries.cmsis_dsp.transform.rq15 PASSED (qemu 2.222s)
INFO - 5/20 mps2_an521 tests/lib/cmsis_dsp/svm/libraries.cmsis_dsp.svm PASSED (qemu 2.285s)
INFO - 6/20 mps2_an521 tests/lib/cmsis_dsp/bayes/libraries.cmsis_dsp.bayes PASSED (qemu 2.139s)
INFO - 7/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.unary_q31 PASSED (qemu 2.193s)
INFO - 8/20 mps2_an521 tests/lib/cmsis_dsp/distance/libraries.cmsis_dsp.distance PASSED (qemu 2.181s)
INFO - 9/20 mps2_an521 tests/lib/cmsis_dsp/filtering/libraries.cmsis_dsp.filtering.fir PASSED (qemu 2.185s)
INFO - 10/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.binary_q31 PASSED (qemu 2.188s)
INFO - 11/20 mps2_an521 tests/lib/cmsis_dsp/fastmath/libraries.cmsis_dsp.fastmath PASSED (qemu 2.217s)
INFO - 12/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.unary_f64 PASSED (qemu 2.218s)
INFO - 13/20 mps2_an521 tests/lib/cmsis_dsp/filtering/libraries.cmsis_dsp.filtering.biquad PASSED (qemu 2.214s)
INFO - 14/20 mps2_an521 tests/lib/cmsis_dsp/basicmath/libraries.cmsis_dsp.basicmath PASSED (qemu 2.514s)
INFO - 15/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.unary_q15 PASSED (qemu 2.345s)
INFO - 16/20 mps2_an521 tests/lib/cmsis_dsp/support/libraries.cmsis_dsp.support PASSED (qemu 2.387s)
INFO - 17/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.binary_f32 PASSED (qemu 2.356s)
INFO - 18/20 mps2_an521 tests/lib/cmsis_dsp/transform/libraries.cmsis_dsp.transform.cq15 PASSED (qemu 2.372s)
INFO - 19/20 mps2_an521 tests/lib/cmsis_dsp/transform/libraries.cmsis_dsp.transform.rf32 PASSED (qemu 2.466s)
INFO - 20/20 mps2_an521 tests/lib/cmsis_dsp/filtering/libraries.cmsis_dsp.filtering.misc PASSED (qemu 2.739s)
INFO - 20 of 20 test configurations passed (100.00%), 0 failed, 9 skipped with 0 warnings in 13.38 seconds
INFO - In total 2165 test cases were executed, 1886 skipped on 1 out of total 381 platforms (0.26%)
INFO - 20 test configurations executed on platforms, 0 test configurations were only built.
INFO - Saving reports...
INFO - Writing xunit report /home/stephanos/Dev/zephyrproject/zephyr/twister-out/twister.xml...
INFO - Writing xunit report /home/stephanos/Dev/zephyrproject/zephyr/twister-out/twister_report.xml...
INFO - Run completed
Inside Docker:
$ scripts/twister -v -N -p mps2_an521 -T tests/lib/cmsis_dsp
Renaming output directory to /workdir/zephyr/twister-out.15
INFO - Zephyr version: zephyr-v2.6.0-1471-gedb78537f9cf
INFO - JOBS: 60
INFO - Using 'zephyr' toolchain.
INFO - Building initial testcase list...
INFO - 29 test scenarios (29 configurations) selected, 9 configurations discarded due to filters.
INFO - Adding tasks to the queue...
INFO - Added initial list of jobs to queue
INFO - 1/20 mps2_an521 tests/lib/cmsis_dsp/transform/libraries.cmsis_dsp.transform.rq15 PASSED (qemu 2.362s)
INFO - 2/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.unary_q15 PASSED (qemu 2.262s)
INFO - 3/20 mps2_an521 tests/lib/cmsis_dsp/statistics/libraries.cmsis_dsp.statistics PASSED (qemu 2.692s)
INFO - 4/20 mps2_an521 tests/lib/cmsis_dsp/complexmath/libraries.cmsis_dsp.complexmath PASSED (qemu 2.399s)
INFO - 5/20 mps2_an521 tests/lib/cmsis_dsp/transform/libraries.cmsis_dsp.transform.rf32 PASSED (qemu 2.824s)
INFO - 6/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.unary_q31 PASSED (qemu 2.302s)
INFO - 7/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.binary_f32 PASSED (qemu 2.297s)
INFO - 8/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.binary_q31 PASSED (qemu 2.369s)
INFO - 9/20 mps2_an521 tests/lib/cmsis_dsp/filtering/libraries.cmsis_dsp.filtering.biquad PASSED (qemu 2.261s)
INFO - 10/20 mps2_an521 tests/lib/cmsis_dsp/distance/libraries.cmsis_dsp.distance PASSED (qemu 2.247s)
INFO - 11/20 mps2_an521 tests/lib/cmsis_dsp/basicmath/libraries.cmsis_dsp.basicmath PASSED (qemu 2.661s)
INFO - 12/20 mps2_an521 tests/lib/cmsis_dsp/svm/libraries.cmsis_dsp.svm PASSED (qemu 2.181s)
INFO - 13/20 mps2_an521 tests/lib/cmsis_dsp/filtering/libraries.cmsis_dsp.filtering.misc PASSED (qemu 2.616s)
INFO - 14/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.unary_f32 PASSED (qemu 2.162s)
INFO - 15/20 mps2_an521 tests/lib/cmsis_dsp/bayes/libraries.cmsis_dsp.bayes PASSED (qemu 2.186s)
INFO - 16/20 mps2_an521 tests/lib/cmsis_dsp/fastmath/libraries.cmsis_dsp.fastmath PASSED (qemu 2.260s)
INFO - 17/20 mps2_an521 tests/lib/cmsis_dsp/matrix/libraries.cmsis_dsp.matrix.unary_f64 PASSED (qemu 2.343s)
INFO - 18/20 mps2_an521 tests/lib/cmsis_dsp/filtering/libraries.cmsis_dsp.filtering.fir PASSED (qemu 2.142s)
INFO - 19/20 mps2_an521 tests/lib/cmsis_dsp/transform/libraries.cmsis_dsp.transform.cq15 PASSED (qemu 2.402s)
INFO - 20/20 mps2_an521 tests/lib/cmsis_dsp/support/libraries.cmsis_dsp.support PASSED (qemu 2.356s)
INFO - 20 of 20 test configurations passed (100.00%), 0 failed, 9 skipped with 0 warnings in 20.56 seconds
INFO - In total 2165 test cases were executed, 1886 skipped on 1 out of total 381 platforms (0.26%)
INFO - 20 test configurations executed on platforms, 0 test configurations were only built.
INFO - Saving reports...
INFO - Writing xunit report /workdir/zephyr/twister-out/twister.xml...
INFO - Writing xunit report /workdir/zephyr/twister-out/twister_report.xml...
INFO - Run completed
what are people's thoughts on bundling a Linux virtual machine that already has the all the necessary host tools, toolchains, and even the Zephyr source already installed?
As mentioned before, we already have a Docker image for that. While this is a good solution for some, it certainly is not for many. Most developers prefer to have the tools they need installed directly on their operating system, and Docker is not a good option on macOS or Windows anyway. So I propose we continue to offer the Docker image all the same, but we should not rely on it as the main mechanism to start developing on Zephyr.
I think we should have some rpm package format and possibly dropping snap's on linux.
I think we should have some rpm package format
rpm support does sound reasonable, especially noting that there are many developers on Fedora.
and possibly dropping snap's on linux.
I am not sure about that. There are many different types and versions of Linux distributions with different dependencies. We might be able to (sort of) get away with the toolchains by statically linking everything, but that is not really feasible for the host tools, and we will need something like Yocto to address this -- and that's where Snap, which provides a known base system, comes into play.
I think native deb (for the latest Ubuntu LTS) and rpm (for the latest RHEL release, which should also be compatible with the relevant version of Fedora) packages + Snap (for the rest) would be a reasonable target.
I am not sure about that. There are many different types and versions of Linux distributions with different dependencies. We might be able to (sort of) get away with the toolchains by statically linking everything, but that is not really feasible for the host tools, and we will need something like Yocto to address this -- and that's where Snap, which provides a known base system, comes into play.
I think native deb (for the latest Ubuntu LTS) and rpm (for the latest RHEL release, which should also be compatible with the relevant version of Fedora) packages + Snap (for the rest) would be a reasonable target.
So I think rpm
, deb
, and existing tarball
. I don't know know how to judge the usage/acceptance of a Snap. I'm not aware of much if any queries for Snap support and it feels like an ubuntu centric solution that the .deb/ubuntu packages would cover.
My 2 cents would be either we try and poll people to see if they'd use a Snap and/or mark the support as experimental to start with. Not sure if we'd have some way to track downloads or access with hosting a snap.
So I think
rpm
,deb
, and existingtarball
.
By "existing tarball," do you mean tarball with Yocto sysroot?
If so, in the context of per-component distribution (tarball), we will need to distribute Yocto sysroot per component (e.g. QEMU tarball containing its own sysroot, OpenOCD tarball containing its own sysroot, ...), which can be quite wasteful due to the duplicates.
I don't know know how to judge the usage/acceptance of a Snap. I'm not aware of much if any queries for Snap support and it feels like an ubuntu centric solution
Snap is indeed developed and maintained by Canonical Ltd, which is the company responsible for Ubuntu. Regardless of the ownership and politics, objectively speaking, Snap seemed to be our best option for cross-distro support while keeping things sane (i.e. without Yocto sysroot per component).
For those who are not familiar with Snap, it provides Ubuntu Core base environment on which packaged programs can run -- meaning, as long as you build your program targeting Ubuntu Core (which is just a stripped down version of Ubuntu), it will work on all distros supported by Snap, and that includes Arch, Debian, Fedora, Kali, openSUSE, RHEL, Solus, elementary OS, GalliumOS, Linux Mint, Raspberry Pi OS and Ubuntu.
My 2 cents would be either we try and poll people to see if they'd use a Snap and/or mark the support as experimental to start with.
I think marking it experimental would be a good starting point as you suggest. I am sure the users who are on the distros that are not supported by our deb and rpm packages will appreciate the value of having Snap packages. For the majority of users who can just install the deb and rpm packages though, Snap support would be meaningless.
Not sure if we'd have some way to track downloads or access with hosting a snap.
Snapcraft, which is the platform used for building and distributing Snap packages, provides statistics.
Re: Renaming "Zephyr SDK" because the term "SDK" refers to "BSP" (as discussed in the last TSC meeting)
My suggestion is to rename "Zephyr SDK" to "Zephyr Tools," because it is quite literally a collection of tools for Zephyr development.
Re: Renaming "Zephyr SDK" because the term "SDK" refers to "BSP" (as discussed in the last TSC meeting)
My suggestion is to rename "Zephyr SDK" to "Zephyr Tools," because it is quite literally a collection of tools for Zephyr development.
Would we merge the nettools into this? Maybe 'buildtools'
Toolchain WG proposals, see individual proposals.
Proposal 1:
Comments from the Toolchain WG meeting today (2021-08-10)
Please let me know if I missed any.
@stephanosio it seems brew
is available for Linux.
As brew is the defacto package manager on macOS and we're going to use it there, then I think it would makes sense to look into making brew packages for Linux as well.
That should minimize the needed work as I assume the infrastructure for building a brew package in Linux is straightforward when we have the infrastructure in place for macOS.
And brew doesn't suffer the snap limitations. https://docs.brew.sh/Homebrew-on-Linux
Note: I have zero experience with brew on Linux, so if you have already tried and found that it's not worth the effort, please comment.
I think it would makes sense to look into making brew packages for Linux as well.
There are quite a few problems with Homebrew on Linux (aka. Linuxbrew):
IMO, no. 3 is really a showstopper.
As per the last week's discussion, we can drop Snap and provide Yocto-based "universal" tarballs for the people who are not on the mainstream distros like Ubuntu and Fedora.
I think it would makes sense to look into making brew packages for Linux as well.
There are quite a few problems with Homebrew on Linux (aka. Linuxbrew):
Thanks, completely agree, brew is not an alternative on Linux.
Regarding windows support - that is absolutely not necessary because windows has very nice Ubuntu support through WSL2 and zephyr builds on that without any issues.
Regarding windows support - that is absolutely not necessary because windows has very nice Ubuntu support through WSL2 and zephyr builds on that without any issues.
Until you want to flash/debug your targets and do many other USB stuff, and also you want to integrate directly to a native Windows IDE.
@mkschreder : Although WSL2 works nicely, it adds a whole new layer of complexity which we want to shield users from.
While you can use WSL2 to flash/debug (I wrote about it here) and I do, many companies still require use of Windows and Windows tools. Even still, when we do trainings, more than 2/3rds of participants are on Windows for their personal machines. Having Windows support is rather important, for better or for worse :)
After having spent some time trying to package, build, sell, .. the Zephyr SDK in an appealing way, I actually feel that something like this proposal is probably the best possible solution to the distribution problem.
Almost all package managers have this concept of adding an external mirror or package source.
Zephyr should simply host a repository for various package managers. The CI SDK build already does the whole matrix.
Why not e.g. throw .rpms or .debs into the mix as well? I would suggest for macOS and Windows to just distribute binary packages for use in the repositories (distributed via chocolatey or homebrew).
The reason that I say this, is that it's far easier for big companies to look at a certain preferred package format and to approve certain external repositories than it is keep up with what's happening in a few dozen GitHub projects.
Zephyr should "simply" host a repository for various package managers. The CI SDK build already does the whole matrix.
(quotes mine)
Perfect solution except for the small implementation detail of the "packaging hero" capable of juggling many different VMs to deploy, test and release simultaneously across all the wildly different operating systems and packaging formats. Not forgetting some server administration skills and the knowledge of how various online repos are structured. https://en.wikipedia.org/wiki/Bus_factor
Most of this should of course be automated but it still seems like a very large amount of work. There is probably a reason why people packaging Linux software are most often different from the ones writing it (despite crazy amounts of automation) and why brand new Linux packaging solutions like snap, AppImage, Flatpack and what not are being aggressively explored.
Simple archive-based distribution (i.e. tarball) should still be available alongside the package-based distribution to support more traditional workflow.
Thank you. Low-tech = missing nice things but Just Working.
Most developers prefer to have the tools they need installed directly on their operating system
Having to manage not just one but two systems is significant overhead and sharing across both systems can be super painful: https://github.com/thesofproject/sof/blob/0a4b1d62d5/scripts/sudo-cwd.sh
On the other hand, this image is FANTASTIC for CI and as a reference for quickly finding configuration problems, thanks for it!
Hi @stephanosio,
This issue, marked as an RFC, was opened a while ago and did not get any traction. Please confirm the issue is correctly assigned and re-assign it otherwise.
Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.
Thanks!
I would avoid snap. Better to provide native packages (deb, apk etc) if packaging support is needed.
Introduction (non-technical overview)
The Zephyr SDK, also known as sdk-ng, has several limitations that affect its usability as well as overall developer experience.
Problem description
Proposed change
Detailed proposal (technical)
A proof-of-concept was implemented last year (2020) to assess the feasibility of supporting Linux, macOS and Windows through Snap/APT, Homebrew and Chocolatey, respectively.
Definitions
.tar.gz
and.zip
). Can be used as a source for building a distribution package.distribution archive
anddistribution package
.Problem description (technical)
Proposed change (technical)
find_package
command. For example:find_package(zephyr-crosstool-arm 10.0.1.3 EXACT ...)
.find_package(zephyr-qemu 5.1.0.15 EXACT ...)
.find_package
command shall allow manually specifying the CMake package search path in order to allow using the SDK component installations that are not registered in the CMake package registry.HINTS
option. For example,find_package(zephyr-crosstool-arm 10.0.1.3 EXACT ... HINTS $ENV{ZEPHYR_SDK_INSTALL_DIR})
.gccmajor.gccminor.zcommon.ztarget
format where:gccmajor
andgccminor
are the base gcc major and minor version numbers.zcommon
is a version number that is incremented when a Zephyr-specific change that is common to all targets is made.ztarget
is a version number that is incremented when a Zephyr-specific change that is limited to a specific target is made.10.1.x.x
, starting at10.1.0.0
.10.1.0.1
(note that the toolchains for the rest of the targets need not be newly released, and they remain at10.1.0.0
).10.1.1.0
(this ensures that all target toolchains with the version number10.1.1.x
have the same base feature and makes it easier to track feature updates).sdk-ng
repository tozephyr-crosstool
and move host tool components out to the relevant fork repositoriesmeta-zephyr-sdk
directory).zephyr-v5.1.0
based on thev5.1.0
tag with the Zephyr-specific patches applied on top).zephyrproject-rtos/zephyr-crosstool
repository (oldsdk-ng
repository).mingw-w64
).zephyr-crosstool
repository shall be "distribution archive" (.tar.gz
for Linux and.zip
for Windows), which is used as source for building the distribution packages, or used as-is by the users that prefer to not use package management system-based distribution.zephyrproject-rtos/qemu
repository.qemu
repository shall be "distribution archive."zephyrproject-rtos/openocd
repository.qemu
repository shall be "distribution archive."zephyrproject-rtos/bossa
repository.qemu
repository shall be "distribution archive."stephanosio/snap-zephyr
for preliminary implementation.zephyrproject-rtos/packages-snap
package source repository.zephyr-crosstool
and host tool package definitions.stephanosio/deb-zephyr
for preliminary implementation.zephyrproject-rtos/packages-deb
package source repository.zephyr-crosstool
and host tool package definitions.stephanosio/homebrew-zephyr
for preliminary implementation.zephyrproject-rtos/packages-homebrew
package source repository.zephyr-crosstool
and host tool package definitions.stephanosio/chocolatey-zephyr
for preliminary implementation.zephyrproject-rtos/packages-chocolatey
package source repository.zephyr-crosstool
and host tool package definitions.main
branch) should not be getting these "bleeding-edge" update releases. To address that, multiple package release channels (e.g. stable, candidate, beta, edge) should be available to which developers can subscribe as they need.main
branch.zephyr-crosstool
was 10.1.1.0 andzephyr-qemu
was 5.1.1.0, the "Zephry SDK bundle for Zephyr v2.7" will contain the aforementioned versions of the SDK components.HINTS
to the CMakefind_package
command (basically same idea asZEPHYR_SDK_INSTALL_DIR
now).Concerns and FAQ
find_package
command.find_package
commandHINTS
option.Alternatives