[elbe-devel] [PATCH] hdimg: use correct size prefix for specifying partition sizes

Kurt Kanzenbach kurt at linutronix.de
Wed Jul 5 15:52:50 CEST 2017


I've just stumbled across an interesting issue: For partition sizes elbe uses
kiB as size prefix. If you try to use KiB, the XML schema validation fails.

However for specifying the physical erase block (PEB) size for UBI images you
have to use KiB as prefix. Using kiB results in a error when elbe invokes
ubinize (at the end of the Elbe-Build). This way I ended up using KiB for PEB
size and using kiB for UBI volume sizes in the same XML file.

Regarding to IEC standard, KiB is actually correct. This patch adjusts the hdimg
code and the XML schema accordingly.

Signed-off-by: Kurt Kanzenbach <kurt at linutronix.de>
---
 elbepack/hdimg.py | 2 +-
 schema/dbsfed.xsd | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index e2834e5..d8be13f 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -160,7 +160,7 @@ def size_to_int( size ):
     if size.endswith( "k" ):
         unit = 1000
         s = size[:-1]
-    elif size.endswith( "kiB" ):
+    elif size.endswith( "KiB" ):
         unit = 1024
         s = size[:-3]
     elif size.endswith( "kB" ):
diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
index 74eb732..49c882f 100644
--- a/schema/dbsfed.xsd
+++ b/schema/dbsfed.xsd
@@ -1523,7 +1523,7 @@
       </documentation>
     </annotation>
     <restriction base="string">
-      <pattern value="(\d+(k|M|G|kB|MB|GB|kiB|MiB|GiB)?|remain)" />
+      <pattern value="(\d+(k|M|G|kB|MB|GB|KiB|MiB|GiB)?|remain)" />
     </restriction>
   </simpleType>
 
-- 
2.11.0





More information about the elbe-devel mailing list