From patchwork Thu Dec 7 15:41:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: venkata.pyla@toshiba-tsip.com X-Patchwork-Id: 3231 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Thu, 07 Dec 2023 16:41:35 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-oa1-f59.google.com (mail-oa1-f59.google.com [209.85.160.59]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 3B7FfXNr030766 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 7 Dec 2023 16:41:34 +0100 Received: by mail-oa1-f59.google.com with SMTP id 586e51a60fabf-1fadd34d7e5sf1897739fac.3 for ; Thu, 07 Dec 2023 07:41:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701963688; cv=pass; d=google.com; s=arc-20160816; b=yXFXZj4ehKCwnt9gS1kRj2cAnheS/y4rR2aAglYtZ87ahtNb0GEazvH2OJIoGmQYh0 +BDlVVoF+OJeg2O7LEx5Hunwg+JvLEKrq3B998jGx140O+yYYqEXy2W1FZsRvaLaxW79 OKNPprD6Vfu5PsEk0k59jHOaqoHCygsmbHYCSySLeAX23m05l9m4yau+0u84val90h8Y ZFVswqt+6WpYCV5rcMWRaDQ8HXd5mHUA4Co0qBburXRdd8VrO98HUmnwC+sMt6BSxDpZ 8bTVTIL9HR+JNpv2dnvC2NcvuaaAy0lz/APEmFEqVLDCIYwwsPXwlTrGlhsB9Z+WiIOo vemg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=+Vm9ALQTC6IQm48rZNVbzNvtwlJKfRUgppP05biAi3M=; fh=0lUGB2344BCNlOMKgxbVcIhrk5SvZVfMXmxQVZJT4o8=; b=P/gEFTRcf79AzM/R+lKlicebNg/XJO6i0M+V+mGgfyYo9ZcBw7wFR974gpcGJ7JuZy CYAp8FaBF3Cgk6VYbcqLAWx7kWOgZbrZ2KT0JXINawWN97PqnFV7COv+kAB7E/CwG2jc TS8Vxp1r1Fq3BRye3DR3QApU1+j3h6yJHVPT+w5k4BLGesfNgBxcy1MxE2WmkB7xgBnQ gzuWFXRcVfY/8ZLdOOBREVq7C8PBMC9D7GkHG2WNBi0zrzNSHZ6//cD/bvJFEf0r0mja d+cEvFGQ+VGdbwQKU+fohnXupCI+HmKVkvAFqNDpY3bztP7Qt2POiGjrfUSBPmZ8MxuC u2hg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.158 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1701963688; x=1702568488; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=+Vm9ALQTC6IQm48rZNVbzNvtwlJKfRUgppP05biAi3M=; b=MHm+zphFgSqSn8Q1meos8nsxakTFje7ZW1IBsMSsn9un4Y4JBNm6yBqN4l46OcH/F+ ZtFozje6FlpKzJ9DJMbpldtfcqT0u8pqJi1jGCPhnJrxHDXLAH/GQ2IVdX1PIsFCu896 DVdj6GvbwH9bjDcw+s0F+F/4vkfggp2D0Mwk5btn1EC1mIvBWrbYfdPnQZHDES9uos2u SIwozrwACNyT9wa2C9Byjjg0GdGiz9yo4H1P/Pq5L2OMpAtMyJY2KTpM/BlvDwB7N69q HuL/hjPDYqOfO2s4SDqSDvE1mcUJkbOdYvK6h3mAxFvx7wExvOT3eUPCPpamyrvCxj+S 4RdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701963688; x=1702568488; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=+Vm9ALQTC6IQm48rZNVbzNvtwlJKfRUgppP05biAi3M=; b=jikr3K0dNjl2w4E+pex4pNGxMuq1jfwaVHoRbbh8KBg1tYwsm7jnswH7rGgjWKYIDp SbwO+RnI9d7SUIfOn6QqMgmfr915enJSg7WS74Bw691Cdqd0DbzTjrdtlCkn0Ggkl32H bSbMNyXYI5lxdwg1KOLctI3jenN6Po4P5EbHoj3yizPV9MzxXDyiyG9uHcZFxpEPws8t t4Qo+KjH8Ph8wsFhmubDBTWUsE4F0CXKtP5MrMBqk2sdwvr+3TkWJZwkaRATn3uN1Aa9 Y9h+nWDBihc+1RTxXC9sgyDmGuSLpuSxzwCssNhKNTPFL5ifp6cMHKSRKu1/33CKUsGb GCCw== Sender: isar-users@googlegroups.com X-Gm-Message-State: AOJu0YzJJIRD+Rry2jZLbUTI2OXxfsf+byIF1t9wIX9qdLKAMxvPuhyp GSwza5qe/kHmy9H2j0cLigY= X-Google-Smtp-Source: AGHT+IFwt92D2JxnUMgw3R9pDKYxN10SBJgxqA8vBnyLzt594bll9+Q7KWvZrfd+p7ITfVYf/VLurQ== X-Received: by 2002:a05:6870:f286:b0:1fa:f234:660b with SMTP id u6-20020a056870f28600b001faf234660bmr3168318oap.20.1701963688322; Thu, 07 Dec 2023 07:41:28 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6870:c45:b0:1fb:3148:c486 with SMTP id lf5-20020a0568700c4500b001fb3148c486ls890290oab.2.-pod-prod-04-us; Thu, 07 Dec 2023 07:41:27 -0800 (PST) X-Received: by 2002:a05:6871:8a3:b0:1fb:2137:ebcb with SMTP id r35-20020a05687108a300b001fb2137ebcbmr3023711oaq.38.1701963687178; Thu, 07 Dec 2023 07:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701963687; cv=none; d=google.com; s=arc-20160816; b=t+1ddqY4ChffXOns9XUPOgF1iROzI7Dk7+XdJyQtpFpx2q+UAVWO2Lwf/gDAY0K1Ej /VzOX+jTpFcsWHXwXxK5ZHAIqJfHdI5/Np/s9eH2BbnSDdosibNbVr2anjrDyVwtT76H /tZRVoMiORx/j6NHywxgPHpIygyxobvlquJg3Jx9w0G6tP4soEYGI5bIMXzwMmaVqiOi TJIon8bag52TU24Ymn4qaOpD5HJJRFPfZ6ZjcASngnke4zOIBVywUAwCEsqNJ1ifOUyO XGT2tnbX9rXtbX2WkAJhCqNSf1iH47Df+HqzjnFF2JiC/VVjTdyAFbw/RCt6JWm49u5a ixLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=JQ02Jxz6K4B+7BPnz2ay1iEjVACGFU2UJjehvwy7ftE=; fh=0lUGB2344BCNlOMKgxbVcIhrk5SvZVfMXmxQVZJT4o8=; b=pccWTbpaMm5ucomMtorfZO2B0V5vHwPQshaedihbamhJymKiuWiBsILl3haE6otD/x irFuWAUKEejOwKYqhI9yGNBZu4VhmecvSsLC8wn8S8RZaHvfhL7b7nE+1BS8OQfHpQdM dk/vFCi6nR26j7g6MrQw2HBxSgCXIVmuTPDZu0dtqaXwi56DXwjOxNY/sw2W8lc5H33s LoPR5pQiZ9C+55UeIJRM39WYYn1bdduO7Bs7KNjoA/d73DLOvKg132MR7ZrvAtm0J7wy T3hAuNS8gEUL0iTPYwhxpQkfsTsoxs9aW48A3qIn3nqA92dhrifvIininD2brPm79J3a P58g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.158 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Received: from mo-csw.securemx.jp (mo-csw1122.securemx.jp. [210.130.202.158]) by gmr-mx.google.com with ESMTPS id lw12-20020a0568708e0c00b001fab154c144si8130oab.1.2023.12.07.07.41.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 07:41:27 -0800 (PST) Received-SPF: pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.158 as permitted sender) client-ip=210.130.202.158; Received: by mo-csw.securemx.jp (mx-mo-csw1122) id 3B7FfOxA394143; Fri, 8 Dec 2023 00:41:24 +0900 X-Iguazu-Qid: 2rWhVu35FtyT0i2apc X-Iguazu-QSIG: v=2; s=0; t=1701963684; q=2rWhVu35FtyT0i2apc; m=A/vU35dwX+sag7U72XSZCYExOV7EAK1dlKbTq2DSkGw= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1123) id 3B7FfNit2798156 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 8 Dec 2023 00:41:23 +0900 From: venkata.pyla@toshiba-tsip.com To: isar-users@googlegroups.com Cc: venkata pyla , jan.kiszka@siemens.com, kazuhiro3.hayashi@toshiba.co.jp, dinesh.kumar@toshiba-tsip.com, felix.moessbauer@siemens.com Subject: [PATCH 5/5] wic: make ext2/3/4 images reproducible Date: Thu, 7 Dec 2023 21:11:14 +0530 X-TSB-HOP2: ON Message-Id: <20231207154114.20400-6-venkata.pyla@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20231207154114.20400-1-venkata.pyla@toshiba-tsip.com> References: <20231207154114.20400-1-venkata.pyla@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 07 Dec 2023 15:41:14.0730 (UTC) FILETIME=[CFC5ECA0:01DA2923] X-Original-Sender: venkata.pyla@toshiba-tsip.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.158 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= From: venkata pyla Ext2/3/4 FS contains not only mtime, but also ctime, atime and crtime. Currently, all the files are being added into the rootfs image using mkfs -d functionality which affects all the timestamps excluding mtime. This patch ensures these timestamps inside the FS image equal to the SOURCE_DATE_EPOCH if it is set. taken from openembedded-core: 75d2dd0ea7790db2e8ee921784ca373abff2df65 Signed-off-by: venkata pyla --- scripts/lib/wic/partition.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 44b1277e..e7641c9e 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -305,17 +305,36 @@ class Partition(): f.write("cd etc\n") f.write("rm fstab\n") f.write("write %s fstab\n" % (self.updated_fstab_path)) - if os.getenv('SOURCE_DATE_EPOCH'): - fstab_time = int(os.getenv('SOURCE_DATE_EPOCH')) - for time in ["atime", "mtime", "ctime"]: - f.write("set_inode_field fstab %s %s\n" % (time, hex(fstab_time))) - f.write("set_inode_field fstab %s_extra 0\n" % (time)) debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs) exec_native_cmd(debugfs_cmd, native_sysroot) mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs) exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) + if os.getenv('SOURCE_DATE_EPOCH'): + sde_time = hex(int(os.getenv('SOURCE_DATE_EPOCH'))) + debugfs_script_path = os.path.join(cr_workdir, "debugfs_script") + files = [] + for root, dirs, others in os.walk(rootfs_dir): + base = root.replace(rootfs_dir, "").rstrip(os.sep) + files += [ "/" if base == "" else base ] + files += [ base + "/" + n for n in dirs + others ] + with open(debugfs_script_path, "w") as f: + f.write("set_current_time %s\n" % (sde_time)) + if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update: + f.write("set_inode_field /etc/fstab mtime %s\n" % (sde_time)) + f.write("set_inode_field /etc/fstab mtime_extra 0\n") + for file in set(files): + for time in ["atime", "ctime", "crtime"]: + f.write("set_inode_field \"%s\" %s %s\n" % (file, time, sde_time)) + f.write("set_inode_field \"%s\" %s_extra 0\n" % (file, time)) + for time in ["wtime", "mkfs_time", "lastcheck"]: + f.write("set_super_value %s %s\n" % (time, sde_time)) + for time in ["mtime", "first_error_time", "last_error_time", "kbytes_written"]: + f.write("set_super_value %s 0\n" % (time)) + debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs) + exec_native_cmd(debugfs_cmd, native_sysroot) + self.check_for_Y2038_problem(rootfs, native_sysroot) def prepare_rootfs_btrfs(self, rootfs, cr_workdir, oe_builddir, rootfs_dir,