* [OE-core][RFC][PATCH][dunfell] wic: direct: Use stock fstab in partitions
@ 2021-08-05 15:03 Daniel Gomez
2021-08-05 15:31 ` Richard Purdie
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Gomez @ 2021-08-05 15:03 UTC (permalink / raw)
To: openembedded-core; +Cc: dagmcr, Daniel Gomez
Be able to get the stock fstab in partitions.
Functionality reverted at commit id:
ce682a73b7447652f898ce1d1d0416a456df5416
Signed-off-by: Daniel Gomez <daniel@qtec.com>
---
Hi,
I'm trying to get back the stock fstab file in a rootfs partition
image (wic plugin) and I'd like to know what you think about it.
Functionality was included before commit-id
ce682a73b7447652f898ce1d1d0416a456df5416 and removed afterwards. Would
it be possible to add it again? What would be needed to re-add it?
Thanks in advance,
Daniel
Here the relevant information:
wks definition:
part /boot/bootloader --source qbootimg-pcbios --active --align 1024 --use-uuid --fsoptions defaults,ro
part /export --source rootfs --rootfs-dir=hockeycam-image --fstype=ext4 --label export --align 1024 --use-uuid --fsoptions defaults,ro --extra-space 400M
part /media/rw --fstype=ext4 --label rwfs --align 1024 --use-uuid --size 200
part / --source rootfs --fstype=ext4 --label rootfs --align 1024 --use-uuid --fsoptions defaults,ro --extra-space 400M
bootloader --timeout=1 --append="ro rootfstype=ext4 qtec_mem.size=64" --source qbootimg-pcbios
/export/etc/fstab before:
# stock fstab - you probably want to override this with a machine specific one
/dev/root / auto ro 1 0
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
tmpfs /var/volatile tmpfs defaults 0 0
# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
/dev/sdb /mnt auto defaults 0 0
UUID=D339-7B77 /boot/bootloader vfat defaults,ro 0 0
UUID=31f46be1-d9fb-4081-bd53-2c2727e7854b /export ext4 defaults,ro 0 0
UUID=d8e8f5d4-897e-48cd-9188-33598363f706 /media/rw ext4 defaults 0 0
/export/etc/fstab after:
# stock fstab - you probably want to override this with a machine specific one
/dev/root / auto ro 1 0
proc /proc proc defaults 0 0
devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0
tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
tmpfs /var/volatile tmpfs defaults 0 0
# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
10.100.10.100:/mnt/rw /media/rw nfs defaults 0 0
scripts/lib/wic/plugins/imager/direct.py | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 7e1c1c03ab..1bb9d38524 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -111,7 +111,15 @@ class DirectPlugin(ImagerPlugin):
with open(fstab_path) as fstab:
fstab_lines = fstab.readlines()
+ self.original_fstab = fstab_lines.copy()
+ if self._update_fstab(fstab_lines, self.parts):
+ with open(fstab_path, "w") as fstab:
+ fstab.writelines(fstab_lines)
+ else:
+ self.original_fstab = None
+
+ def _update_fstab(self, fstab_lines, parts):
updated = False
for part in self.parts:
if not part.realnum or not part.mountpoint \
@@ -142,10 +150,7 @@ class DirectPlugin(ImagerPlugin):
fstab_lines.append(line)
updated = True
- if updated:
- self.updated_fstab_path = os.path.join(self.workdir, "fstab")
- with open(self.updated_fstab_path, "w") as f:
- f.writelines(fstab_lines)
+ return updated
def _full_path(self, path, name, extention):
""" Construct full file path to a file we generate. """
@@ -274,6 +279,13 @@ class DirectPlugin(ImagerPlugin):
if os.path.isfile(path):
shutil.move(path, os.path.join(self.outdir, fname))
+
+ # Restore original fstab
+ if self.original_fstab:
+ fstab_path = self.rootfs_dir.get("ROOTFS_DIR") + "/etc/fstab"
+ with open(fstab_path, "w") as fstab:
+ fstab.writelines(self.original_fstab)
+
# remove work directory
shutil.rmtree(self.workdir, ignore_errors=True)
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [OE-core][RFC][PATCH][dunfell] wic: direct: Use stock fstab in partitions
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 9:35 ` [OE-core][RFC][PATCH][dunfell] wic: direct: Use stock fstab in partitions Daniel Gomez
0 siblings, 2 replies; 7+ messages in thread
From: Richard Purdie @ 2021-08-05 15:31 UTC (permalink / raw)
To: Daniel Gomez, openembedded-core; +Cc: dagmcr, Paul Barker
On Thu, 2021-08-05 at 17:03 +0200, Daniel Gomez wrote:
> Be able to get the stock fstab in partitions.
>
> Functionality reverted at commit id:
> ce682a73b7447652f898ce1d1d0416a456df5416
>
> Signed-off-by: Daniel Gomez <daniel@qtec.com>
> ---
>
> Hi,
>
> I'm trying to get back the stock fstab file in a rootfs partition
> image (wic plugin) and I'd like to know what you think about it.
>
> Functionality was included before commit-id
> ce682a73b7447652f898ce1d1d0416a456df5416 and removed afterwards. Would
> it be possible to add it again? What would be needed to re-add it?
>
The commit you mention above shouldn't have changed the output, it just used a
different method to replace the fstab file. The question becomes why isn't the
modified file being used in the way you're generating an image. I don't know
wic well enough to know the answer to that though.
Cheers,
Richard
> Thanks in advance,
> Daniel
>
> Here the relevant information:
>
> wks definition:
> part /boot/bootloader --source qbootimg-pcbios --active --align 1024 --use-uuid --fsoptions defaults,ro
> part /export --source rootfs --rootfs-dir=hockeycam-image --fstype=ext4 --label export --align 1024 --use-uuid --fsoptions defaults,ro --extra-space 400M
> part /media/rw --fstype=ext4 --label rwfs --align 1024 --use-uuid --size 200
> part / --source rootfs --fstype=ext4 --label rootfs --align 1024 --use-uuid --fsoptions defaults,ro --extra-space 400M
>
> bootloader --timeout=1 --append="ro rootfstype=ext4 qtec_mem.size=64" --source qbootimg-pcbios
>
> /export/etc/fstab before:
> # stock fstab - you probably want to override this with a machine specific one
>
> /dev/root / auto ro 1 0
> proc /proc proc defaults 0 0
> devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0
> tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
> tmpfs /var/volatile tmpfs defaults 0 0
>
> # uncomment this if your device has a SD/MMC/Transflash slot
> #/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
>
> /dev/sdb /mnt auto defaults 0 0
> UUID=D339-7B77 /boot/bootloader vfat defaults,ro 0 0
> UUID=31f46be1-d9fb-4081-bd53-2c2727e7854b /export ext4 defaults,ro 0 0
> UUID=d8e8f5d4-897e-48cd-9188-33598363f706 /media/rw ext4 defaults 0 0
>
> /export/etc/fstab after:
> # stock fstab - you probably want to override this with a machine specific one
>
> /dev/root / auto ro 1 0
> proc /proc proc defaults 0 0
> devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0
> tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
> tmpfs /var/volatile tmpfs defaults 0 0
>
> # uncomment this if your device has a SD/MMC/Transflash slot
> #/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
>
> 10.100.10.100:/mnt/rw /media/rw nfs defaults 0 0
>
>
> scripts/lib/wic/plugins/imager/direct.py | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> index 7e1c1c03ab..1bb9d38524 100644
> --- a/scripts/lib/wic/plugins/imager/direct.py
> +++ b/scripts/lib/wic/plugins/imager/direct.py
> @@ -111,7 +111,15 @@ class DirectPlugin(ImagerPlugin):
>
> with open(fstab_path) as fstab:
> fstab_lines = fstab.readlines()
> + self.original_fstab = fstab_lines.copy()
>
> + if self._update_fstab(fstab_lines, self.parts):
> + with open(fstab_path, "w") as fstab:
> + fstab.writelines(fstab_lines)
> + else:
> + self.original_fstab = None
> +
> + def _update_fstab(self, fstab_lines, parts):
> updated = False
> for part in self.parts:
> if not part.realnum or not part.mountpoint \
> @@ -142,10 +150,7 @@ class DirectPlugin(ImagerPlugin):
> fstab_lines.append(line)
> updated = True
>
> - if updated:
> - self.updated_fstab_path = os.path.join(self.workdir, "fstab")
> - with open(self.updated_fstab_path, "w") as f:
> - f.writelines(fstab_lines)
> + return updated
>
> def _full_path(self, path, name, extention):
> """ Construct full file path to a file we generate. """
> @@ -274,6 +279,13 @@ class DirectPlugin(ImagerPlugin):
> if os.path.isfile(path):
> shutil.move(path, os.path.join(self.outdir, fname))
>
> +
> + # Restore original fstab
> + if self.original_fstab:
> + fstab_path = self.rootfs_dir.get("ROOTFS_DIR") + "/etc/fstab"
> + with open(fstab_path, "w") as fstab:
> + fstab.writelines(self.original_fstab)
> +
> # remove work directory
> shutil.rmtree(self.workdir, ignore_errors=True)
>
> --
> 2.30.2
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [OE-core][RFC][PATCH][dunfell] wic: Add --use-stock-fstab option
2021-08-05 15:31 ` Richard Purdie
@ 2021-08-06 9:23 ` Daniel Gomez
2021-08-06 10:02 ` Richard Purdie
2021-08-06 10:29 ` Paul Barker
2021-08-06 9:35 ` [OE-core][RFC][PATCH][dunfell] wic: direct: Use stock fstab in partitions Daniel Gomez
1 sibling, 2 replies; 7+ messages in thread
From: Daniel Gomez @ 2021-08-06 9:23 UTC (permalink / raw)
To: openembedded-core; +Cc: dagmcr, paul, richard.purdie, Daniel Gomez
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [OE-core][RFC][PATCH][dunfell] wic: direct: Use stock fstab in partitions
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 9:35 ` Daniel Gomez
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2021-08-06 9:35 UTC (permalink / raw)
To: Richard Purdie; +Cc: openembedded-core, Daniel Gomez, Paul Barker
Hi Richard,
On Thu, 5 Aug 2021 at 17:31, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Thu, 2021-08-05 at 17:03 +0200, Daniel Gomez wrote:
> > Be able to get the stock fstab in partitions.
> >
> > Functionality reverted at commit id:
> > ce682a73b7447652f898ce1d1d0416a456df5416
> >
> > Signed-off-by: Daniel Gomez <daniel@qtec.com>
> > ---
> >
> > Hi,
> >
> > I'm trying to get back the stock fstab file in a rootfs partition
> > image (wic plugin) and I'd like to know what you think about it.
> >
> > Functionality was included before commit-id
> > ce682a73b7447652f898ce1d1d0416a456df5416 and removed afterwards. Would
> > it be possible to add it again? What would be needed to re-add it?
> >
>
> The commit you mention above shouldn't have changed the output, it just used a
> different method to replace the fstab file. The question becomes why isn't the
> modified file being used in the way you're generating an image. I don't know
> wic well enough to know the answer to that though.
Thanks for your comments. I did some debugging and the fstab in use
for each partition will always be updated/replaced in the
'prepare_rootfs_ext' function (when 'update_fstab' in direct.py
updates it):
http://git.openembedded.org/openembedded-core/tree/scripts/lib/wic/partition.py?h=dunfell#n289
To fix it, I made this patch for dunfell so it gets updated if the user wants.
https://lists.openembedded.org/g/openembedded-core/message/154537
The user now decides with --use-stock-fstab if the stock fstab is kept
or replaced/updated.
As said in the other patch/message, I'll update it to master if you agree.
Thanks,
Daniel
>
> Cheers,
>
> Richard
>
>
> > Thanks in advance,
> > Daniel
> >
> > Here the relevant information:
> >
> > wks definition:
> > part /boot/bootloader --source qbootimg-pcbios --active --align 1024 --use-uuid --fsoptions defaults,ro
> > part /export --source rootfs --rootfs-dir=hockeycam-image --fstype=ext4 --label export --align 1024 --use-uuid --fsoptions defaults,ro --extra-space 400M
> > part /media/rw --fstype=ext4 --label rwfs --align 1024 --use-uuid --size 200
> > part / --source rootfs --fstype=ext4 --label rootfs --align 1024 --use-uuid --fsoptions defaults,ro --extra-space 400M
> >
> > bootloader --timeout=1 --append="ro rootfstype=ext4 qtec_mem.size=64" --source qbootimg-pcbios
> >
> > /export/etc/fstab before:
> > # stock fstab - you probably want to override this with a machine specific one
> >
> > /dev/root / auto ro 1 0
> > proc /proc proc defaults 0 0
> > devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0
> > tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
> > tmpfs /var/volatile tmpfs defaults 0 0
> >
> > # uncomment this if your device has a SD/MMC/Transflash slot
> > #/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
> >
> > /dev/sdb /mnt auto defaults 0 0
> > UUID=D339-7B77 /boot/bootloader vfat defaults,ro 0 0
> > UUID=31f46be1-d9fb-4081-bd53-2c2727e7854b /export ext4 defaults,ro 0 0
> > UUID=d8e8f5d4-897e-48cd-9188-33598363f706 /media/rw ext4 defaults 0 0
> >
> > /export/etc/fstab after:
> > # stock fstab - you probably want to override this with a machine specific one
> >
> > /dev/root / auto ro 1 0
> > proc /proc proc defaults 0 0
> > devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0
> > tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0
> > tmpfs /var/volatile tmpfs defaults 0 0
> >
> > # uncomment this if your device has a SD/MMC/Transflash slot
> > #/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0
> >
> > 10.100.10.100:/mnt/rw /media/rw nfs defaults 0 0
> >
> >
> > scripts/lib/wic/plugins/imager/direct.py | 20 ++++++++++++++++----
> > 1 file changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> > index 7e1c1c03ab..1bb9d38524 100644
> > --- a/scripts/lib/wic/plugins/imager/direct.py
> > +++ b/scripts/lib/wic/plugins/imager/direct.py
> > @@ -111,7 +111,15 @@ class DirectPlugin(ImagerPlugin):
> >
> > with open(fstab_path) as fstab:
> > fstab_lines = fstab.readlines()
> > + self.original_fstab = fstab_lines.copy()
> >
> > + if self._update_fstab(fstab_lines, self.parts):
> > + with open(fstab_path, "w") as fstab:
> > + fstab.writelines(fstab_lines)
> > + else:
> > + self.original_fstab = None
> > +
> > + def _update_fstab(self, fstab_lines, parts):
> > updated = False
> > for part in self.parts:
> > if not part.realnum or not part.mountpoint \
> > @@ -142,10 +150,7 @@ class DirectPlugin(ImagerPlugin):
> > fstab_lines.append(line)
> > updated = True
> >
> > - if updated:
> > - self.updated_fstab_path = os.path.join(self.workdir, "fstab")
> > - with open(self.updated_fstab_path, "w") as f:
> > - f.writelines(fstab_lines)
> > + return updated
> >
> > def _full_path(self, path, name, extention):
> > """ Construct full file path to a file we generate. """
> > @@ -274,6 +279,13 @@ class DirectPlugin(ImagerPlugin):
> > if os.path.isfile(path):
> > shutil.move(path, os.path.join(self.outdir, fname))
> >
> > +
> > + # Restore original fstab
> > + if self.original_fstab:
> > + fstab_path = self.rootfs_dir.get("ROOTFS_DIR") + "/etc/fstab"
> > + with open(fstab_path, "w") as fstab:
> > + fstab.writelines(self.original_fstab)
> > +
> > # remove work directory
> > shutil.rmtree(self.workdir, ignore_errors=True)
> >
> > --
> > 2.30.2
> >
> >
> >
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core][RFC][PATCH][dunfell] wic: Add --use-stock-fstab option
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
1 sibling, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2021-08-06 10:02 UTC (permalink / raw)
To: Daniel Gomez, openembedded-core; +Cc: dagmcr, paul
On Fri, 2021-08-06 at 11:23 +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 <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.
It seems reasonable to me. It would need to go to master first and
ideally we'd add some kind of test to oe-selftest -r wic (see
meta/lib/oeqa/selftest/cases/wic.py).
Cheers,
Richard
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core][RFC][PATCH][dunfell] wic: Add --use-stock-fstab option
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
2021-08-06 13:27 ` Daniel Gomez
1 sibling, 1 reply; 7+ messages in thread
From: Paul Barker @ 2021-08-06 10:29 UTC (permalink / raw)
To: Daniel Gomez; +Cc: openembedded-core, dagmcr, richard.purdie
[-- 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 --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core][RFC][PATCH][dunfell] wic: Add --use-stock-fstab option
2021-08-06 10:29 ` Paul Barker
@ 2021-08-06 13:27 ` Daniel Gomez
0 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2021-08-06 13:27 UTC (permalink / raw)
To: Paul Barker; +Cc: openembedded-core, Daniel Gomez, Richard Purdie
On Fri, 6 Aug 2021 at 12:29, Paul Barker <paul@pbarker.dev> wrote:
>
> 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 Richard and Paul for the suggestions and the missing tasks.
I'll send a patch as soon as I have all prepared.
Daniel
>
> Thanks,
>
> --
> Paul Barker
> https://pbarker.dev/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-08-06 13:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.