Linutronix / elbe

Embedded Linux Build Environment
https://elbe-rfs.org
GNU General Public License v3.0
165 stars 59 forks source link

No Partition Names - Only Labels #322

Closed martinsteih closed 2 years ago

martinsteih commented 2 years ago

Hi all,

Is there any chance to assign names to partitions? I am working with an stm32mp based board whose boot process depends on actual partition names, but I cannot figure out how to do this with Elbe.

martinsteih commented 2 years ago

I did fix the issue and it worked for me. If I get everything straight, it should only apply to gpt disks. Here are the changes I did:

diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index 696225925..0e6ebed72 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -331,11 +331,16 @@ def create_partition(

         fs = simple_fstype("fat32")
         ppart = parted.Partition(disk, ptype, fs, geometry=g)
+
         if disk.type != "gpt":
             ppart.setFlag(_ped.PARTITION_LBA)
     else:
         ppart = parted.Partition(disk, ptype, geometry=g)

+    if disk.type == "gpt" and \
+        part.text("label") in fslabel:
+        ppart.set_name(fslabel[part.text("label")].label)
+
     cons = parted.Constraint(exactGeom=g)
     disk.addPartition(ppart, cons)

Maybe, if it is not unwanted or deliberately left out, you may consider integrating it.