[elbe-devel] [PATCH v2] hdimg: Add support for specifying the first partition offset

Kurt Kanzenbach kurt at linutronix.de
Wed Jul 15 16:22:30 CEST 2020


The starting sector for the first partition in an msdos or gpt image is hard
coded to 2048. Depending on the image layout (bootloader, redundant bootloaders,
...) it makes sense to move that offset around. Introduce a new property to
allow that.

Suggested-by: Holger Dengler <dengler at linutronix.de>
Signed-off-by: Kurt Kanzenbach <kurt at linutronix.de>
---
 elbepack/hdimg.py |  4 +++-
 schema/dbsfed.xsd | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index 63410ee05d89..f7a49abf8cf7 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -432,7 +432,9 @@ def do_image_hd(hd, fslabel, target, grub_version, grub_fw_type=None):
     else:
         grub = grubinstaller_base()
 
-    current_sector = 2048
+    current_sector = size_to_int(hd.text("first_partition_sector",
+                                         default="2048"))
+
     for part in hd:
 
         if part.tag == "partition":
diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
index c7bae9be549c..49aada58bffa 100644
--- a/schema/dbsfed.xsd
+++ b/schema/dbsfed.xsd
@@ -1168,6 +1168,13 @@
           </documentation>
         </annotation>
       </element>
+      <element name="first_partition_sector" type="rfs:part_size" minOccurs="0" maxOccurs="1">
+        <annotation>
+          <documentation>
+            Starting sector for the first partition
+          </documentation>
+        </annotation>
+      </element>
       <element name="grub-install" type="rfs:string" minOccurs="0" maxOccurs="1">
         <annotation>
           <documentation>
@@ -1235,6 +1242,13 @@
           </documentation>
         </annotation>
       </element>
+      <element name="first_partition_sector" type="rfs:part_size" minOccurs="0" maxOccurs="1">
+        <annotation>
+          <documentation>
+            Starting sector for the first partition
+          </documentation>
+        </annotation>
+      </element>
       <element name="grub-install" type="rfs:string" minOccurs="0" maxOccurs="1">
         <annotation>
           <documentation>
-- 
2.20.1



More information about the elbe-devel mailing list