Question

On my Linux machine when i run

uname -v

it gives me

#83-Ubuntu SMP Wed Jan 4 11:12:07 UTC 2012

Now i am building my custom kernel and i need to show some flag/text info about build in this string ..

i want something like if some config are on then add BUILD-XYZ in that string

   #83-Ubuntu SMP Wed Jan 4 11:12:07 UTC 2012 BUILD-XYZ

if not then add BUILD-ABC in that.

  #83-Ubuntu SMP Wed Jan 4 11:12:07 UTC 2012 BUILD-ABC
Was it helpful?

Solution

The variable CONFIG_LOCALVERSION (inside your kernel .config file) let you set a custom string that will be appended to the kernel release number, thus shown when using 'uname'.

Is that what you want?

OTHER TIPS

There's a few ways to do this using GNU awk, here's one:

uname -v | awk '{ printf (/some config/) ? $0" BUILD-XYZ\n" : $0" BUILD-ABC\n" }'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top