# uname -a compile count



## semi-ambivalent (Jul 4, 2011)

At some point in the past, certainly in the 4.x days, if I did `uname -a` I would see "what number" the loaded kernel was. Like 
	
	



```
FreeBSD 4-STABLE #7:
```
I was doing (if memory serves) 
	
	



```
cd /sys/i386/conf
cd ../../compile/MYKERNEL
make cleandir
cd -
config MYKERNEL
cd ../../compile/MYKERNEL
make depends...
```
These days when I compile using 
	
	



```
cd /usr/src
make buildkernel KERNCONF=MYKERNEL
...
```
that kernel count ends up always being zero. Can I get that old behavior again?

thanks,
s-a


----------



## tingo (Jul 4, 2011)

AFAIK, this behavior is still default. Here is an example from one of my machines:

```
tingo@kg-v7$ uname -a
FreeBSD kg-v7.kg4.no 8.2-STABLE FreeBSD 8.2-STABLE #6: Sat Jul  2 18:39:45 CEST 2011
     root@kg-v7.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64
```
I don't know why it doesn't work for you.


----------



## wblock@ (Jul 4, 2011)

The counter resets when source is updated.  I think it's /usr/src/sys/conf/newvers.sh.

Anyway, if you just build a new kernel without updating source, then the counter increments.


----------



## jalla (Jul 5, 2011)

My impression was that the counter is reset when you make the world.
I made buildkernel/installkernel a few days ago from a fresh /usr/src (without building the userland), and I now have

```
snapper:~% uname -a
FreeBSD snapper 8.2-STABLE FreeBSD 8.2-STABLE #1: Thu Jun 30 11:36:19 CEST 2011 tl@snapper:/usr/obj/usr/src/sys/snapper  amd64
snapper:~%
```

Also the version has been incremented by newvers.sh, and would take effect on the next kernel build

```
snapper:~% cat /usr/obj/usr/src/sys/snapper/version 
2
snapper:~%
```


----------



## wblock@ (Jul 5, 2011)

jalla said:
			
		

> My impression was that the counter is reset when you make the world.



Just did some testing.  /usr/obj/usr/src/sys/_KERNELNAME_/version is incremented after buildkernel.  buildworld, installworld, and mergemaster(8) don't touch version as far as I can tell.

What I usually do for faster builds is delete /usr/obj/, which wipes out /usr/obj/usr/src/sys/_KERNELNAME_/version and resets it.

(/usr/obj/usr/src/sys/_KERNELNAME_/version is created on line 81 of /usr/src/sys/conf/newvers.sh.  If it already exists, line 150 increments it after everything else.)


----------



## semi-ambivalent (Jul 5, 2011)

Thanks all for the info. I was doing both; buildworld and using new sources (RELEASE -> STABLE). I'll experiment with these two, although with 4GB of memory there isn't much need to re-compile these days. Habit I guess.

thanks,
s-a


----------

