summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Gomez <daniel@qtec.com>2021-08-17 22:11:14 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-08-20 08:53:03 +0100
commit6fdbc5144f3505b11f09364775a0c08cf62f4d21 (patch)
tree11b4eeac6b6ef2e9e5d42e104fb5c0274afd104e
parent901b82a4c8b343b378293956420ad5a4943b6be7 (diff)
downloadpoky-6fdbc5144f3505b11f09364775a0c08cf62f4d21.tar.gz
wic: Add --no-fstab-update part option
When embedding a rootfs image (e.g. 'rootfs-dir') as a partition we might want to keep the stock fstab for that image. In such a case, use this option to not update the fstab and use the stock one instead. This option allows you to specify which partitions get the fstab updated and which get the stock fstab. The option matches the argument you can pass to wic itself where the same action is performed but for all the partitions. Example: part /export --source rootfs --rootfs-dir=hockeycam-image --fstype=ext4 --label export --align 1024 --no-fstab-update part / --source rootfs --fstype=ext4 --label rootfs --align 1024 (From OE-Core rev: ab4c95af8ecd15dc136194ab761afae756db5803) Signed-off-by: Daniel Gomez <daniel@qtec.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/wic/help.py3
-rw-r--r--scripts/lib/wic/ksparser.py1
-rw-r--r--scripts/lib/wic/partition.py5
-rw-r--r--scripts/lib/wic/plugins/source/rootfs.py2
4 files changed, 8 insertions, 3 deletions
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 41451d1cb0..991907d3f5 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -991,6 +991,9 @@ DESCRIPTION
991 multiple partitions and we want to keep the right 991 multiple partitions and we want to keep the right
992 permissions and usernames in all the partitions. 992 permissions and usernames in all the partitions.
993 993
994 --no-fstab-update: This option is specific to wic. It does not update the
995 '/etc/fstab' stock file for the given partition.
996
994 --extra-space: This option is specific to wic. It adds extra 997 --extra-space: This option is specific to wic. It adds extra
995 space after the space filled by the content 998 space after the space filled by the content
996 of the partition. The final size can go 999 of the partition. The final size can go
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 7a4cc83af5..0df9eb0d05 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -185,6 +185,7 @@ class KickStart():
185 part.add_argument('--use-uuid', action='store_true') 185 part.add_argument('--use-uuid', action='store_true')
186 part.add_argument('--uuid') 186 part.add_argument('--uuid')
187 part.add_argument('--fsuuid') 187 part.add_argument('--fsuuid')
188 part.add_argument('--no-fstab-update', action='store_true')
188 189
189 bootloader = subparsers.add_parser('bootloader') 190 bootloader = subparsers.add_parser('bootloader')
190 bootloader.add_argument('--append') 191 bootloader.add_argument('--append')
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index e0b2c5bdf2..ab304f1b2a 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -54,6 +54,7 @@ class Partition():
54 self.uuid = args.uuid 54 self.uuid = args.uuid
55 self.fsuuid = args.fsuuid 55 self.fsuuid = args.fsuuid
56 self.type = args.type 56 self.type = args.type
57 self.no_fstab_update = args.no_fstab_update
57 self.updated_fstab_path = None 58 self.updated_fstab_path = None
58 self.has_fstab = False 59 self.has_fstab = False
59 self.update_fstab_in_rootfs = False 60 self.update_fstab_in_rootfs = False
@@ -286,7 +287,7 @@ class Partition():
286 (self.fstype, extraopts, rootfs, label_str, self.fsuuid, rootfs_dir) 287 (self.fstype, extraopts, rootfs, label_str, self.fsuuid, rootfs_dir)
287 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) 288 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
288 289
289 if self.updated_fstab_path and self.has_fstab: 290 if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update:
290 debugfs_script_path = os.path.join(cr_workdir, "debugfs_script") 291 debugfs_script_path = os.path.join(cr_workdir, "debugfs_script")
291 with open(debugfs_script_path, "w") as f: 292 with open(debugfs_script_path, "w") as f:
292 f.write("cd etc\n") 293 f.write("cd etc\n")
@@ -350,7 +351,7 @@ class Partition():
350 mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir) 351 mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
351 exec_native_cmd(mcopy_cmd, native_sysroot) 352 exec_native_cmd(mcopy_cmd, native_sysroot)
352 353
353 if self.updated_fstab_path and self.has_fstab: 354 if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update:
354 mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path) 355 mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path)
355 exec_native_cmd(mcopy_cmd, native_sysroot) 356 exec_native_cmd(mcopy_cmd, native_sysroot)
356 357
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index 96d940a91d..2e34e715ca 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -218,7 +218,7 @@ class RootfsPlugin(SourcePlugin):
218 # Update part.has_fstab here as fstab may have been added or 218 # Update part.has_fstab here as fstab may have been added or
219 # removed by the above modifications. 219 # removed by the above modifications.
220 part.has_fstab = os.path.exists(os.path.join(new_rootfs, "etc/fstab")) 220 part.has_fstab = os.path.exists(os.path.join(new_rootfs, "etc/fstab"))
221 if part.update_fstab_in_rootfs and part.has_fstab: 221 if part.update_fstab_in_rootfs and part.has_fstab and not part.no_fstab_update:
222 fstab_path = os.path.join(new_rootfs, "etc/fstab") 222 fstab_path = os.path.join(new_rootfs, "etc/fstab")
223 # Assume that fstab should always be owned by root with fixed permissions 223 # Assume that fstab should always be owned by root with fixed permissions
224 install_cmd = "install -m 0644 %s %s" % (part.updated_fstab_path, fstab_path) 224 install_cmd = "install -m 0644 %s %s" % (part.updated_fstab_path, fstab_path)