rootfs-postcommands.bbclass: use DATETIME as system timestamp
PATCH 1/1 rootfs-postcommands.bbclass: use DATETIME as system timestamp
DATETIME is being used in BUILD_ID and some other places to mark the build time, let's use it as system timestamp, to have a consistent system-wide timestamp.
--- meta/classes-recipe/rootfs-postcommands.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes-recipe/rootfs-postcommands.bbclass +2 -1
@@ -424,11 +424,12 @@ rootfs_update_timestamp () { # Convert UTC into %4Y%2m%2d%2H%2M%2S sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2S` else - sformatted=`date -u +%4Y%2m%2d%2H%2M%2S` + sformatted=${DATETIME} fi echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp bbnote "rootfs_update_timestamp: set /etc/timestamp to $sformatted" } +rootfs_update_timestamp[vardepsexclude] = "DATETIME" # Prevent X from being started rootfs_no_x_startup () {
Signature · 1 line
2.43.0
Quoted 19 lines · Ming Liu via lists.openembedded.org
DATETIME is being used in
BUILD_IDand some other places to mark the build time, let's use it as system timestamp, to have a consistent system-wide timestamp.Signed-off-by Ming Liu <[email protected]>---
meta/classes-recipe/rootfs-postcommands.bbclass | 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)meta/classes-recipe/rootfs-postcommands.bbclass +0
-0@@ -424,11 +424,12 @@ rootfs_update_timestamp () { # Convert UTC into %4Y%2m%2d%2H%2M%2Ssformatted=
date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS} +%4Y%2m%2d%2H%2M%2Selsemeta/classes-recipe/rootfs-postcommands.bbclass +1
-1- sformatted=`date -u +%4Y%2m%2d%2H%2M%2S` + sformatted=${DATETIME}
Quoted 5 lines
fi
echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp
bbnote "rootfs_update_timestamp: set/etc/timestampto $sformatted" }
+rootfs_update_timestamp[vardepsexclude] = "DATETIME"
This could be a little tricky as this timestamp is meant to be the latest thing in the image. DATETIME is fixed when the build starts and therefore if files are modified during the image, those could have a later values.
I'm therefore not sure this is a good idea.
Cheers,
Richard
OK, that’s a good point, please ignore it.
//Ming Liu
On Wed, 2026-03-11 at 11:43 +0100, Ming Liu via lists.openembedded.org
Quoted 39 lines
Review
Quoted 10 lines · wrote:
DATETIME is being used in
BUILD_IDand some other places to mark the build time, let's use it as system timestamp, to have a consistent system-wide timestamp.Signed-off-by Ming Liu <[email protected]>--- meta/classes-recipe/rootfs-postcommands.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)(quoted diff) +0
-0b/meta/classes-recipe/rootfs-postcommands.bbclass
meta/classes-recipe/rootfs-postcommands.bbclass rootfs_update_timestamp () { · line 425
Quoted 6 lines
index
f0c7ee658d..43001e09b5100644meta/classes-recipe/rootfs-postcommands.bbclass +0
-0@@ -424,11 +424,12 @@ rootfs_update_timestamp () { # Convert UTC into %4Y%2m%2d%2H%2M%2S sformatted=`date -u -d @${REPRODUCIBLE_TIMESTAMP_ROOTFS}+%4Y%2m%2d%2H%2M%2S`
meta/classes-recipe/rootfs-postcommands.bbclass rootfs_update_timestamp () { · line 432
Quoted 8 lines
meta/classes-recipe/rootfs-postcommands.bbclass +2
-1else - sformatted=`date -u +%4Y%2m%2d%2H%2M%2S` + sformatted=${DATETIME} fi echo $sformatted > ${IMAGE_ROOTFS}/etc/timestamp bbnote "rootfs_update_timestamp: set /etc/timestamp to $sformatted" } +rootfs_update_timestamp[vardepsexclude] = "DATETIME"This could be a little tricky as this timestamp is meant to be the latest thing in the image. DATETIME is fixed when the build starts and therefore if files are modified during the image, those could have a later values.
I'm therefore not sure this is a good idea.
Cheers,
Richard