-
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
Build Version detection not working when Zephyr Kernel is a Git Submodule #43503
Comments
Is there any reason why you are not using the west module? (see https://github.com/zephyrproject-rtos/example-application/blob/dfc6b88d25e2d738fe20f86e5e8ac40e0831cda9/west.yml#L13) Adding the Zephyr repository as a Git submodule is not a normal workflow when it comes to Zephyr, and may even be said to be unsupported because there really is no reason to do so under normal circumstances. cc @tejlmand |
We are using git sub-modules to precisely define the versions of all included software in a larger system and use If this use-case were to be declared unsupported, that would be rather sad to hear. FWIW, in the past such issues were addressed (i.e. #7207). |
Maybe @mbolivar-nordic can provide some insight.
I assume you are referring to this: If you have a look at the "example-application", it effectively achieves what you described above without using Git submodules. If you do not like calling |
The documentation still has its ¹ https://docs.zephyrproject.org/latest/guides/west/without-west.html
Well, this is an open-source project of mine, that uses the same idea to build its firmware code, as do the larger systems that are developed at work. It's quite a limited example, because there is nothing else except the firmware here.
There are two things that I would like to do: a) Use git to specify all software versions, not a separate format that is only used by zephyr; and b) Build all combinations of applications/boards/toolchains/build-configurations as declared in a top-level As for the former, I understand that zephyr decided against direct use of git submodules for code organisation, and instead invest time into the development of |
I have a possible fix for this in ft@39d7c25. Also, this thread made me read up on some of the newer things that WDYT? |
At the time of writing, we have not officially declared the west utility to be a requirement for using Zephyr; but, we are almost headed there (at least, for the module/component management). Usages like this will likely become unsupported or unsustainable in the future and I would highly recommend that you use the west since installing it is as simple as running one or two commands and there is really nothing to lose by doing so. Nevertheless, there is nothing wrong with submitting a fix for issues like this in the meantime. |
No, we have committed to keep
No, the use-case that @ft is presenting is a very valid use case, and the fact that I didn't consider it when implementing #42527 is an oversight on my side. |
While that may be the case on paper, we keep adding new features and schemes that make it harder to use Zephyr without west. Unless you are into making your life harder for no good reason, I would strongly recommend using west. |
not sure which features you are referring to and what exactly you mean by Features like In such cases, there can be good reasons for not using |
Strongly agree. I think Zephyr lacks a proper guide on making Zephyr applications. We have a lot of details, but not a guide that says, "this is the recommended way to go for most use cases". Luckily, we now have example-application, which I think it helps a bit on this front. If every Zephyr user goes its own way, changes upstream will likely have an impact when upgrading Zephyr, leading to bad experience/Zephyr reputation. Another story is how Zephyr designs stuff internally, e.g., I agree it is good to decouple west/CMake. |
I agree that
Highlighted words by me. So we should not start to give the impression that the use of Zephyr is locked to |
Sure, unsupported might not have been the best choice of words, but it already is and will likely become unsustainable. |
In 9170977 build-time version header generation was added. The test for .git assumes this file to be a directory. In the case of git submodules, .git is a regular file that in its contents points to the actual git database for the submodule. This is a way to have symlink like behaviour even on file systems that do not support themselves support symlinks. This consults git as to what the correct git database directory is, in case the .git file is indeed a regular file, and adjusts the git_dependency variable accordingly. Fixes zephyrproject-rtos#43503 Signed-off-by: Frank Terbeck <[email protected]>
In 9170977 build-time version header generation was added. The test for .git assumes this file to be a directory. In the case of git submodules, .git is a regular file that in its contents points to the actual git database for the submodule. This is a way to have symlink like behaviour even on file systems that do not support themselves support symlinks. This consults git as to what the correct git database directory is, in case the .git file is indeed a regular file, and adjusts the git_dependency variable accordingly. Fixes #43503 Signed-off-by: Frank Terbeck <[email protected]>
I want to pile on here for the record while I'm going over older issues and PRs today. West is, was, and shall remain optional. However, not using west may be inconvenient. This was always the plan. |
Describe the bug
In 9170977 build-time version header generation was added. This uses
When the repository is a git sub-module¹, the
.git
type is not a directory, but a regular file, that may look like this:…which points to the module's actual git-database inside the super-project.
With that, the
else()
branch of theif
statement is triggered, triggering the warning that's attached to it.¹ https://git-scm.com/docs/git-submodule
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The warning is not triggered.
Pick up the
index
file from the super-project's git-database connected to the kernel's sub-module and file it intogit_dependency
(I assume that's doing the trick; I didn't check whatgen_version_h.cmake
does; but the way it is used right now suggests it).Impact
It looks like the
zephyr/include/generated/version.h
file still is generated correctly. At least initially, because theadd_custom_command()
call that generates the file is issued regardless of the tested conditions. The fact thatgit_dependency
is not set correctly, will likely make this inconsistent. If it wouldn't, the addedgit_dependency
in the current code would not serve any purpose.Logs and console output
Don't have it available right now; this happened on a work-machine. Filing the issue from home.
Environment
main
(08d98c2 at the time of writing) uses the same code.Additional context
There is not much additional context, as the issue should affect everybody who uses the zephyr kernel from a git sub-module instead of a standalone clone.
The text was updated successfully, but these errors were encountered: