#
c45cec53 |
| 18-Nov-2024 |
Rasmus Villemoes <linux@rasmusvillemoes.dk> |
setlocalversion: work around "git describe" performance
[ Upstream commit 523f3dbc187a9618d4fd80c2b438e4d490705dcd ]
Contrary to expectations, passing a single candidate tag to "git describe" is sl
setlocalversion: work around "git describe" performance
[ Upstream commit 523f3dbc187a9618d4fd80c2b438e4d490705dcd ]
Contrary to expectations, passing a single candidate tag to "git describe" is slower than not passing any --match options.
$ time git describe --debug ... traversed 10619 commits ... v6.12-rc5-63-g0fc810ae3ae1
real 0m0.169s
$ time git describe --match=v6.12-rc5 --debug ... traversed 1310024 commits v6.12-rc5-63-g0fc810ae3ae1
real 0m1.281s
In fact, the --debug output shows that git traverses all or most of history. For some repositories and/or git versions, those 1.3s are actually 10-15 seconds.
This has been acknowledged as a performance bug in git [1], and a fix is on its way [2]. However, no solution is yet in git.git, and even when one lands, it will take quite a while before it finds its way to a release and for $random_kernel_developer to pick that up.
So rewrite the logic to use plumbing commands. For each of the candidate values of $tag, we ask: (1) is $tag even an annotated tag? (2) Is it eligible to describe HEAD, i.e. an ancestor of HEAD? (3) If so, how many commits are in $tag..HEAD?
I have tested that this produces the same output as the current script for ~700 random commits between v6.9..v6.10. For those 700 commits, and in my git repo, the 'make -s kernelrelease' command is on average ~4 times faster with this patch applied (geometric mean of ratios).
For the commit mentioned in Josh's original report [3], the time-consuming part of setlocalversion goes from
$ time git describe --match=v6.12-rc5 c1e939a21eb1 v6.12-rc5-44-gc1e939a21eb1
real 0m1.210s
to
$ time git rev-list --count --left-right v6.12-rc5..c1e939a21eb1 0 44
real 0m0.037s
[1] https://lore.kernel.org/git/20241101113910.GA2301440@coredump.intra.peff.net/ [2] https://lore.kernel.org/git/20241106192236.GC880133@coredump.intra.peff.net/ [3] https://lore.kernel.org/lkml/309549cafdcfe50c4fceac3263220cc3d8b109b2.1730337435.git.jpoimboe@kernel.org/
Reported-by: Sean Christopherson <seanjc@google.com> Closes: https://lore.kernel.org/lkml/ZPtlxmdIJXOe0sEy@google.com/ Reported-by: Josh Poimboeuf <jpoimboe@kernel.org> Closes: https://lore.kernel.org/lkml/309549cafdcfe50c4fceac3263220cc3d8b109b2.1730337435.git.jpoimboe@kernel.org/ Tested-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
#
01e89a4a |
| 04-Aug-2023 |
Rasmus Villemoes <linux@rasmusvillemoes.dk> |
scripts/setlocalversion: also consider annotated tags of the form vx.y.z-${file_localversion}
Commit 6ab7e1f95e96 ("setlocalversion: use only the correct release tag for git-describe") was absolutel
scripts/setlocalversion: also consider annotated tags of the form vx.y.z-${file_localversion}
Commit 6ab7e1f95e96 ("setlocalversion: use only the correct release tag for git-describe") was absolutely correct to limit which annotated tags would be used to compute the -01234-gabcdef suffix. Otherwise, if some random annotated tag exists closer to HEAD than the vX.Y.Z one, the commit count would be too low.
However, since the version string always includes the ${file_localversion} part, now the problem is that the count can be too high. For example, building an 6.4.6-rt8 kernel with a few patches on top, I currently get
$ make -s kernelrelease 6.4.6-rt8-00128-gd78b7f406397
But those 128 commits include the 100 commits that are in v6.4.6..v6.4.6-rt8, so this is somewhat misleading.
Amend the logic so that, in addition to the linux-next consideration, the script also looks for a tag corresponding to the 6.4.6-rt8 part of what will become the `uname -r` string. With this patch (so 29 patches on top of v6.4.6-rt8), one instead gets
$ make -s kernelrelease 6.4.6-rt8-00029-gd533209291a2
While there, note that the line
git describe --exact-match --match=$tag $tag 2>/dev/null
obviously asks if $tag is an annotated tag, but it does not actually tell if the commit pointed to has any relation to HEAD. So remove both uses of --exact-match, and instead just ask if the description generated is identical to the tag we provided. Since we then already have the result of
git describe --match=$tag
we also end up reducing the number of times we invoke "git describe".
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
#
3354c64d |
| 03-Aug-2023 |
Rasmus Villemoes <linux@rasmusvillemoes.dk> |
scripts/setlocalversion: clean up stale comment
Nobody has complained since 2a73cce2dad3 ("scripts/setlocalversion: remove mercurial, svn and git-svn supports"), so let's also clean up the header co
scripts/setlocalversion: clean up stale comment
Nobody has complained since 2a73cce2dad3 ("scripts/setlocalversion: remove mercurial, svn and git-svn supports"), so let's also clean up the header comment accordingly.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
#
05e96e96 |
| 15-Mar-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: use git-archive for source package creation
Commit 5c3d1d0abb12 ("kbuild: add a tool to list files ignored by git") added a new tool, scripts/list-gitignored. My intention was to create sour
kbuild: use git-archive for source package creation
Commit 5c3d1d0abb12 ("kbuild: add a tool to list files ignored by git") added a new tool, scripts/list-gitignored. My intention was to create source packages without cleaning the source tree, without relying on git.
Linus strongly objected to it, and suggested using 'git archive' instead. [1] [2] [3]
This commit goes in that direction - Remove scripts/list-gitignored.c and rewrites Makefiles and scripts to use 'git archive' for building Debian and RPM source packages. It also makes 'make perf-tar*-src-pkg' use 'git archive' again.
Going forward, building source packages is only possible in a git-managed tree. Building binary packages does not require git.
[1]: https://lore.kernel.org/lkml/CAHk-=wi49sMaC7vY1yMagk7eqLK=1jHeHQ=yZ_k45P=xBccnmA@mail.gmail.com/ [2]: https://lore.kernel.org/lkml/CAHk-=wh5AixGsLeT0qH2oZHKq0FLUTbyTw4qY921L=PwYgoGVw@mail.gmail.com/ [3]: https://lore.kernel.org/lkml/CAHk-=wgM-W6Fu==EoAVCabxyX8eYBz9kNC88-tm9ExRQwA79UQ@mail.gmail.com/
Fixes: 5c3d1d0abb12 ("kbuild: add a tool to list files ignored by git") Fixes: e0ca16749ac3 ("kbuild: make perf-tar*-src-pkg work without relying on git") Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
#
6ab7e1f9 |
| 05-Feb-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
setlocalversion: use only the correct release tag for git-describe
Currently, setlocalversion uses any annotated tag for git-describe. If we are at a tagged commit, it will not append the commit has
setlocalversion: use only the correct release tag for git-describe
Currently, setlocalversion uses any annotated tag for git-describe. If we are at a tagged commit, it will not append the commit hash.
$ git checkout v6.2-rc1^ $ make -s defconfig kernelrelease 6.1.0-14595-g292a089d78d3 $ git tag -a foo -m foo $ make -s kernelrelease 6.1.0
If a local tag 'foo' exists, it pretends to be a released version '6.1.0', while there are many commits on top of it.
The output should be consistent irrespective of such a local tag. Pass the correct release tag to --match option of git-describe.
In the mainline kernel, the SUBLEVEL is always '0', which is omitted from the tag.
KERNELVERSION annotated tag 6.1.0 -> v6.1 (mainline) 6.2.0-rc5 -> v6.2-rc5 (mainline, release candidate) 6.1.7 -> v6.1.7 (stable)
To preserve the behavior in linux-next, use the tag derived from localversion* files if exists. In linux-next, the local version is specified by the localversion-next file.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
#
eed36d77 |
| 05-Feb-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
setlocalversion: clean up the construction of version output
Concatenate all components in the last line instead of accumulating them into the 'res' variable.
No functional change is intended. A pr
setlocalversion: clean up the construction of version output
Concatenate all components in the last line instead of accumulating them into the 'res' variable.
No functional change is intended. A preparation for the next change.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
#
ec31f868 |
| 22-Jan-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
setlocalversion: absorb $(KERNELVERSION)
Print $(KERNELVERSION) in setlocalversion so that the callers get simpler.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
|
#
75280bdf |
| 22-Jan-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
setlocalversion: make indentation shallower
Return earlier if we are not in the correct git repository. This makes the code more readable.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Revi
setlocalversion: make indentation shallower
Return earlier if we are not in the correct git repository. This makes the code more readable.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
show more ...
|
#
992ebfab |
| 22-Jan-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
setlocalversion: simplify the construction of the short version
With the --short option given, scm_version() prints "+". Just append it.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Review
setlocalversion: simplify the construction of the short version
With the --short option given, scm_version() prints "+". Just append it.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
show more ...
|
#
f6e09b07 |
| 22-Jan-2023 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: do not put .scmversion into the source tarball
.scmversion is used by (src)rpm-pkg and deb-pkg to carry KERNELRELEASE.
In fact, deb-pkg does not rely on it any more because the generated de
kbuild: do not put .scmversion into the source tarball
.scmversion is used by (src)rpm-pkg and deb-pkg to carry KERNELRELEASE.
In fact, deb-pkg does not rely on it any more because the generated debian/rules specifies KERNELRELEASE from the command line.
Do likwise for (src)rpm-pkg, and remove this feature. For the same reason, you do not need to save LOCALVERSION in the spec file.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
show more ...
|
#
129ab0d2 |
| 13-Dec-2021 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: do not quote string values in include/config/auto.conf
The previous commit fixed up all shell scripts to not include include/config/auto.conf.
Now that include/config/auto.conf is only incl
kbuild: do not quote string values in include/config/auto.conf
The previous commit fixed up all shell scripts to not include include/config/auto.conf.
Now that include/config/auto.conf is only included by Makefiles, we can change it into a more Make-friendly form.
Previously, Kconfig output string values enclosed with double-quotes (both in the .config and include/config/auto.conf):
CONFIG_X="foo bar"
Unlike shell, Make handles double-quotes (and single-quotes as well) verbatim. We must rip them off when used.
There are some patterns:
[1] $(patsubst "%",%,$(CONFIG_X)) [2] $(CONFIG_X:"%"=%) [3] $(subst ",,$(CONFIG_X)) [4] $(shell echo $(CONFIG_X))
These are not only ugly, but also fragile.
[1] and [2] do not work if the value contains spaces, like CONFIG_X=" foo bar "
[3] does not work correctly if the value contains double-quotes like CONFIG_X="foo\"bar"
[4] seems to work better, but has a cost of forking a process.
Anyway, quoted strings were always PITA for our Makefiles.
This commit changes Kconfig to stop quoting in include/config/auto.conf.
These are the string type symbols referenced in Makefiles or scripts:
ACPI_CUSTOM_DSDT_FILE ARC_BUILTIN_DTB_NAME ARC_TUNE_MCPU BUILTIN_DTB_SOURCE CC_IMPLICIT_FALLTHROUGH CC_VERSION_TEXT CFG80211_EXTRA_REGDB_KEYDIR EXTRA_FIRMWARE EXTRA_FIRMWARE_DIR EXTRA_TARGETS H8300_BUILTIN_DTB INITRAMFS_SOURCE LOCALVERSION MODULE_SIG_HASH MODULE_SIG_KEY NDS32_BUILTIN_DTB NIOS2_DTB_SOURCE OPENRISC_BUILTIN_DTB SOC_CANAAN_K210_DTB_SOURCE SYSTEM_BLACKLIST_HASH_LIST SYSTEM_REVOCATION_KEYS SYSTEM_TRUSTED_KEYS TARGET_CPU UNUSED_KSYMS_WHITELIST XILINX_MICROBLAZE0_FAMILY XILINX_MICROBLAZE0_HW_VER XTENSA_VARIANT_NAME
I checked them one by one, and fixed up the code where necessary.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
#
7d153696 |
| 13-Dec-2021 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: do not include include/config/auto.conf from shell scripts
Richard Weinberger pointed out the risk of sourcing the kernel config from shell scripts [1], and proposed some patches [2], [3]. I
kbuild: do not include include/config/auto.conf from shell scripts
Richard Weinberger pointed out the risk of sourcing the kernel config from shell scripts [1], and proposed some patches [2], [3]. It is a good point, but it took a long time because I was wondering how to fix this.
This commit goes with simple grep approach because there are only a few scripts including the kernel configuration.
scripts/link_vmlinux.sh has references to a bunch of CONFIG options, all of which are boolean. I added is_enabled() helper as scripts/package/{mkdebian,builddeb} do.
scripts/gen_autoksyms.sh uses 'eval', stating "to expand the whitelist path". I removed it since it is the issue we are trying to fix.
I was a bit worried about the cost of invoking the grep command over again. I extracted the grep parts from it, and measured the cost. It was approximately 0.03 sec, which I hope is acceptable.
[test code]
$ cat test-grep.sh #!/bin/sh
is_enabled() { grep -q "^$1=y" include/config/auto.conf }
is_enabled CONFIG_LTO_CLANG is_enabled CONFIG_LTO_CLANG is_enabled CONFIG_STACK_VALIDATION is_enabled CONFIG_UNWINDER_ORC is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL is_enabled CONFIG_VMLINUX_VALIDATION is_enabled CONFIG_FRAME_POINTER is_enabled CONFIG_GCOV_KERNEL is_enabled CONFIG_LTO_CLANG is_enabled CONFIG_RETPOLINE is_enabled CONFIG_X86_SMAP is_enabled CONFIG_LTO_CLANG is_enabled CONFIG_VMLINUX_MAP is_enabled CONFIG_KALLSYMS_ALL is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU is_enabled CONFIG_KALLSYMS_BASE_RELATIVE is_enabled CONFIG_DEBUG_INFO_BTF is_enabled CONFIG_KALLSYMS is_enabled CONFIG_DEBUG_INFO_BTF is_enabled CONFIG_BPF is_enabled CONFIG_BUILDTIME_TABLE_SORT is_enabled CONFIG_KALLSYMS
$ time ./test-grep.sh real 0m0.036s user 0m0.027s sys m0.009s
[1]: https://lore.kernel.org/all/1919455.eZKeABUfgV@blindfold/ [2]: https://lore.kernel.org/all/20180219092245.26404-1-richard@nod.at/ [3]: https://lore.kernel.org/all/20210920213957.1064-2-richard@nod.at/ Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
show more ...
|
#
5df99bec |
| 12-Jul-2021 |
Mikulas Patocka <mpatocka@redhat.com> |
scripts/setlocalversion: fix a bug when LOCALVERSION is empty
The commit 042da426f8eb ("scripts/setlocalversion: simplify the short version part") reduces indentation. Unfortunately, it also changes
scripts/setlocalversion: fix a bug when LOCALVERSION is empty
The commit 042da426f8eb ("scripts/setlocalversion: simplify the short version part") reduces indentation. Unfortunately, it also changes behavior in a subtle way - if the user has empty "LOCALVERSION" variable, the plus sign is appended to the kernel version. It wasn't appended before.
This patch reverts to the old behavior - we append the plus sign only if the LOCALVERSION variable is not set.
Fixes: 042da426f8eb ("scripts/setlocalversion: simplify the short version part") Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
#
042da426 |
| 22-May-2021 |
Masahiro Yamada <masahiroy@kernel.org> |
scripts/setlocalversion: simplify the short version part
Reduce the indentation.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> R
scripts/setlocalversion: simplify the short version part
Reduce the indentation.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org>
show more ...
|
#
630ff0fa |
| 22-May-2021 |
Masahiro Yamada <masahiroy@kernel.org> |
scripts/setlocalversion: factor out 12-chars hash construction
Both of if and else parts append exactly 12 hex chars, but in different ways.
Factor out the else part because we need to support it w
scripts/setlocalversion: factor out 12-chars hash construction
Both of if and else parts append exactly 12 hex chars, but in different ways.
Factor out the else part because we need to support it without relying on git-describe. Remove the --abbrev=12 option since we do not use the hash from git-describe anyway.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org>
show more ...
|
#
ffaf62a8 |
| 22-May-2021 |
Masahiro Yamada <masahiroy@kernel.org> |
scripts/setlocalversion: add more comments to -dirty flag detection
This script stumbled on the read-only source tree over again:
- a2bb90a08cb3 ("kbuild: fix delay in setlocalversion on readonly
scripts/setlocalversion: add more comments to -dirty flag detection
This script stumbled on the read-only source tree over again:
- a2bb90a08cb3 ("kbuild: fix delay in setlocalversion on readonly source")
- cdf2bc632ebc ("scripts/setlocalversion on write-protected source tree")
- 8ef14c2c41d9 ("Revert "scripts/setlocalversion: git: Make -dirty check more robust"")
- ff64dd485730 ("scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks")
Add comments to clarify that this script should never ever try to write to the source tree.
'git describe --dirty' might look as a simple solution for appending the -dirty string, but we cannot use it because it creates the .git/index.lock file.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org>
show more ...
|
#
a2be76a3 |
| 22-May-2021 |
Masahiro Yamada <masahiroy@kernel.org> |
scripts/setlocalversion: remove workaround for old make-kpkg
This reverts commit b052ce4c840e ("kbuild: fix false positive -dirty tag caused by make-kpkg").
If I understand correctly, this problem
scripts/setlocalversion: remove workaround for old make-kpkg
This reverts commit b052ce4c840e ("kbuild: fix false positive -dirty tag caused by make-kpkg").
If I understand correctly, this problem occurred in very old versions of make-kpkg. When I tried a newer version, make-kpkg did not touch scripts/package/Makefile.
Anyway, Debian uses 'make deb-pkg' instead of make-kpkg these days.
Debian handbook [1] mentions it as "the good old days":
"CULTURE The good old days of kernel-package
Before the Linux build system gained the ability to build proper Debian packages, the recommended way to build such packages was to use make-kpkg from the kernel-package package."
[1]: https://debian-handbook.info/browse/stable/sect.kernel-compilation.html
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org>
show more ...
|
#
2a73cce2 |
| 22-May-2021 |
Masahiro Yamada <masahiroy@kernel.org> |
scripts/setlocalversion: remove mercurial, svn and git-svn supports
The mercurial, svn, git-svn supports were added by the following commits:
- 3dce174cfcba ("kbuild: support mercurial in setlocal
scripts/setlocalversion: remove mercurial, svn and git-svn supports
The mercurial, svn, git-svn supports were added by the following commits:
- 3dce174cfcba ("kbuild: support mercurial in setlocalversion")
- ba3d05fb6369 ("kbuild: add svn revision information to setlocalversion")
- ff80aa97c9b4 ("setlocalversion: add git-svn support")
They did not explain why they are useful for the kernel source tree. Let's revert all of them, and see if somebody will complain about it.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org>
show more ...
|
#
77a88274 |
| 29-Apr-2021 |
Masahiro Yamada <masahiroy@kernel.org> |
kbuild: replace LANG=C with LC_ALL=C
LANG gives a weak default to each LC_* in case it is not explicitly defined. LC_ALL, if set, overrides all other LC_* variables.
LANG < LC_CTYPE, LC_COLLATE
kbuild: replace LANG=C with LC_ALL=C
LANG gives a weak default to each LC_* in case it is not explicitly defined. LC_ALL, if set, overrides all other LC_* variables.
LANG < LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, ... < LC_ALL
This is why documentation such as [1] suggests to set LC_ALL in build scripts to get the deterministic result.
LANG=C is not strong enough to override LC_* that may be set by end users.
[1]: https://reproducible-builds.org/docs/locales/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Reviewed-by: Matthias Maennich <maennich@google.com> Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net> (mptcp) Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
#
548b8b51 |
| 17-Sep-2020 |
Rasmus Villemoes <linux@rasmusvillemoes.dk> |
scripts/setlocalversion: make git describe output more reliable
When building for an embedded target using Yocto, we're sometimes observing that the version string that gets built into vmlinux (and
scripts/setlocalversion: make git describe output more reliable
When building for an embedded target using Yocto, we're sometimes observing that the version string that gets built into vmlinux (and thus what uname -a reports) differs from the path under /lib/modules/ where modules get installed in the rootfs, but only in the length of the -gabc123def suffix. Hence modprobe always fails.
The problem is that Yocto has the concept of "sstate" (shared state), which allows different developers/buildbots/etc. to share build artifacts, based on a hash of all the metadata that went into building that artifact - and that metadata includes all dependencies (e.g. the compiler used etc.). That normally works quite well; usually a clean build (without using any sstate cache) done by one developer ends up being binary identical to a build done on another host. However, one thing that can cause two developers to end up with different builds [and thus make one's vmlinux package incompatible with the other's kernel-dev package], which is not captured by the metadata hashing, is this `git describe`: The output of that can be affected by
(1) git version: before 2.11 git defaulted to a minimum of 7, since 2.11 (git.git commit e6c587) the default is dynamic based on the number of objects in the repo (2) hence even if both run the same git version, the output can differ based on how many remotes are being tracked (or just lots of local development branches or plain old garbage) (3) and of course somebody could have a core.abbrev config setting in ~/.gitconfig
So in order to avoid `uname -a` output relying on such random details of the build environment which are rather hard to ensure are consistent between developers and buildbots, make sure the abbreviated sha1 always consists of exactly 12 hex characters. That is consistent with the current rule for -stable patches, and is almost always enough to identify the head commit unambigously - in the few cases where it does not, the v5.4.3-00021- prefix would certainly nail it down.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
show more ...
|
#
3c96bdd0 |
| 22-Oct-2019 |
Bhaskar Chowdhury <unixbhaskar@gmail.com> |
scripts: setlocalversion: replace backquote to dollar parenthesis
This patch replaces backquote to dollar parenthesis syntax for better readability.
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gm
scripts: setlocalversion: replace backquote to dollar parenthesis
This patch replaces backquote to dollar parenthesis syntax for better readability.
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
#
991b78fb |
| 05-Oct-2019 |
Randy Dunlap <rdunlap@infradead.org> |
scripts: setlocalversion: fix a bashism
Fix bashism reported by checkbashisms by using only one '=':
possible bashism in scripts/setlocalversion line 96 (should be 'b = a'): if [ "`hg log -r . --t
scripts: setlocalversion: fix a bashism
Fix bashism reported by checkbashisms by using only one '=':
possible bashism in scripts/setlocalversion line 96 (should be 'b = a'): if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
Fixes: 38b3439d84f4 ("setlocalversion: update mercurial tag parsing") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Mike Crowe <mcrowe@zipitwireless.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
#
7a82e3fa |
| 01-Oct-2019 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
scripts/setlocalversion: clear local variable to make it work for sh
Geert Uytterhoeven reports a strange side-effect of commit 858805b336be ("kbuild: add $(BASH) to run scripts with bash-extension"
scripts/setlocalversion: clear local variable to make it work for sh
Geert Uytterhoeven reports a strange side-effect of commit 858805b336be ("kbuild: add $(BASH) to run scripts with bash-extension"), which inserts the contents of a localversion file in the build directory twice.
[Steps to Reproduce] $ echo bar > localversion $ mkdir build $ cd build/ $ echo foo > localversion $ make -s -f ../Makefile defconfig include/config/kernel.release $ cat include/config/kernel.release 5.4.0-rc1foofoobar
This comes down to the behavior change of local variables.
The 'man sh' on my Ubuntu machine, where sh is an alias to dash, explains as follows: When a variable is made local, it inherits the initial value and exported and readonly flags from the variable with the same name in the surrounding scope, if there is one. Otherwise, the variable is initially unset.
[Test Code]
foo () { local res echo "res: $res" }
res=1 foo
[Result]
$ sh test.sh res: 1 $ bash test.sh res:
So, scripts/setlocalversion correctly works only for bash in spite of its hashbang being #!/bin/sh. Nobody had noticed it before because CONFIG_SHELL was previously set to bash almost all the time.
Now that CONFIG_SHELL is set to sh, we must write portable and correct code. I gave the Fixes tag to the commit that uncovered the issue.
Clear the variable 'res' in collect_files() to make it work for sh (and it also works on distributions where sh is an alias to bash).
Fixes: 858805b336be ("kbuild: add $(BASH) to run scripts with bash-extension") Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
show more ...
|
#
ff64dd48 |
| 14-Nov-2018 |
Brian Norris <briannorris@chromium.org> |
scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks
git-diff-index does not refresh the index for you, so using it for a "-dirty" check can give misleading results. Com
scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks
git-diff-index does not refresh the index for you, so using it for a "-dirty" check can give misleading results. Commit 6147b1cf19651 ("scripts/setlocalversion: git: Make -dirty check more robust") tried to fix this by switching to git-status, but it overlooked the fact that git-status also writes to the .git directory of the source tree, which is definitely not kosher for an out-of-tree (O=) build. That is getting reverted.
Fortunately, git-status now supports avoiding writing to the index via the --no-optional-locks flag, as of git 2.14. It still calculates an up-to-date index, but it avoids writing it out to the .git directory.
So, let's retry the solution from commit 6147b1cf19651 using this new flag first, and if it fails, we assume this is an older version of git and just use the old git-diff-index method.
It's hairy to get the 'grep -vq' (inverted matching) correct by stashing the output of git-status (you have to be careful about the difference betwen "empty stdin" and "blank line on stdin"), so just pipe the output directly to grep and use a regex that's good enough for both the git-status and git-diff-index version.
Cc: Christian Kujau <lists@nerdbynature.de> Cc: Guenter Roeck <linux@roeck-us.net> Suggested-by: Alexander Kapshuk <alexander.kapshuk@gmail.com> Signed-off-by: Brian Norris <briannorris@chromium.org> Tested-by: Genki Sky <sky@genki.is> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|
#
8ef14c2c |
| 06-Nov-2018 |
Guenter Roeck <linux@roeck-us.net> |
Revert "scripts/setlocalversion: git: Make -dirty check more robust"
This reverts commit 6147b1cf19651c7de297e69108b141fb30aa2349.
The reverted patch results in attempted write access to the source
Revert "scripts/setlocalversion: git: Make -dirty check more robust"
This reverts commit 6147b1cf19651c7de297e69108b141fb30aa2349.
The reverted patch results in attempted write access to the source repository, even if that repository is mounted read-only.
Output from "strace git status -uno --porcelain":
getcwd("/tmp/linux-test", 129) = 16 open("/tmp/linux-test/.git/index.lock", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = -1 EROFS (Read-only file system)
While git appears to be able to handle this situation, a monitored build environment (such as the one used for Chrome OS kernel builds) may detect it and bail out with an access violation error. On top of that, the attempted write access suggests that git _will_ write to the file even if a build output directory is specified. Users may have the reasonable expectation that the source repository remains untouched in that situation.
Fixes: 6147b1cf19651 ("scripts/setlocalversion: git: Make -dirty check more robust" Cc: Genki Sky <sky@genki.is> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
show more ...
|