Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Paul Barker" <paul@pbarker.dev>
To: Daniel Gomez <daniel@qtec.com>
Cc: openembedded-core@lists.openembedded.org, dagmcr@gmail.com,
	richard.purdie@linuxfoundation.org
Subject: Re: [OE-core][RFC][PATCH][dunfell] wic: Add --use-stock-fstab option
Date: Fri, 6 Aug 2021 11:29:24 +0100	[thread overview]
Message-ID: <20210806112924.61ba4c80.paul@pbarker.dev> (raw)
In-Reply-To: <20210806092337.81924-1-daniel@qtec.com>

[-- Attachment #1: Type: text/plain, Size: 3476 bytes --]

On Fri,  6 Aug 2021 11:23:37 +0200
Daniel Gomez <daniel@qtec.com> 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 <daniel@qtec.com>
> ---
> 
> 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/

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 235 bytes --]

  parent reply	other threads:[~2021-08-06 10:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 15:03 [OE-core][RFC][PATCH][dunfell] wic: direct: Use stock fstab in partitions Daniel Gomez
2021-08-05 15:31 ` Richard Purdie
2021-08-06  9:23   ` [OE-core][RFC][PATCH][dunfell] wic: Add --use-stock-fstab option Daniel Gomez
2021-08-06 10:02     ` Richard Purdie
2021-08-06 10:29     ` Paul Barker [this message]
2021-08-06 13:27       ` Daniel Gomez
2021-08-06  9:35   ` [OE-core][RFC][PATCH][dunfell] wic: direct: Use stock fstab in partitions Daniel Gomez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210806112924.61ba4c80.paul@pbarker.dev \
    --to=paul@pbarker.dev \
    --cc=dagmcr@gmail.com \
    --cc=daniel@qtec.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox