[SOLVED] uname -r -- does it "read" the kernel or where does it get its output from?
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Original Poster
Rep:
It is indeed "hard wired". The make file of the kernel package under construction contains the major descriptor of the kernel (which might be edited at ones own risk ) to which a further description can be attached at some point during preparations of a kernel compilation run with the command
Code:
make-kpgp --append-to-version="your-string-here"
Where and how it is read out by "uname" is not quite clear (yet) .
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Original Poster
Rep:
And then one can edit the makefile in the main directory of the kernel sources and amend the fourth line which contains the variable "EXTRAVERSION". Herein goes the value of the string to be appended to the normal kernel descriptor. This can also be done more comfortable during the normal configuration AFAIR. I guess I'll be back (again)...
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Original Poster
Rep:
Sure. But /proc is an ephemeral file system, created during boot. So it must get its information from somewhere, where the kernel version is stored permanently. I'm still looking where and how it is done. The kernel maintainers would know it, of course -- and one day I will, too .
In other words ... when you (say) do ls /proc/*, the kernel in real-time sends back a "list of 'files' and 'directories'" to you ... making it up on-the-spot.
Now, if you do ls /proc/pid, the same thing happens again: after determining that what you're asking for is actually any of your business , the kernel sends back a list of files and directories. Or, in the case of a particular "file," textual information.
It is, compared to most other operating systems, "effin' brilliant." Any program or script can get any sort of information that it wants (that is allowed to have), using perfectly-ordinary techniques like it would use if those files and directories actually existed. But, there is no physical set of files or directories that actually exists anywhere. The illusion is complete, but it is completely an illusion.
Last edited by sundialsvcs; 03-22-2013 at 09:41 AM.
Distribution: Red Hat, Scientific Linux, CentOS, and Ubuntu
Posts: 27
Rep:
Quote:
Sure. But /proc is an ephemeral file system
Well, yeah, but that's how you interface with the running kernel, and if you want to know about the current running kernel, that's where you'll need to look.
Quote:
So it must get its information from somwhere, where the kernel version is stored permanently.
Right, its stored as a literal value in the kernel binary, and in the kernel config files in /boot:
Code:
[root@bigdaddy boot]# grep "kernel version" config*
config-2.6.32-220.el6.x86_64:# Linux kernel version: 2.6.32-220.el6.x86_64
config-2.6.32-358.2.1.el6.x86_64:# Linux kernel version: 2.6.32-358.2.1.el6.x86_64
[root@bigdaddy boot]#
But that doesn't really tell you anything about which kernel is actually running right now.
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Original Poster
Rep:
Agreed on all statements in the last several posts. After what I learned in this thread to rephrase my original question: how do the maintainers "brand" their newest kernel version, i.e. in what (config)-file is the newest name actually written down? As I understand it, "uname -a" must read it from the running kernel (probably using a know offset from the beginning or some such).
Distribution: Red Hat, Scientific Linux, CentOS, and Ubuntu
Posts: 27
Rep:
Quote:
how do the maintainers "brand" their newest kernel version, i.e. in what (config)-file is the newest name actually written down?
I believe it is picked up from include/config/kernel.release in the kernel source, which is created from variables set right at the top of the kernel Makefile:
Code:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 32
EXTRAVERSION = -358.2.1.el6.x86_64
NAME = Man-Eating Seals of Antiquity
RHEL_MAJOR = 6
RHEL_MINOR = 4
RHEL_RELEASE = 357
Last edited by oldscratch; 03-25-2013 at 09:05 AM.
Reason: to clarify how kernel.release is created
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.