android_kernel_xiaomi_sm7250/scripts
Rasmus Villemoes aefcff7050 scripts/setlocalversion: make git describe output more reliable
commit 548b8b5168c90c42e88f70fcf041b4ce0b8e7aa8 upstream.

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.

[Adapt to `` vs $() differences between 5.4 and upstream.]
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-05 11:08:31 +01:00
..
basic
coccinelle fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock 2019-05-08 07:21:51 +02:00
dtc scripts/dtc: Remove redundant YYLOC global declaration 2020-04-02 15:28:17 +02:00
gcc-plugins gcc-common.h: Update for GCC 10 2020-05-27 17:37:30 +02:00
gdb scripts/gdb: fix lx-symbols 'gdb.error' while loading modules 2020-07-29 10:16:51 +02:00
genksyms genksyms: Teach parser about 128-bit built-in types 2019-07-31 07:27:02 +02:00
kconfig kconfig: qconf: fix signal connection to invalid slots 2020-08-26 10:31:04 +02:00
ksymoops
mod modpost: skip ELF local symbols during section mismatch check 2019-12-13 08:52:20 +01:00
package kbuild: deb-pkg: fix bindeb-pkg breakage when O= is used 2019-04-17 08:38:45 +02:00
selinux selinux: use kernel linux/socket.h for genheaders and mdp 2019-05-04 09:20:10 +02:00
tracing
.gitignore
adjust_autoksyms.sh
asn1_compiler.c
bin2c.c
bloat-o-meter
bootgraph.pl
bpf_helpers_doc.py
cc-can-link.sh
check_00index.sh
check_extable.sh
checkincludes.pl
checkkconfigsymbols.py
checkpatch.pl checkpatch: fix the usage of capture group ( ... ) 2020-09-09 19:04:32 +02:00
checkstack.pl scripts/checkstack.pl: Fix arm64 wrong or unknown architecture 2019-06-25 11:35:58 +08:00
checksyscalls.sh
checkversion.pl
clang-version.sh
cleanfile
cleanpatch
coccicheck
config scripts/config: allow colons in option strings for sed 2020-05-10 10:30:09 +02:00
conmakehash.c
const_structs.checkpatch
decode_stacktrace.sh scripts/decode_stacktrace: strip basepath from all paths 2020-07-29 10:16:51 +02:00
decodecode scripts/decodecode: fix trapping instruction formatting 2020-05-14 07:57:23 +02:00
depmod.sh
diffconfig
documentation-file-ref-check
export_report.pl
extract_xc3028.pl
extract-cert.c
extract-ikconfig
extract-module-sig.pl
extract-sys-certs.pl
extract-vmlinux
faddr2line
file-size.sh
find-unused-docs.sh scripts/find-unused-docs: Fix massive false positives 2020-02-11 04:34:01 -08:00
gcc-goto.sh jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00
gcc-ld
gcc-plugin.sh
gcc-version.sh
gcc-x86_32-has-stack-protector.sh
gcc-x86_64-has-stack-protector.sh
get_dvb_firmware
get_maintainer.pl
gfp-translate
headerdep.pl
headers_check.pl
headers_install.sh
headers.sh
insert-sys-cert.c
kallsyms.c scripts/kallsyms: fix definitely-lost memory leak 2020-01-04 19:13:09 +01:00
Kbuild.include kbuild: improve cc-option to clean up all temporary files 2020-06-30 23:17:15 -04:00
Kconfig.include kbuild: use -S instead of -E for precise cc-option test in Kconfig 2020-02-24 08:34:50 +01:00
kernel-doc
ld-version.sh
leaking_addresses.pl
Lindent
link-vmlinux.sh
Makefile
Makefile.asm-generic
Makefile.build x86/retpoline: Make CONFIG_RETPOLINE depend on compiler support 2018-12-05 19:32:01 +01:00
Makefile.clean
Makefile.dtbinst
Makefile.extrawarn kbuild: Disable -Wpointer-to-enum-cast 2020-03-25 08:06:14 +01:00
Makefile.gcc-plugins
Makefile.headersinst
Makefile.host
Makefile.kasan
Makefile.kcov
Makefile.lib kbuild: disable dtc simple_bus_reg warnings by default 2019-12-13 08:52:18 +01:00
Makefile.modbuiltin
Makefile.modinst
Makefile.modpost kbuild: modpost: handle KBUILD_EXTRA_SYMBOLS only for external modules 2019-08-25 10:47:55 +02:00
Makefile.modsign
Makefile.ubsan
makelst
markup_oops.pl
mkcompile_h
mkmakefile
mksysmap mksysmap: Fix the mismatch of '.L' symbols in System.map 2020-06-25 15:32:51 +02:00
mkuboot.sh
module-common.lds
namespace.pl namespace: fix namespace.pl script to support relative paths 2019-10-29 09:19:36 +01:00
objdiff
parse-maintainers.pl parse-maintainers: Mark as executable 2020-03-25 08:06:08 +01:00
patch-kernel
pnmtologo.c
profile2linkerlist.pl
prune-kernel
recordmcount.c ARM: 8950/1: ftrace/recordmcount: filter relocation types 2020-01-29 16:43:19 +01:00
recordmcount.h recordmcount: Fix spurious mcount entries on powerpc 2019-07-31 07:27:03 +02:00
recordmcount.pl
setlocalversion scripts/setlocalversion: make git describe output more reliable 2020-11-05 11:08:31 +01:00
show_delta
sign-file.c
sortextable.c
sortextable.h
spdxcheck.py scripts/spdxcheck.py: always open files in binary mode 2018-12-19 19:19:50 +01:00
spelling.txt
sphinx-pre-install scripts/sphinx-pre-install: fix script for RHEL/CentOS 2019-08-16 10:12:44 +02:00
split-man.pl
stackdelta
stackusage
subarch.include
tags.sh
unifdef.c unifdef: use memcpy instead of strncpy 2018-12-08 12:59:06 +01:00
ver_linux
xen-hypercalls.sh
xz_wrap.sh