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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
3,091 Views
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 Kudos
Reply
1 Solution
2,789 Views
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'

View solution in original post

0 Kudos
Reply
1 Reply
2,790 Views
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 Kudos
Reply