1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-04 02:00:04 +00:00

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>
This commit is contained in:
Kevin Hao
2018-09-12 08:44:46 +08:00
committed by Richard Purdie
parent 92bc2b3e84
commit 821711bf2e
4 changed files with 28 additions and 7 deletions
+13 -5
View File
@@ -866,11 +866,11 @@ DESCRIPTION
Partitions with a <mountpoint> specified will be automatically mounted. Partitions with a <mountpoint> specified will be automatically mounted.
This is achieved by wic adding entries to the fstab during image This is achieved by wic adding entries to the fstab during image
generation. In order for a valid fstab to be generated one of the generation. In order for a valid fstab to be generated one of the
--ondrive, --ondisk or --use-uuid partition options must be used for --ondrive, --ondisk, --use-uuid or --use-label partition options must
each partition that specifies a mountpoint. Note that with --use-uuid be used for each partition that specifies a mountpoint. Note that with
and non-root <mountpoint>, including swap, the mount program must --use-{uuid,label} and non-root <mountpoint>, including swap, the mount
understand the PARTUUID syntax. This currently excludes the busybox program must understand the PARTUUID or LABEL syntax. This currently
versions of these applications. excludes the busybox versions of these applications.
The following are supported 'part' options: The following are supported 'part' options:
@@ -945,6 +945,14 @@ DESCRIPTION
label is already in use by another filesystem, label is already in use by another filesystem,
a new label is created for the partition. a new label is created for the partition.
--use-label: This option is specific to wic. It makes wic to use the
label in /etc/fstab to specify a partition. If the
--use-label and --use-uuid are used at the same time,
we prefer the uuid because it is less likely to cause
name confliction. We don't support using this parameter
on the root partition since it requires an initramfs to
parse this value and we do not currently support that.
--active: Marks the partition as active. --active: Marks the partition as active.
--align (in KBytes): This option is specific to wic and says --align (in KBytes): This option is specific to wic and says
+12 -2
View File
@@ -141,6 +141,7 @@ class KickStart():
'squashfs', 'vfat', 'msdos', 'swap')) 'squashfs', 'vfat', 'msdos', 'swap'))
part.add_argument('--mkfs-extraopts', default='') part.add_argument('--mkfs-extraopts', default='')
part.add_argument('--label') part.add_argument('--label')
part.add_argument('--use-label', action='store_true')
part.add_argument('--no-table', action='store_true') part.add_argument('--no-table', action='store_true')
part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda') part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda')
part.add_argument("--overhead-factor", type=overheadtype) part.add_argument("--overhead-factor", type=overheadtype)
@@ -197,8 +198,17 @@ class KickStart():
(confpath, lineno, err)) (confpath, lineno, err))
if line.startswith('part'): if line.startswith('part'):
# SquashFS does not support filesystem UUID # SquashFS does not support filesystem UUID
if parsed.fstype == 'squashfs' and parsed.fsuuid: if parsed.fstype == 'squashfs':
err = "%s:%d: SquashFS does not support UUID" \ if parsed.fsuuid:
err = "%s:%d: SquashFS does not support UUID" \
% (confpath, lineno)
raise KickStartError(err)
if parsed.label:
err = "%s:%d: SquashFS does not support LABEL" \
% (confpath, lineno)
raise KickStartError(err)
if parsed.use_label and not parsed.label:
err = "%s:%d: Must set the label with --label" \
% (confpath, lineno) % (confpath, lineno)
raise KickStartError(err) raise KickStartError(err)
# using ArgumentParser one cannot easily tell if option # using ArgumentParser one cannot easily tell if option
+1
View File
@@ -47,6 +47,7 @@ class Partition():
self.fsopts = args.fsopts self.fsopts = args.fsopts
self.fstype = args.fstype self.fstype = args.fstype
self.label = args.label self.label = args.label
self.use_label = args.use_label
self.mkfs_extraopts = args.mkfs_extraopts self.mkfs_extraopts = args.mkfs_extraopts
self.mountpoint = args.mountpoint self.mountpoint = args.mountpoint
self.no_table = args.no_table self.no_table = args.no_table
+2
View File
@@ -155,6 +155,8 @@ class DirectPlugin(ImagerPlugin):
device_name = "UUID=%s" % part.fsuuid device_name = "UUID=%s" % part.fsuuid
else: else:
device_name = "PARTUUID=%s" % part.uuid device_name = "PARTUUID=%s" % part.uuid
elif part.use_label:
device_name = "LABEL=%s" % part.label
else: else:
# mmc device partitions are named mmcblk0p1, mmcblk0p2.. # mmc device partitions are named mmcblk0p1, mmcblk0p2..
prefix = 'p' if part.disk.startswith('mmcblk') else '' prefix = 'p' if part.disk.startswith('mmcblk') else ''