Feeling both old and proud: My first kernel patch was accepted yesterday 20 years ago!
@ukleinek I didn't even know about the kernelrelease make target ;-)
I always look in include/generated/utsrelease.h, which is much faster:
$ time make kernelrelease
6.18.0-rc3-shmobile-05113-ge6a2ce30f5a4
real 0m1.338s
user 0m1.180s
sys 0m0.279s
$ time cat include/generated/utsrelease.h
#define UTS_RELEASE "6.18.0-rc3-shmobile-05113-ge6a2ce30f5a4"
real 0m0.001s
user 0m0.000s
sys 0m0.001s
@geert There is a relevant difference (and today’s situation is again different, see below):
$ time make kernelrelease
2.6.14
real 0m0.044s
user 0m0.039s
sys 0m0.006s
$ time cat include/generated/utsrelease.h
cat: include/generated/utsrelease.h: No such file or directory
real 0m0.002s
user 0m0.000s
sys 0m0.002s
That is, make kernelrelease only emitted the version determined by the source (in Makefile), while utsrelease.h also accounts for .config.
Today there are two make targets: kernelrelease and kernelversion. The first depends on .config (and thus takes CONFIG_LOCALVERSION, CONFIG_LOCALVERSION_AUTO etc. into account), the latter has the same semantic that I introduced for kernelrelease back then. See commits 6b6a462c4ab7 (“[PATCH] KERNELRELEASE depends on CONFIG_LOCALVERSION”) and cb58455c48dc (“kbuild: KERNELRELEASE is only re-defined when buiding the kernel”).
And FTR: I think the semantic and names are swapped. For me the kernel release is 6.18.0-rc4 and the version can be something like 6.18.0-rc4-00155-g4a0c9b339199.
@matttbe @ukleinek FTR, that script contains a hack to detect if you are running as root, and run /usr/bin/linux-version instead. Without that, "apt-get install --reinstall initramfs-tools" creates bogus files "/var/lib/initramfs-tools/v." and "/boot/initrd.img-v.". It took me years to discover the cause of that...