tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

More detailed build infomation in kernels

I have some private patches that append arbitrary additional information to the kernel version string. Essentially, I pass BUILDINFO="<multi-line message here>" in the environment (through and the make wrapper), and then a modified version of src/sys/conf/ appends it to the value of the "version" variable in the vers.c file that's compiled into the kernel. I also add the information to /etc/release.

The additional information is exposed in sysctl kern.version, and in {struct utsname}.version as returned by uname(3), and in the output from uname(1) -v.

I use this feature to add infomation about the source tree
and build date, so I see information like this:

$ sysctl kern.version
kern.version = NetBSD 6.99.47 (APB)
fossil repository: apb-local-src.fossil
fossil tags: local
fossil commit: 449e51b700 (2014-07-19 15:41:14 UTC)
fossil comment: merge src from trunk as of 2014-07-19 00:00 UTC

I imagine that it would be useful for official builds to
include some sort of official statement here.

The multi-line BUILDINFO strings are truncated and folded to a single line by uname(3), which is unhelpful, so I am inclined to store them in a new kernel variable, exposed via a new sysctl node, instead of appending to the existing kernel version variable. Then the new information would not be exposed by uname(3) or uname(1).


--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index