1

I am trying to create a procfs entry. In linux kernel, I modify the scripts/mkcompile_h file to get timestamp value which is written to temperory generated file include/generated/compile.h. When I try to read that value (Eg: UTS_VERSION) from include/generated/compile.h (even /proc/version uses same logic to get details), I get some different value for time (some lesser seconds).

For printing macro value as proc entry, I just use seq_printf(m, MACRO_VALUE);. I dont understand the reason for not getting exact MACRO value as in proc/version. Even the KBUILD_BUILD_VERSION is wrong, it gives one less value than the macro value specified in include/generated/compile.h when I do seq_printf(m, UTS_VERSION);.

Sample generated/compile.h file:

#define UTS_MACHINE "arm"

#define UTS_VERSION "#2 SMP PREEMPT Day Month Date hh:mm:ss IST year"

Expected output: #2 SMP PREEMPT Day Month Date hh:mm:ss IST year

But I get following output: #1 SMP PREEMPT Day Month Date hh:mm:ss-somevalue IST year

Ivid
  • 203
  • 3
  • 10

0 Answers0