Kernel build number

Hello,

What does the #0, #1, etc. found in the output of uname -v mean, exactly?
I guess it's a kernel build number?

Official builds all seem to be #0.
I currently have FreeBSD 13.1-STABLE #4 stable/13-n250651-85983255c15.

I upgraded my system today and went from a FreeBSD 13.1-STABLE #2 to a FreeBSD 13.1-STABLE #4. Given that I interrupted the kernel build once (it was too slow because I forgot to set -j8), I guess the number starts at zero for the first build of a given kernel or branch and increments each time make buildkernel is run?

If this is correct, then:

When is that counter reset?
When switching branches (f.e. stable/13 --> stable/14)?
When building a custom kernel instead of GENERIC?

How to manually reset it?
 
I think that a clean kernel build should reset that sequence number.

Thanks, that's probably consistent with what I have here. #1 at the time of writing.

I do recall a make clean before one of my recent builds (recent weeks). history gives me times but not dates:

Code:
bectl list -c creation | grep e140d551b78
n255078-e140d551b78-b -      -          309M  2022-04-30 18:28
n255078-e140d551b78-c NR     /          200G  2022-05-01 23:16
% uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #1 main-n255078-e140d551b78-dirty: Wed Apr 27 22:51:33 BST 2022     root@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 1400057 1400057
% su -
Password:
root@mowa219-gjp4-8570p-freebsd:~ # history | grep make\ clean
   544  9:18    make clean
   550  10:00   make clean
  1268  17:50   make clean
  1270  17:50   make clean
  1275  17:51   make clean
  1278  17:52   make clean
  1305  15:29   cd /usr/src/tools/tools/net80211 && make clean && cd wlanstats && make
  1870  3:28    make clean
root@mowa219-gjp4-8570p-freebsd:~ #

Re: the fuller list of BEs (below), n254693-d7696096209-a was probably my first build after cleaning. d7696096209 was committed 2022-04-12.

Code:
% bectl list -c creation
BE                    Active Mountpoint Space Created
n250511-5f73b3338ee-d -      -          4.94G 2021-11-13 15:43
n252381-75d20a5e386-b -      -          6.81G 2022-01-12 23:23
n252450-5efa7281a79-a -      -          6.49G 2022-01-14 19:27
n252483-c8f8299a230-b -      -          4.84G 2022-01-17 14:24
n252505-cc68614da82-a -      -          4.90G 2022-01-18 14:26
n252531-0ce7909cd0b-h -      -          5.71G 2022-02-06 12:24
n252997-b6724f7004c-c -      -          6.17G 2022-02-11 23:07
n253116-39a36707bd3-e -      -          5.66G 2022-02-20 07:03
n253343-9835900cb95-c -      -          1.54G 2022-02-27 14:58
n253776-d5ad1713cc3-b -      -          7.94G 2022-03-18 09:31
n253861-92e6b4712b5-e -      -          7.41G 2022-04-02 16:02
n254268-50e244964e9-d -      -          6.62G 2022-04-09 18:50
n254693-d7696096209-f -      -          1.92G 2022-04-27 17:41
n255078-e140d551b78-b -      -          309M  2022-04-30 18:28
n255078-e140d551b78-c NR     /          200G  2022-05-01 23:16
% ls -hl /usr/src/*.log
-rw-r--r--  1 root  wheel   7.4M 27 Apr 23:10 /usr/src/buildkernel.log
-rw-r--r--  1 root  wheel   3.4M 27 Apr 21:34 /usr/src/buildworld.log
-rw-r--r--  1 root  wheel   163K 28 Apr 01:50 /usr/src/installkernel.log
-rw-r--r--  1 root  wheel   4.7M 28 Apr 03:02 /usr/src/installworld.log
% su -
Password:
root@mowa219-gjp4-8570p-freebsd:~ # history | grep n254693-d7696096209-a
  1456  2:40    bectl destroy n254693-d7696096209-a
  2003  3:08    history | grep n254693-d7696096209-a
root@mowa219-gjp4-8570p-freebsd:~ #
 
Hello,

What does the #0, #1, etc. found in the output of uname -v mean, exactly?
I guess it's a kernel build number?

Official builds all seem to be #0.
I currently have FreeBSD 13.1-STABLE #4 stable/13-n250651-85983255c15.

I upgraded my system today and went from a FreeBSD 13.1-STABLE #2 to a FreeBSD 13.1-STABLE #4. Given that I interrupted the kernel build once (it was too slow because I forgot to set -j8), I guess the number starts at zero for the first build of a given kernel or branch and increments each time make buildkernel is run?

If this is correct, then:

When is that counter reset?
When the compile directory /usr/src/sys/*/compile/KERNELNAME is deleted/recreated. The counter is probably in there.
When switching branches (f.e. stable/13 --> stable/14)?
When building a custom kernel instead of GENERIC?
Likely that is a different counter then.
How to manually reset it?
Find the counter file and change it.

uname -v returns for me no #
Code:
FreeBSD 13.1-RC5 releng/13.1-n250141-2e9ad6042be MYKERNELOPT
There was an effort about reproducible builds, and it appears the counter is now only present in STABLE and CURRENT.
 
These are the bookkeeping numbers from the code revision tools.
n250141 is from svn and means, this is the 250141'th commit in the codebase.
The other is from git, and is a hash that should uniquely identify the build. If you have git installed and the sourcecode, you can just do git log 2e9ad6042be, and here is the storyline:
Code:
commit 2e9ad6042bef1c474fd99f57001fd76c7f17fc53
Author: Glen Barber <gjb@FreeBSD.org>
Date:   Wed Apr 27 20:06:34 2022 -0400

    13.1: Update to RC5
    
    Approved by:    re (implicit)
    Sponsored by:   Rubicon Communications, LLC ("Netgate")

commit 245d5a65f5805864881e2601190e7783057d2768
Author: Hans Petter Selasky <hselasky@FreeBSD.org>
Date:   Thu Apr 21 16:59:09 2022 +0200

    xhci(4): Ensure the so-called data toggle gets properly reset.
[...]
 
n250141 is from svn and means, this is the 250141'th commit in the codebase.
Well, almost. SVN uses sequential numbers to identify commits (which is of course only possible in a centralized SCM), and someone decided FreeBSD should still have such numbers even after git migration, so they are now generated with
git rev-list --count --first-parent HEAD, see also git-rev-list(1).

I wouldn't necessarily count on these numbers being exactly the same as the SVN revision numbers ;)
 
  • Thanks
Reactions: PMc
Back
Top