From patchwork Fri Nov 29 12:50:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adithya Balakumar X-Patchwork-Id: 3969 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Fri, 29 Nov 2024 13:44:53 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-oo1-f62.google.com (mail-oo1-f62.google.com [209.85.161.62]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 4ATCipfx025213 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 29 Nov 2024 13:44:52 +0100 Received: by mail-oo1-f62.google.com with SMTP id 006d021491bc7-5f1d5f7afd4sf1265765eaf.0 for ; Fri, 29 Nov 2024 04:44:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1732884286; cv=pass; d=google.com; s=arc-20240605; b=SmbFerTflbS9FAd1CaKsEECVUk/jlESE/UljaOtwISYfWI9PsrUix2WPOTeiCsc8GP pEXB5Fqdqo8dj/QGWlqwcsrt2WlvW2fZiJajGaFqaifLwADJ/scuEjKWyQA2AK+suvsf rIxUCgZ5pjSyqH+Zo6cILpY2gQEq50F7gooEZNRLFgnAr7Wrj0//hyO9RxytFj7c+Zfv lZ/Kuc3Eh4z7yEsB8S4Jf7Bz2KbaQ75L2iYfxxpRFRK+Qj0ejC6PbGc0N1GhgX3KMDDG +gWMwwSy2sJuZkLZVroAKdABMTuOnDfRk4+MEPCCpT7JFaYv0HMJEg+StwGNPMq+6pHU lHeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=X1g8daFg+Lfg7hs/Dw/Opx9jVB9OhKsrQwXq9UotBsc=; fh=7eO7h+nG3gcwGiNY8AbXZvfN/qRUzwme76YRgmKSZvE=; b=S9eOjbT3q+PiWr52ZCZo5rLU68VvUAmQ8VV9dsgBoTUK3s6yjz/OuV8AuvW/cygTQ4 LECeyK9gIj9wO34OXAO8j9chfiEb20y7YUkzt6w8cqVMLtCLT2o6HGVjnTQMQUbJV2U8 SmagE8sw1Rl9cWE57NblFhR+FA0SLW7ElByn3v1z4kXX8GDAW4YdvMkCx/OWA9R/AnJf oRwR0KI2gKmETGpzzsJ2RG72TCX6jzeayHNzUUpdmtkSZkwICQ6kHQqAuP760s1zFUfp pBPqZ8l0mxPvsjkD3YKftLoyQ8iBtJfcgX6UgT0W2vpl+Mu5H1iIEByeGEqSmRwefPGU oocQ==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of adithya.balakumar@toshiba-tsip.com designates 210.130.202.135 as permitted sender) smtp.mailfrom=Adithya.Balakumar@toshiba-tsip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1732884286; x=1733489086; 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=X1g8daFg+Lfg7hs/Dw/Opx9jVB9OhKsrQwXq9UotBsc=; b=BwWZa+jezFXhO42kZEsGUojTW1E2jS5MpRctRBNIEPJTjLnnvOa9TUu/ZJoUL44pGN Ye/OWn57ma57NFjIDpkbRxvpINx4RQmiJeL99sQM4EN9y9VJu8R/Va8v7dvkY21iCbhr oCAsMwS7QRvQ9n2kxWch7v4ppH3q+ko6MmQ8YmY0FP5SizMREiMgCVxZ4TVU/OauQv/f 8e3PRW35TQHIMR2rIUw+4j3vQcArRNK1YvKQBOsz7UYVj7WM67NAxLA1MWf9z1Q0/GJK Mt2qmTvtboxsVCi66e1URkKpEQSHs9yTGn0hbpJDLgWn14Ey8pI7GwyBbzkLvT4S+h7j 67Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732884286; x=1733489086; 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=X1g8daFg+Lfg7hs/Dw/Opx9jVB9OhKsrQwXq9UotBsc=; b=KVmWhYpPLtPwMtJdG/7ULnTu96D0pciYA+hnkgnuDto7OJkXasx8xQe4iZ/vW5Gc7n 2sNNl2DGaF93QXJ5MwBK0IHZetcFUvIpZT23BYC4EU2fZwERqaHJw9BRLf9gowTHAn5F Gev2pj1mha7lK2Yxmfa7p1VQNICOrJvxMR8Pb4KJRzkJp2SMmDNNKY0ydDHgS4ZUmVny WIVG3mU8MBROckdQe00DUXg18Jb12RGz3F4H+y7Ht/DKems738wKrzXJuBZ6hjKgiq3F QtUvtqNtdybI9GRRvcvfCdXX73BayNOLsx5TQ4oScAWQLC/dGmxhUWGBuFegH3xSRdIa llmw== Sender: isar-users@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCUm0Fdw2B8pu9rtHpz+JyC90lk6K/16BEJe6bFkGTf99hsS/rhk/LqTvnpgrF7ialopNjbQjNY=@isar-build.org X-Gm-Message-State: AOJu0YydguttujN7iyVLiyt+Z5t4s9tMYicryZqxRgiWlKO+c7zoaH7+ 7KwpG5yvdF9NfERC1kyuqWjfUKHdGlk6JQY2tiPk+OKmjHbMCRQ8 X-Google-Smtp-Source: AGHT+IGHdS73BzEkq4ijZtv7wxDbO1aPGuQ0av8NlOAcNo1tpu80hErkZD8y+1CA4JgXCAzsUKaQFw== X-Received: by 2002:a05:6820:50e:b0:5f1:dc89:fa85 with SMTP id 006d021491bc7-5f2179fa1eemr4176770eaf.3.1732884286253; Fri, 29 Nov 2024 04:44:46 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6820:1ac1:b0:5f1:f4ba:6313 with SMTP id 006d021491bc7-5f217b38f05ls740361eaf.2.-pod-prod-00-us; Fri, 29 Nov 2024 04:44:45 -0800 (PST) X-Received: by 2002:a05:6808:221d:b0:3e7:e8dd:5bcc with SMTP id 5614622812f47-3ea8156cd53mr3849783b6e.20.1732884285388; Fri, 29 Nov 2024 04:44:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732884285; cv=none; d=google.com; s=arc-20240605; b=ROlom2exiM/L+JxMtKfvLot2BbgglbPE0JBc9ADauqMaeRuKQH56HrYEPhKf0KvqvX /E2rReqyh7h4/3z2B/PENCJyIwCTYNlgFt2hiwRJKUu1XVHhzBVLXHRFvsIUvXNWRMhB hFdrMls5FG81TCGg78vys/gdF+a368+K02Lb4zpcUtFJFBp8YsL+2q9PD8umhROpAq5c X1NePHfYdTL5qk1E+uVkkzBLTHAvWaIR8WchmUZbC3W4kvceUG02s+N6wdROZAmCNaBT FilY3WTyfkE5gOw2HL9Aczw6vNNy+EtaFCUWpiSjNyscwBWZnCicV8K1dg8Uqmw3y9iF nBfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=gw8denxX8GseEhmDBt8X99EOEE2baspC44rh0lyRviY=; fh=95wLIF1hw/zIpqq2Ec+GyUgTsRZ8XfjQM59TjRw6kJk=; b=fHXvdCsEgq+ZvcntGz+WBkRdylL38Pg8unzo78PWHyWggYkTcAViHJSfZ66+2LlShn NduUAVJOlY24QdOGqw2MRFbJV6NRfmOMH7VYSDmVIaeH/QEqjeVigZ9WqAsq60nchYi0 /Iawu+uewLSe0dJQwURD5t4LWlyqNI7nVFj/2SkmpVZjaPFYYjWo8yskIW73J9LhtpHQ OwizVrARdTAjRkVVOa0c3E8n/qGvQSQHZV8MSUNNTk6H6kXK+fBWT8QRdgWnLpomUAx1 WnSwsLf9KHkg7krfeclQv0GMPC3NDvQ88oUJipR282Dy64+ZKp64otajCjkaL9cve0h5 L4Dg==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of adithya.balakumar@toshiba-tsip.com designates 210.130.202.135 as permitted sender) smtp.mailfrom=Adithya.Balakumar@toshiba-tsip.com Received: from mo-csw.securemx.jp (mo-csw1801.securemx.jp. [210.130.202.135]) by gmr-mx.google.com with ESMTPS id 5614622812f47-3ea86604f08si158880b6e.4.2024.11.29.04.44.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2024 04:44:45 -0800 (PST) Received-SPF: pass (google.com: domain of adithya.balakumar@toshiba-tsip.com designates 210.130.202.135 as permitted sender) client-ip=210.130.202.135; Received: by mo-csw.securemx.jp (mx-mo-csw1801) id 4ATCigM22703418; Fri, 29 Nov 2024 21:44:42 +0900 X-Iguazu-Qid: 2yAafc7cGq10HwhoZM X-Iguazu-QSIG: v=2; s=0; t=1732884282; q=2yAafc7cGq10HwhoZM; m=2aDisgchDKrT/b2XwLbeJxM6CEfXCs83tXCH0WTU1MY= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1802) id 4ATCifQ31655566 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 29 Nov 2024 21:44:41 +0900 From: Adithya Balakumar To: isar-users@googlegroups.com Cc: jan.kiszka@siemens.com, kazuhiro3.hayashi@toshiba.co.jp, dinesh.kumar@toshiba-tsip.com, shivanand.kunijadar@toshiba-tsip.com, sai.sathujoda@toshiba-tsip.com, adithya.balakumar@toshiba-tsip.com Subject: [PATCH v1 1/1] imagetypes.bbclass: Generate reproducible ext4 images using IMAGE_CMD Date: Fri, 29 Nov 2024 18:20:40 +0530 X-TSB-HOP2: ON Message-Id: <20241129125040.1231947-2-Adithya.Balakumar@toshiba-tsip.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241129125040.1231947-1-Adithya.Balakumar@toshiba-tsip.com> References: <20241129125040.1231947-1-Adithya.Balakumar@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 29 Nov 2024 12:44:39.0693 (UTC) FILETIME=[748613D0:01DB425C] X-Original-Sender: adithya.balakumar@toshiba-tsip.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of adithya.balakumar@toshiba-tsip.com designates 210.130.202.135 as permitted sender) smtp.mailfrom=Adithya.Balakumar@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=-4.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE, 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?= e2fsprogs v1.47.1 added support for timestamp clamping to SOURCE_DATE_EPOCH to generate reproducible ext4 images. Along with the above, a deterministic uuid and hash_seed also needs to be set. Signed-off-by: Adithya Balakumar --- meta/classes/imagetypes.bbclass | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/meta/classes/imagetypes.bbclass b/meta/classes/imagetypes.bbclass index a3be0a1d..f802c11c 100644 --- a/meta/classes/imagetypes.bbclass +++ b/meta/classes/imagetypes.bbclass @@ -14,9 +14,30 @@ IMAGE_CMD:tar() { # image type: ext4 IMAGER_INSTALL:ext4 += "e2fsprogs" -MKE2FS_ARGS ?= "-t ext4" +# NOTE: Creating reproducible ext4 images requires timestamp clamping to SOURCE_DATE_EPOCH and deterministic uuid, hash_seed to be set. +# Timestamp clamping to SOURCE_DATE_EPOCH is only available from e2fsprogs v1.47.1 onwards. Older versions cannot generate reproducible ext4 images. +python set_mke2fs_args () { + import uuid + + mke2fs_args = "-t ext4" + sde_time = int(os.getenv('SOURCE_DATE_EPOCH')) + + # set uuid + fsuuid = uuid.UUID(int=sde_time) + mke2fs_args += " -U " + str(fsuuid) + + # set hash_seed + hash_seed = str(uuid.uuid5(fsuuid, str(sde_time))) + mke2fs_args += " -E hash_seed=" + hash_seed + + d.setVar("MKE2FS_ARGS", mke2fs_args) +} + +do_image_ext4[prefuncs] = "set_mke2fs_args" IMAGE_CMD:ext4() { + export E2FSPROGS_FAKE_TIME="${SOURCE_DATE_EPOCH}" + truncate -s ${ROOTFS_SIZE}K '${IMAGE_FILE_HOST}' ${SUDO_CHROOT} /sbin/mke2fs ${MKE2FS_ARGS} \