summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLee Chee Yang <chee.yang.lee@intel.com>2021-01-01 14:18:28 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-01-01 23:15:13 +0000
commit3fa6a47aeb24dacf3f3b5cb4d7bad763619baf54 (patch)
treebaa3c0e8a61f4afb7ff6d845c07f7b79a8c682db /scripts
parent0e80f238796ccbdea69142d1a421c306caa0f931 (diff)
downloadpoky-3fa6a47aeb24dacf3f3b5cb4d7bad763619baf54.tar.gz
wic/direct/kparser: ensure fsuuid for vfat and msdos align with format
vfat/msdos filesystem should have fsuuid in format 0xYYYYYYYY where "0x" in front follow with 8 hexadecimal number in uppercase. In wic, when using custom fsuuid for vfat/msdos partition in wks, it is able to set the value in any length, with or without leading "0x". This can cause fsuuid missaligned when fstab updates, fstab expect exactly 10 character fsuuid for vfat/msdos partition and all in uppercase. if custom fsuuid for vfat/msdos is set, check the length and format, error if it exceed the format size. Amend it so it is align with format 0xYYYYYYYY. This is done before image create and fstab update to ensure the fsuuid are same in all followup process. if custom fsuuid length less than expected, fill in "0". [YOCTO #14161] (From OE-Core rev: d9686ae511ef10a504becfd81bfe296b788e1456) Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/ksparser.py17
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py7
2 files changed, 24 insertions, 0 deletions
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 913e3283dc..3eb669da39 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -229,6 +229,23 @@ class KickStart():
229 err = "%s:%d: SquashFS does not support LABEL" \ 229 err = "%s:%d: SquashFS does not support LABEL" \
230 % (confpath, lineno) 230 % (confpath, lineno)
231 raise KickStartError(err) 231 raise KickStartError(err)
232 if parsed.fstype == 'msdos' or parsed.fstype == 'vfat':
233 if parsed.fsuuid:
234 if parsed.fsuuid.upper().startswith('0X'):
235 if len(parsed.fsuuid) > 10:
236 err = "%s:%d: fsuuid %s given in wks kickstart file " \
237 "exceeds the length limit for %s filesystem. " \
238 "It should be in the form of a 32 bit hexadecimal" \
239 "number (for example, 0xABCD1234)." \
240 % (confpath, lineno, parsed.fsuuid, parsed.fstype)
241 raise KickStartError(err)
242 elif len(parsed.fsuuid) > 8:
243 err = "%s:%d: fsuuid %s given in wks kickstart file " \
244 "exceeds the length limit for %s filesystem. " \
245 "It should be in the form of a 32 bit hexadecimal" \
246 "number (for example, 0xABCD1234)." \
247 % (confpath, lineno, parsed.fsuuid, parsed.fstype)
248 raise KickStartError(err)
232 if parsed.use_label and not parsed.label: 249 if parsed.use_label and not parsed.label:
233 err = "%s:%d: Must set the label with --label" \ 250 err = "%s:%d: Must set the label with --label" \
234 % (confpath, lineno) 251 % (confpath, lineno)
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 55db826e93..0ca67b77d5 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -343,6 +343,13 @@ class PartitionedImage():
343 part.fsuuid = '0x' + str(uuid.uuid4())[:8].upper() 343 part.fsuuid = '0x' + str(uuid.uuid4())[:8].upper()
344 else: 344 else:
345 part.fsuuid = str(uuid.uuid4()) 345 part.fsuuid = str(uuid.uuid4())
346 else:
347 #make sure the fsuuid for vfat/msdos align with format 0xYYYYYYYY
348 if part.fstype == 'vfat' or part.fstype == 'msdos':
349 if part.fsuuid.upper().startswith("0X"):
350 part.fsuuid = '0x' + part.fsuuid.upper()[2:].rjust(8,"0")
351 else:
352 part.fsuuid = '0x' + part.fsuuid.upper().rjust(8,"0")
346 353
347 def prepare(self, imager): 354 def prepare(self, imager):
348 """Prepare an image. Call prepare method of all image partitions.""" 355 """Prepare an image. Call prepare method of all image partitions."""