Skip to contentSkip to conversation

wic: allow sizes to be specified in sectors

PATCH In review Trevor Woerner 1 participant 2 messages Feb 17, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wic: allow sizes to be specified in sectors

The partition layout of boot devices for some SBCs (e.g. Rockchip[1]) are specified in multiples of sectors (which are multiples of 512 bytes, instead of 1024). Therefore allow wic to understand partition sizing specified in sectors as well.

[1] https://opensource.rock-chips.com/wiki_Partitions

---
 scripts/lib/wic/ksparser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/lib/wic/ksparser.py +2 -2
index 7ef3dc83ddce..35681bdc8d13 100644
@@ -178,8 +178,8 @@ class KickStart():
         # --error, but since nesting mutually exclusive groups does not work,
         # ----extra-space/--overhead-factor are handled later
         sizeexcl = part.add_mutually_exclusive_group()
-        sizeexcl.add_argument('--size', type=sizetype("M"), default=0)
-        sizeexcl.add_argument('--fixed-size', type=sizetype("M"), default=0)
+        sizeexcl.add_argument('--size', type=sizetype("M", True), default=0)
+        sizeexcl.add_argument('--fixed-size', type=sizetype("M", True), default=0)
 
         part.add_argument('--source')
         part.add_argument('--sourceparams')
Signature · 1 line
2.43.0.76.g1a87c842ece3
#1 lore raw

Sorry, please ignore.

The assumption that everything is a multiple of 1024 runs very deep throughout wic and is hard-coded in too many places for a patch this simple to work.

Quoted 30 lines · Trevor Woerner

The partition layout of boot devices for some SBCs (e.g. Rockchip[1]) are specified in multiples of sectors (which are multiples of 512 bytes, instead of 1024). Therefore allow wic to understand partition sizing specified in sectors as well.

[1] https://opensource.rock-chips.com/wiki_Partitions

---
 scripts/lib/wic/ksparser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/lib/wic/ksparser.py +2 -2
index 7ef3dc83ddce..35681bdc8d13 100644
@@ -178,8 +178,8 @@ class KickStart():
         # --error, but since nesting mutually exclusive groups does not work,
         # ----extra-space/--overhead-factor are handled later
         sizeexcl = part.add_mutually_exclusive_group()
-        sizeexcl.add_argument('--size', type=sizetype("M"), default=0)
-        sizeexcl.add_argument('--fixed-size', type=sizetype("M"), default=0)
+        sizeexcl.add_argument('--size', type=sizetype("M", True), default=0)
+        sizeexcl.add_argument('--fixed-size', type=sizetype("M", True), default=0)
 
         part.add_argument('--source')
         part.add_argument('--sourceparams')
Signature · 1 line
2.43.0.76.g1a87c842ece3