Is there such information anywhere in the system? /proc/sys/kernel contains build date in human-readable format, I need it in epoch time to automatically check if update has been completed successfully.
Of course, I can put this info in another file in the file system, but it is bicycle invention if there's already such an api in the system.
Thanks!
Assuming you are using the BuildSystem, you can set your build date from epoch using date +%s > version.date
in your buildroot to reflect actual build date/time.
I have it already. The problem is I must have this at the run time in the target to compare against planned value. Not sure if converting string date/time displayed by (kind of) uname -a
is the best idea. I am planning to copy version.date
in build/prepare
section of my package into its structure, but I am not sure if it is executed every time during build - for example when package files do not change.
And I thought this information from version.date
may have already been available in the system.
Just add the command before any make
?
Will return the same value contained in version.date
Apologies, did not get.
date +%s > version.date
will write unix timestamp into the top dir file, which will then be used to hardcode it into the kernel. The problem is I need exact contents of version.date
file on the target device. I can not find it readily available in any output of any command or file, therefore options are convert text from uname -a
to unix timestamp which I would want to avoid, or create separate file in the OS image with the same contents in the file system on build time with minimal customizations and maximal portability.
find_max_time
in /etc/init.d/sysfixtime
might do the trick for you: it finds the newest file under /etc
and sets the clock to that is there is no HW clock.
Something like:
#!/bin/sh
. /etc/init.d/sysfixtime
BUILD_TIME=$(find_max_time)
Or you could use cat /etc/*rel*
to get git commit of the build
“I see” said the blind man. Only hacky stuff at a quick look I’m afraid atm.
Thanks, no problem. I wanted to know if I miss anything. Seems the right way to do is to have version.date
file in the target file system (I perform image assembly) to compare with.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.