]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: add 'part-name' argument for naming GPT partitions
authorArtur Mądrzak <artur@madrzak.eu>
Wed, 8 Nov 2017 11:04:09 +0000 (12:04 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 4 Dec 2017 17:14:17 +0000 (17:14 +0000)
The WIC's 'part' can now give a name for GPT partition in WKS file.
It's similar to '--label', but is naming partintions instead file systems.
It's required by some bootloaders to partitions have specified names.

Backport from master, without it WIC cannot be used on Qualcomm based machines.

Signed-off-by: Artur Mądrzak <artur@madrzak.eu>
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 9b60e3466ed7cff0cea10815851eb1304002eb52)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
scripts/lib/wic/help.py
scripts/lib/wic/ksparser.py
scripts/lib/wic/partition.py
scripts/lib/wic/plugins/imager/direct.py

index bd9c62e2e80326e94fa54e6f2ce49b5e751cec5b..2ac45e052ebe98008841c6611b0ea531658b375c 100644 (file)
@@ -970,6 +970,8 @@ DESCRIPTION
                             This option cannot be used with --fixed-size
                             option.
 
+         --part-name: This option is specific to wic. It specifies name for GPT partitions.
+
          --part-type: This option is specific to wic. It specifies partition
                       type GUID for GPT partitions.
                       List of partition type GUIDS can be found here:
index 99b66eebc590258c19d11b63914173e3a825e4dd..7850e81d2f37b4ccfe6ed7e77d5e8e31929da9ef 100644 (file)
@@ -144,6 +144,7 @@ class KickStart():
         part.add_argument('--no-table', action='store_true')
         part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda')
         part.add_argument("--overhead-factor", type=overheadtype)
+        part.add_argument('--part-name')
         part.add_argument('--part-type')
         part.add_argument('--rootfs-dir')
 
index b623bb9e6dc6348fc8e6780d3e30ce99a699ee0f..66e61ba70c936708886f5c3120624f3b4419ccbf 100644 (file)
@@ -51,6 +51,7 @@ class Partition():
         self.no_table = args.no_table
         self.num = None
         self.overhead_factor = args.overhead_factor
+        self.part_name = args.part_name
         self.part_type = args.part_type
         self.rootfs_dir = args.rootfs_dir
         self.size = args.size
index 60317eed227a9142210c1d28889f53b2e7d051c0..bdb83856203b583f0d4f0d68b002c24e098484e5 100644 (file)
@@ -366,6 +366,10 @@ class PartitionedImage():
         for num in range(len(self.partitions)):
             part = self.partitions[num]
 
+            if self.ptable_format == 'msdos' and part.part_name:
+                raise WicError("setting custom partition name is not " \
+                               "implemented for msdos partitions")
+
             if self.ptable_format == 'msdos' and part.part_type:
                 # The --part-type can also be implemented for MBR partitions,
                 # in which case it would map to the 1-byte "partition type"
@@ -519,6 +523,13 @@ class PartitionedImage():
             self._create_partition(self.path, part.type,
                                    parted_fs_type, part.start, part.size_sec)
 
+            if part.part_name:
+                logger.debug("partition %d: set name to %s",
+                             part.num, part.part_name)
+                exec_native_cmd("sgdisk --change-name=%d:%s %s" % \
+                                         (part.num, part.part_name,
+                                          self.path), self.native_sysroot)
+
             if part.part_type:
                 logger.debug("partition %d: set type UID to %s",
                              part.num, part.part_type)