From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Adithya Balakumar <adithya.balakumar@toshiba-tsip.com>
Cc: openembedded-core@lists.openembedded.org,
shivanand.kunijadar@toshiba-tsip.com,
sai.sathujoda@toshiba-tsip.com, dinesh.kumar@toshiba-tsip.com,
kazuhiro3.hayashi@toshiba.co.jp, jan.kiszka@siemens.com
Subject: Re: [OE-Core][PATCH v1] wic: implement reproducible Disk GUID
Date: Fri, 26 Jan 2024 15:22:38 +0100 [thread overview]
Message-ID: <20240126142238d9357689@mail.local> (raw)
In-Reply-To: <20240122122521.2605264-1-Adithya.Balakumar@toshiba-tsip.com>
Hello,
This causes oe-selftest failures:
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/6342/steps/15/logs/stdio
2024-01-25 02:21:53,130 - oe-selftest - INFO - RESULTS - runqemu.RunqemuTests.test_boot_machine_slirp_qcow2: ERROR (1028.13s)
2024-01-25 02:21:53,131 - oe-selftest - INFO - RESULTS - runqemu.RunqemuTests.test_boot_recipe_image_vdi: ERROR (1031.11s)
2024-01-25 02:21:53,131 - oe-selftest - INFO - RESULTS - runqemu.RunqemuTests.test_boot_recipe_image_vmdk: ERROR (1075.13s)
2024-01-25 02:21:53,131 - oe-selftest - INFO - RESULTS - wic.Wic2.test_biosplusefi_plugin_qemu: ERROR (1037.31s)
2024-01-25 02:21:53,131 - oe-selftest - INFO - RESULTS - wic.Wic2.test_efi_plugin_unified_kernel_image_qemu: ERROR (1953.51s)
2024-01-25 02:21:53,131 - oe-selftest - INFO - RESULTS - wic.Wic2.test_rawcopy_plugin_qemu: ERROR (1187.55s)
On 22/01/2024 17:55:21+0530, Adithya Balakumar wrote:
> From: Adithya Balakumar <adithya.balakumar@toshiba-tsip.com>
>
> GPT based disks have a disk guid apart from the 32-bit disk identifier.
> This commit implements reproducible disk guid by using SOURCE_DATE_EPOCH (if available) value as a random seed
>
> Signed-off-by: Adithya Balakumar <adithya.balakumar@toshiba-tsip.com>
> ---
> scripts/lib/wic/plugins/imager/direct.py | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> index 9b619e41c1..d0f8481c2e 100644
> --- a/scripts/lib/wic/plugins/imager/direct.py
> +++ b/scripts/lib/wic/plugins/imager/direct.py
> @@ -530,6 +530,21 @@ class PartitionedImage():
> exec_native_cmd("parted -s %s mklabel %s" % (device, ptable_format),
> self.native_sysroot)
>
> + def _write_disk_guid(self):
> + if os.getenv('SOURCE_DATE_EPOCH'):
> + if self.ptable_format in ('gpt', 'gpt-hybrid'):
> + self.disk_guid = uuid.UUID(int=int(os.getenv('SOURCE_DATE_EPOCH')))
> + elif self.ptable_format == "msdos":
> + self.disk_guid = '0x' + str(uuid.UUID(int=int(os.getenv('SOURCE_DATE_EPOCH'))).int & 0xFFFFFFFF)[:8]
> + else:
> + if self.ptable_format in ('gpt', 'gpt-hybrid'):
> + self.disk_guid = uuid.uuid4()
> + elif self.ptable_format == "msdos":
> + self.disk_guid = '0x' + str(uuid.uuid4())[:8]
> +
> + logger.debug("Set disk guid %s", self.disk_guid)
> + sfdisk_cmd = "sfdisk --disk-id %s %s" % (self.path, self.disk_guid)
> + exec_native_cmd(sfdisk_cmd, self.native_sysroot)
>
> def create(self):
> self._make_disk(self.path,
> @@ -537,6 +552,7 @@ class PartitionedImage():
> self.min_size)
>
> self._write_identifier(self.path, self.identifier)
> + self._write_disk_guid()
>
> if self.ptable_format == "gpt-hybrid":
> mbr_path = self.path + ".mbr"
> --
> 2.39.2
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#194145): https://lists.openembedded.org/g/openembedded-core/message/194145
> Mute This Topic: https://lists.openembedded.org/mt/103884949/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2024-01-26 14:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 12:25 [OE-Core][PATCH v1] wic: implement reproducible Disk GUID Adithya Balakumar
2024-01-26 14:22 ` Alexandre Belloni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240126142238d9357689@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=adithya.balakumar@toshiba-tsip.com \
--cc=dinesh.kumar@toshiba-tsip.com \
--cc=jan.kiszka@siemens.com \
--cc=kazuhiro3.hayashi@toshiba.co.jp \
--cc=openembedded-core@lists.openembedded.org \
--cc=sai.sathujoda@toshiba-tsip.com \
--cc=shivanand.kunijadar@toshiba-tsip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox