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 <dan...@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 > > >
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#154480): https://lists.openembedded.org/g/openembedded-core/message/154480 Mute This Topic: https://lists.openembedded.org/mt/84686452/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-