diff options
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/imager/direct.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 123a07817b..edf5e5d221 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py | |||
@@ -315,7 +315,7 @@ class DirectImageCreator(BaseImageCreator): | |||
315 | % (disk_name, full_path, disk['min_size'])) | 315 | % (disk_name, full_path, disk['min_size'])) |
316 | disk_obj = DiskImage(full_path, disk['min_size']) | 316 | disk_obj = DiskImage(full_path, disk['min_size']) |
317 | self.__disks[disk_name] = disk_obj | 317 | self.__disks[disk_name] = disk_obj |
318 | self.__image.add_disk(disk_name, disk_obj) | 318 | self.__image.add_disk(disk_name, disk_obj, disk_ids.get(disk_name)) |
319 | 319 | ||
320 | self.__image.create() | 320 | self.__image.create() |
321 | 321 | ||
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index 8d93a68e3a..cb03009fc7 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py | |||
@@ -68,15 +68,17 @@ class Image(): | |||
68 | 'offset': 0, # Offset of next partition (in sectors) | 68 | 'offset': 0, # Offset of next partition (in sectors) |
69 | # Minimum required disk size to fit all partitions (in bytes) | 69 | # Minimum required disk size to fit all partitions (in bytes) |
70 | 'min_size': 0, | 70 | 'min_size': 0, |
71 | 'ptable_format': "msdos"} # Partition table format | 71 | 'ptable_format': "msdos", # Partition table format |
72 | 'identifier': None} # Disk system identifier | ||
72 | 73 | ||
73 | def add_disk(self, disk_name, disk_obj): | 74 | def add_disk(self, disk_name, disk_obj, identifier): |
74 | """ Add a disk object which have to be partitioned. More than one disk | 75 | """ Add a disk object which have to be partitioned. More than one disk |
75 | can be added. In case of multiple disks, disk partitions have to be | 76 | can be added. In case of multiple disks, disk partitions have to be |
76 | added for each disk separately with 'add_partition()". """ | 77 | added for each disk separately with 'add_partition()". """ |
77 | 78 | ||
78 | self.__add_disk(disk_name) | 79 | self.__add_disk(disk_name) |
79 | self.disks[disk_name]['disk'] = disk_obj | 80 | self.disks[disk_name]['disk'] = disk_obj |
81 | self.disks[disk_name]['identifier'] = identifier | ||
80 | 82 | ||
81 | def __add_partition(self, part): | 83 | def __add_partition(self, part): |
82 | """ This is a helper function for 'add_partition()' which adds a | 84 | """ This is a helper function for 'add_partition()' which adds a |
@@ -245,6 +247,12 @@ class Image(): | |||
245 | (disk['disk'].device, disk['ptable_format']), | 247 | (disk['disk'].device, disk['ptable_format']), |
246 | self.native_sysroot) | 248 | self.native_sysroot) |
247 | 249 | ||
250 | if disk['identifier']: | ||
251 | msger.debug("Set disk identifier %x" % disk['identifier']) | ||
252 | with open(disk['disk'].device, 'r+b') as img: | ||
253 | img.seek(0x1B8) | ||
254 | img.write(disk['identifier'].to_bytes(4, 'little')) | ||
255 | |||
248 | msger.debug("Creating partitions") | 256 | msger.debug("Creating partitions") |
249 | 257 | ||
250 | for part in self.partitions: | 258 | for part in self.partitions: |