On Fri, 6 Aug 2021 11:23:37 +0200 Daniel Gomez wrote: > When embeddding rootfs image (e.g. 'rootfs-dir') as a partition we > might want to keep the stock fstab for that image. In such case, use > this option to not update the fstab and use the stock one instead. > > This option allows to specify which partitions get the updated fstab > and which get the stock fstab. > > Example: > part /export --source rootfs --rootfs-dir=hockeycam-image > --fstype=ext4 --label export --align 1024 --use-stock-fstab > > part / --source rootfs --fstype=ext4 --label rootfs --align 1024 > > Signed-off-by: Daniel Gomez > --- > > The commit-id ce682a73b7447652f898ce1d1d0416a456df5416 reverted the > functionality to restore the stock/original fstab file in a rootfs > partition image (wic plugin). > > Add back such functionality with an option to the user to select which > fstab will be used for each partition by adding the --use-stock-fstab. > In this case, the user will select whether or not the stock fstab will > be updated or kept. > > If you agree with the patch I'll adapt it to the master branch. > > Daniel > > scripts/lib/wic/ksparser.py | 1 + > scripts/lib/wic/partition.py | 3 ++- > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py > index 452a160232..64933e0a5b 100644 > --- a/scripts/lib/wic/ksparser.py > +++ b/scripts/lib/wic/ksparser.py > @@ -184,6 +184,7 @@ class KickStart(): > part.add_argument('--use-uuid', action='store_true') > part.add_argument('--uuid') > part.add_argument('--fsuuid') > + part.add_argument('--use-stock-fstab', action='store_true') > > bootloader = subparsers.add_parser('bootloader') > bootloader.add_argument('--append') > diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py > index 85f9847047..c9e45773de 100644 > --- a/scripts/lib/wic/partition.py > +++ b/scripts/lib/wic/partition.py > @@ -54,6 +54,7 @@ class Partition(): > self.uuid = args.uuid > self.fsuuid = args.fsuuid > self.type = args.type > + self.use_stock_fstab = args.use_stock_fstab > self.updated_fstab_path = None > self.has_fstab = False > self.update_fstab_in_rootfs = False > @@ -286,7 +287,7 @@ class Partition(): > (self.fstype, extraopts, rootfs, label_str, self.fsuuid, rootfs_dir) > exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) > > - if self.updated_fstab_path and self.has_fstab: > + if self.updated_fstab_path and self.has_fstab and not self.use_stock_fstab: > debugfs_script_path = os.path.join(cr_workdir, "debugfs_script") > with open(debugfs_script_path, "w") as f: > f.write("cd etc\n") > -- > 2.30.2 > You're only addressing ext2/3/4 partitions here. The patch needs to be extended to cover the msdos partition case and the update_fstab_in_rootfs case in the rootfs source plugin. I also recommend changing the option in ksparser to '--no-fstab-update' to match the argument you can pass to wic itself. That way you can pass '--no-fstab-update' to wic to set the option for all partitions, or include it in the wks file to set the option per-partition. Thanks, -- Paul Barker https://pbarker.dev/