diff options
author | Kevin Hao <kexin.hao@windriver.com> | 2018-09-12 08:44:46 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-09-13 07:42:28 +0100 |
commit | 821711bf2edc3d2eb5a695653ff5d439f43520be (patch) | |
tree | 6083410a9373b1c0235c58521bd59ef5076bdad0 /scripts/lib | |
parent | 92bc2b3e84f71871878ae6137ae08af7cb981ed0 (diff) | |
download | poky-821711bf2edc3d2eb5a695653ff5d439f43520be.tar.gz |
wic: Introduce the --use-label partition parameter
We can use this parameter to make the wic use the label to name a
partition in /etc/fstab.
(From OE-Core rev: 51638edaa00befaed58e2def255d46ae44d9234f)
Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/help.py | 18 | ||||
-rw-r--r-- | scripts/lib/wic/ksparser.py | 14 | ||||
-rw-r--r-- | scripts/lib/wic/partition.py | 1 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/imager/direct.py | 2 |
4 files changed, 28 insertions, 7 deletions
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index 842b868a57..64f08052c7 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py | |||
@@ -866,11 +866,11 @@ DESCRIPTION | |||
866 | Partitions with a <mountpoint> specified will be automatically mounted. | 866 | Partitions with a <mountpoint> specified will be automatically mounted. |
867 | This is achieved by wic adding entries to the fstab during image | 867 | This is achieved by wic adding entries to the fstab during image |
868 | generation. In order for a valid fstab to be generated one of the | 868 | generation. In order for a valid fstab to be generated one of the |
869 | --ondrive, --ondisk or --use-uuid partition options must be used for | 869 | --ondrive, --ondisk, --use-uuid or --use-label partition options must |
870 | each partition that specifies a mountpoint. Note that with --use-uuid | 870 | be used for each partition that specifies a mountpoint. Note that with |
871 | and non-root <mountpoint>, including swap, the mount program must | 871 | --use-{uuid,label} and non-root <mountpoint>, including swap, the mount |
872 | understand the PARTUUID syntax. This currently excludes the busybox | 872 | program must understand the PARTUUID or LABEL syntax. This currently |
873 | versions of these applications. | 873 | excludes the busybox versions of these applications. |
874 | 874 | ||
875 | 875 | ||
876 | The following are supported 'part' options: | 876 | The following are supported 'part' options: |
@@ -945,6 +945,14 @@ DESCRIPTION | |||
945 | label is already in use by another filesystem, | 945 | label is already in use by another filesystem, |
946 | a new label is created for the partition. | 946 | a new label is created for the partition. |
947 | 947 | ||
948 | --use-label: This option is specific to wic. It makes wic to use the | ||
949 | label in /etc/fstab to specify a partition. If the | ||
950 | --use-label and --use-uuid are used at the same time, | ||
951 | we prefer the uuid because it is less likely to cause | ||
952 | name confliction. We don't support using this parameter | ||
953 | on the root partition since it requires an initramfs to | ||
954 | parse this value and we do not currently support that. | ||
955 | |||
948 | --active: Marks the partition as active. | 956 | --active: Marks the partition as active. |
949 | 957 | ||
950 | --align (in KBytes): This option is specific to wic and says | 958 | --align (in KBytes): This option is specific to wic and says |
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index a5d29189b9..7e5a9c5092 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py | |||
@@ -141,6 +141,7 @@ class KickStart(): | |||
141 | 'squashfs', 'vfat', 'msdos', 'swap')) | 141 | 'squashfs', 'vfat', 'msdos', 'swap')) |
142 | part.add_argument('--mkfs-extraopts', default='') | 142 | part.add_argument('--mkfs-extraopts', default='') |
143 | part.add_argument('--label') | 143 | part.add_argument('--label') |
144 | part.add_argument('--use-label', action='store_true') | ||
144 | part.add_argument('--no-table', action='store_true') | 145 | part.add_argument('--no-table', action='store_true') |
145 | part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda') | 146 | part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda') |
146 | part.add_argument("--overhead-factor", type=overheadtype) | 147 | part.add_argument("--overhead-factor", type=overheadtype) |
@@ -197,8 +198,17 @@ class KickStart(): | |||
197 | (confpath, lineno, err)) | 198 | (confpath, lineno, err)) |
198 | if line.startswith('part'): | 199 | if line.startswith('part'): |
199 | # SquashFS does not support filesystem UUID | 200 | # SquashFS does not support filesystem UUID |
200 | if parsed.fstype == 'squashfs' and parsed.fsuuid: | 201 | if parsed.fstype == 'squashfs': |
201 | err = "%s:%d: SquashFS does not support UUID" \ | 202 | if parsed.fsuuid: |
203 | err = "%s:%d: SquashFS does not support UUID" \ | ||
204 | % (confpath, lineno) | ||
205 | raise KickStartError(err) | ||
206 | if parsed.label: | ||
207 | err = "%s:%d: SquashFS does not support LABEL" \ | ||
208 | % (confpath, lineno) | ||
209 | raise KickStartError(err) | ||
210 | if parsed.use_label and not parsed.label: | ||
211 | err = "%s:%d: Must set the label with --label" \ | ||
202 | % (confpath, lineno) | 212 | % (confpath, lineno) |
203 | raise KickStartError(err) | 213 | raise KickStartError(err) |
204 | # using ArgumentParser one cannot easily tell if option | 214 | # using ArgumentParser one cannot easily tell if option |
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 5054779b1b..3da7e23e61 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py | |||
@@ -47,6 +47,7 @@ class Partition(): | |||
47 | self.fsopts = args.fsopts | 47 | self.fsopts = args.fsopts |
48 | self.fstype = args.fstype | 48 | self.fstype = args.fstype |
49 | self.label = args.label | 49 | self.label = args.label |
50 | self.use_label = args.use_label | ||
50 | self.mkfs_extraopts = args.mkfs_extraopts | 51 | self.mkfs_extraopts = args.mkfs_extraopts |
51 | self.mountpoint = args.mountpoint | 52 | self.mountpoint = args.mountpoint |
52 | self.no_table = args.no_table | 53 | self.no_table = args.no_table |
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 81583e97b9..bb14a334b2 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py | |||
@@ -155,6 +155,8 @@ class DirectPlugin(ImagerPlugin): | |||
155 | device_name = "UUID=%s" % part.fsuuid | 155 | device_name = "UUID=%s" % part.fsuuid |
156 | else: | 156 | else: |
157 | device_name = "PARTUUID=%s" % part.uuid | 157 | device_name = "PARTUUID=%s" % part.uuid |
158 | elif part.use_label: | ||
159 | device_name = "LABEL=%s" % part.label | ||
158 | else: | 160 | else: |
159 | # mmc device partitions are named mmcblk0p1, mmcblk0p2.. | 161 | # mmc device partitions are named mmcblk0p1, mmcblk0p2.. |
160 | prefix = 'p' if part.disk.startswith('mmcblk') else '' | 162 | prefix = 'p' if part.disk.startswith('mmcblk') else '' |