scripts: support targets without the user partiton 44/301844/2
authorŁukasz Stelmach <l.stelmach@samsung.com>
Fri, 24 Nov 2023 10:50:48 +0000 (11:50 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 27 Nov 2023 01:53:16 +0000 (01:53 +0000)
x86 emulator images do not ship user partition. Therefore
there is no point in doing all the size calculations required
for other targets.

Change-Id: Ia59156c653695cc9067e9f971a7b4dcaa8af9d71
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
scripts/tizen/sd_fusing.py

index 7cd72be..3952681 100755 (executable)
@@ -96,13 +96,16 @@ class SdFusingTarget:
         self.with_super = False
         self.device = device
         total_size = device_size(device)
-        self.user_size = total_size - self.reserved_space - \
-            reduce(lambda x, y: x + (y["size"] or 0), self.part_table, 0)
-        if self.user_size < 100:
-            logging.error(f"Not enough space for user data ({self.user_size}). Use larger storage.")
-            raise OSError(errno.ENOSPC, os.strerror(errno.ENOSPC), device)
-        # self.user_partition counts from 0
-        self.part_table[self.user_partition]["size"] = self.user_size
+
+        if hasattr(self, 'user_partition'):
+            self.user_size = total_size - self.reserved_space - \
+                reduce(lambda x, y: x + (y["size"] or 0), self.part_table, 0)
+            if self.user_size < 100:
+                logging.error(f"Not enough space for user data ({self.user_size}). Use larger storage.")
+                raise OSError(errno.ENOSPC, os.strerror(errno.ENOSPC), device)
+            # self.user_partition counts from 0
+            self.part_table[self.user_partition]["size"] = self.user_size
+
         self.label = Label(self.part_table, ltype)
         self.binaries = self._get_binaries('binaries')