diff options
author | Artur Mądrzak <artur@madrzak.eu> | 2017-11-08 12:04:09 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-12-04 17:23:54 +0000 |
commit | 67094521712fa85138e216bb05876fd0c6161598 (patch) | |
tree | cbb3b23f355dbbb4874b826f743332c5ec8789be /scripts/lib | |
parent | f7b90ab3eaf832bd81f3efc1dab4dcf6863ac284 (diff) | |
download | poky-67094521712fa85138e216bb05876fd0c6161598.tar.gz |
wic: add 'part-name' argument for naming GPT partitions
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.
(From OE-Core rev: 45aee3d57697f8dcc967120b5afd280d5ceadd21)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/help.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/ksparser.py | 1 | ||||
-rw-r--r-- | scripts/lib/wic/partition.py | 1 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/imager/direct.py | 11 |
4 files changed, 15 insertions, 0 deletions
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index bd9c62e2e8..2ac45e052e 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py | |||
@@ -970,6 +970,8 @@ DESCRIPTION | |||
970 | This option cannot be used with --fixed-size | 970 | This option cannot be used with --fixed-size |
971 | option. | 971 | option. |
972 | 972 | ||
973 | --part-name: This option is specific to wic. It specifies name for GPT partitions. | ||
974 | |||
973 | --part-type: This option is specific to wic. It specifies partition | 975 | --part-type: This option is specific to wic. It specifies partition |
974 | type GUID for GPT partitions. | 976 | type GUID for GPT partitions. |
975 | List of partition type GUIDS can be found here: | 977 | List of partition type GUIDS can be found here: |
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 99b66eebc5..7850e81d2f 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py | |||
@@ -144,6 +144,7 @@ class KickStart(): | |||
144 | part.add_argument('--no-table', action='store_true') | 144 | part.add_argument('--no-table', action='store_true') |
145 | part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda') | 145 | part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda') |
146 | part.add_argument("--overhead-factor", type=overheadtype) | 146 | part.add_argument("--overhead-factor", type=overheadtype) |
147 | part.add_argument('--part-name') | ||
147 | part.add_argument('--part-type') | 148 | part.add_argument('--part-type') |
148 | part.add_argument('--rootfs-dir') | 149 | part.add_argument('--rootfs-dir') |
149 | 150 | ||
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index b623bb9e6d..66e61ba70c 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py | |||
@@ -51,6 +51,7 @@ class Partition(): | |||
51 | self.no_table = args.no_table | 51 | self.no_table = args.no_table |
52 | self.num = None | 52 | self.num = None |
53 | self.overhead_factor = args.overhead_factor | 53 | self.overhead_factor = args.overhead_factor |
54 | self.part_name = args.part_name | ||
54 | self.part_type = args.part_type | 55 | self.part_type = args.part_type |
55 | self.rootfs_dir = args.rootfs_dir | 56 | self.rootfs_dir = args.rootfs_dir |
56 | self.size = args.size | 57 | self.size = args.size |
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 60317eed22..bdb8385620 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py | |||
@@ -366,6 +366,10 @@ class PartitionedImage(): | |||
366 | for num in range(len(self.partitions)): | 366 | for num in range(len(self.partitions)): |
367 | part = self.partitions[num] | 367 | part = self.partitions[num] |
368 | 368 | ||
369 | if self.ptable_format == 'msdos' and part.part_name: | ||
370 | raise WicError("setting custom partition name is not " \ | ||
371 | "implemented for msdos partitions") | ||
372 | |||
369 | if self.ptable_format == 'msdos' and part.part_type: | 373 | if self.ptable_format == 'msdos' and part.part_type: |
370 | # The --part-type can also be implemented for MBR partitions, | 374 | # The --part-type can also be implemented for MBR partitions, |
371 | # in which case it would map to the 1-byte "partition type" | 375 | # in which case it would map to the 1-byte "partition type" |
@@ -519,6 +523,13 @@ class PartitionedImage(): | |||
519 | self._create_partition(self.path, part.type, | 523 | self._create_partition(self.path, part.type, |
520 | parted_fs_type, part.start, part.size_sec) | 524 | parted_fs_type, part.start, part.size_sec) |
521 | 525 | ||
526 | if part.part_name: | ||
527 | logger.debug("partition %d: set name to %s", | ||
528 | part.num, part.part_name) | ||
529 | exec_native_cmd("sgdisk --change-name=%d:%s %s" % \ | ||
530 | (part.num, part.part_name, | ||
531 | self.path), self.native_sysroot) | ||
532 | |||
522 | if part.part_type: | 533 | if part.part_type: |
523 | logger.debug("partition %d: set type UID to %s", | 534 | logger.debug("partition %d: set type UID to %s", |
524 | part.num, part.part_type) | 535 | part.num, part.part_type) |