[yocto] Fwd: How to make the os-release package work with local walltime instead of GMT?

Robert Yang liezhi.yang at windriver.com
Wed Jan 10 21:26:26 PST 2018


Hi Davis,

You can try to add this to conf/local.conf or redefine it in os-release.bb:

BUILD_ID = "${@time.strftime('%Y-%m-%d %H:%M:%S',time.localtime())}"

// Robert

On 01/11/2018 12:55 PM, Davis Roman wrote:
> Hello,
> 
> I'm trying to fullfill a requirement which states that I must have a file in my 
> root filesystem which has the timestamp of when the rootfs was generated for 
> traceability purposes.
> 
> I've included the os-release package into my image recipe.
> 
> However, when I cat /etc/os-release, I notice that the BUILD_ID variable does 
> not reflect the actually time that my build took place.
> 
> Upon further inspection, I noticed in the os-release recipe that BUILD_ID is 
> based on the DATETIME variable.
> 
> Drilling down further, I noticed that DATETIME is defined 
> in ./meta/conf/bitbake.conf
> 
>      DATE := "${@time.strftime('%Y%m%d',time.gmtime())}"
>      TIME := "${@time.strftime('%H%M%S',time.gmtime())}"
>      DATETIME = "${DATE}${TIME}"
> 
> So it appears to me that DATETIME is based on gmttime.
> 
> Instead, I would like this to be based on wall time.
> 
> Any suggestions on how to do this?
> 
> Thank you,
> 
> Davis
> 
> 
> 



More information about the yocto mailing list