mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
wic: implement reproducible Disk GUID
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 (From OE-Core rev: 150e079589e207fe174d2dceb40cd8f3d3972c5a) Signed-off-by: Adithya Balakumar <Adithya.Balakumar@toshiba-tsip.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9c1d226fad
commit
e685773513
@@ -530,6 +530,16 @@ class PartitionedImage():
|
||||
exec_native_cmd("parted -s %s mklabel %s" % (device, ptable_format),
|
||||
self.native_sysroot)
|
||||
|
||||
def _write_disk_guid(self):
|
||||
if self.ptable_format in ('gpt', 'gpt-hybrid'):
|
||||
if os.getenv('SOURCE_DATE_EPOCH'):
|
||||
self.disk_guid = uuid.UUID(int=int(os.getenv('SOURCE_DATE_EPOCH')))
|
||||
else:
|
||||
self.disk_guid = uuid.uuid4()
|
||||
|
||||
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 +547,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"
|
||||
|
||||
Reference in New Issue
Block a user