How do you change the system time for your image at build time?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How do you change the system time for your image at build time?

跳至解决方案
4,045 次查看
nathanswartzent
Contributor I

It appears that whenever we build an image, the builder's system time when the image was built is "baked in" the image somewhere.  If we attempt to change the system time (while running the image) to some time before this, the system acts strangely.  For instance, if our image was built at 3:00PM on Nov 2, and we attempt to change the date while running the image to Oct 20, we see this issue.  Is there a way to change the system time used by the image when the image is built?  We're using the 3.10.17 kernel with yocto 1.6.1.

0 项奖励
回复
1 解答
3,743 次查看
KursadOney
NXP Employee
NXP Employee

Assuming with "image," you mean the kernel. Here's what Documentation/kbuild/kbuild.txt says:

KBUILD_BUILD_TIMESTAMP

--------------------------------------------------

Setting this to a date string overrides the timestamp used in the

UTS_VERSION definition (uname -v in the running kernel). The value has to

be a string that can be passed to date -d. The default value

is the output of the date command at one point during build.

For example you can run:

export KBUILD_BUILD_TIMESTAMP='Sun May 1 12:00:00 CEST 2011'

在原帖中查看解决方案

0 项奖励
回复
1 回复
3,744 次查看
KursadOney
NXP Employee
NXP Employee

Assuming with "image," you mean the kernel. Here's what Documentation/kbuild/kbuild.txt says:

KBUILD_BUILD_TIMESTAMP

--------------------------------------------------

Setting this to a date string overrides the timestamp used in the

UTS_VERSION definition (uname -v in the running kernel). The value has to

be a string that can be passed to date -d. The default value

is the output of the date command at one point during build.

For example you can run:

export KBUILD_BUILD_TIMESTAMP='Sun May 1 12:00:00 CEST 2011'

0 项奖励
回复