0

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
Jeegar Patel
  • 26,264
  • 51
  • 149
  • 222

2 Answers2

2

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?

mbarthelemy
  • 12,465
  • 4
  • 41
  • 43
1

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" }'
Steve
  • 51,466
  • 13
  • 89
  • 103