Hi Otavio

2017-09-21 22:51 GMT+02:00 Otavio Salvador <[email protected]>:
> Hello Max,
>
> I am adding Ed, Richard and Ross on Cc here so we can discuss it further.
>
> On Thu, Sep 14, 2017 at 5:08 AM, Max Krummenacher <[email protected]> 
> wrote:
>> Hi
>>
>>
>>
>> 2017-09-13 23:20 GMT+02:00 Stefan Agner <[email protected]>:
>>>
>>> I guess / is a bit different here since it just uses /dev/root, in the end 
>>> the mmcblk comes from the boot arguments (root=).
>>>
>>> One could probably just define the proper mmcblkX with the --disk argument, 
>>> but that does not work since mmcblk devices are not stable. E.g. if you use 
>>> the second SDHC controller for an eMMC, and the first SDHC controller is 
>>> available externally for SD cards, you root device is mmcblk0 if there is 
>>> no SD card available, and mmcblk1 if there is one available.. At least on 
>>> mainline that is the case. There are patches floating around which provide 
>>> a more stable block device name. But the official answer is PARTUUID. So I 
>>> guess one would have to teach wks PARTUUID support for fstab generation...
>>>
>>> Personally I also like to have /boot mounted to the partition where the 
>>> kernels are, even if that is an external FAT partition... That is also the 
>>> case on regular Linux distros booting with UEFI.
>>>
>>> But Max approach would work around that issue for now until PARTUUID 
>>> support is available...
>>>
>>> --
>>> Stefan
>>
>> As said in the patch this commit to oe-core changed the behaviour of wic.
>> http://cgit.openembedded.org/openembedded-core/commit/scripts/lib/wic/plugins/imager/direct.py?id=2376b05512ddb8c4ec3aaf1df11071f536a76bd9
>>
>> Before that wic added a line to fstab for each partition which had a
>> mountpoint set if the mountpoint was not '/' or '/boot'. With the
>> patch only '/' is not added to to fstab.
>> And the commit text clearly states that this exception is removed
>> because a user who does not want that entry can simply omit the
>> mountpoint in the kickstarter file.
>>
>> Which is why I created a new kickstarter file which does exactly what
>> the commit text proposes.
>
> I understand the need here for a new wks file however it is a little
> confusing for end user that sdcard-image.wks does not work anymore for
> general users.
>
> Before we start adding new wks files, I think we have to discuss this.
> We did propose https://patchwork.openembedded.org/series/6418/# which
> seemed to be the best approach for reproducible builds as we provide a
> final fstab which is ready for use by the device and keep the wks
> files compatible.
>
> What you guys think?

I like this generic solution, thanks.
I tried it out, with Fabio's patch my issue with using
sdimage-bootpart.wks is solved.

Max

P.S. attaching the forward port of the patch.
P.P.S. WIC_CREATE_EXTRA_ARGS_append = " --no-fstab-update"

>
> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
From e1f27ed0418f0ed0dea16125bb4fc875115878a5 Mon Sep 17 00:00:00 2001
From: Fabio Berton <[email protected]>
Date: Wed, 19 Apr 2017 13:42:47 -0300
Subject: [PATCH] wic: Add option to not change fstab

Create an option to wic doesn't change fstab file, the final
fstab file will be same that in rootfs and wic doesn't update
file, e.g adding a new mount point.

Users can control the fstab file content in base-files recipe.
This is useful if you want to only create an partition but not
add fstab mount point or add new mount point using label e.g:

LABEL=recovery /recovery auto defaults 0  1

Signed-off-by: Fabio Berton <[email protected]>
---
 scripts/lib/wic/help.py                  | 7 ++++++-
 scripts/lib/wic/plugins/imager/direct.py | 6 +++++-
 scripts/wic                              | 2 ++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index 83bd86e..bd9c62e 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -155,7 +155,7 @@ SYNOPSIS
         [-e | --image-name] [-s, --skip-build-check] [-D, --debug]
         [-r, --rootfs-dir] [-b, --bootimg-dir]
         [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]
-        [-c, --compress-with] [-m, --bmap]
+        [-c, --compress-with] [-m, --bmap] [--no-fstab-update]
 
 DESCRIPTION
     This command creates an OpenEmbedded image based on the 'OE
@@ -227,6 +227,11 @@ DESCRIPTION
 
     The -m option is used to produce .bmap file for the image. This file
     can be used to flash image using bmaptool utility.
+
+    The --no-fstab-update option is used to doesn't change fstab file. When
+    using this option the final fstab file will be same that in rootfs and
+    wic doesn't update file, e.g adding a new mount point. User can control
+    the fstab file content in base-files recipe.
 """
 
 wic_list_usage = """
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index a6abc3d..60317ee 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -71,6 +71,7 @@ class DirectPlugin(ImagerPlugin):
         self.outdir = options.outdir
         self.compressor = options.compressor
         self.bmap = options.bmap
+        self.no_fstab_update = options.no_fstab_update
 
         self.name = "%s-%s" % (os.path.splitext(os.path.basename(wks_file))[0],
                                strftime("%Y%m%d%H%M"))
@@ -165,7 +166,10 @@ class DirectPlugin(ImagerPlugin):
         filesystems from the artifacts directly and combine them into
         a partitioned image.
         """
-        new_rootfs = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
+        if self.no_fstab_update:
+            new_rootfs = None
+        else:
+            new_rootfs = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
         if new_rootfs:
             # rootfs was copied to update fstab
             self.rootfs_dir['ROOTFS_DIR'] = new_rootfs
diff --git a/scripts/wic b/scripts/wic
index 592a0e4..097084a 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -342,6 +342,8 @@ def wic_init_parser_create(subparser):
                       dest='compressor',
                       help="compress image with specified compressor")
     subparser.add_argument("-m", "--bmap", action="store_true", help="generate .bmap")
+    subparser.add_argument("--no-fstab-update" ,action="store_true",
+                      help="Do not change fstab file.")
     subparser.add_argument("-v", "--vars", dest='vars_dir',
                       help="directory with <image>.env files that store "
                            "bitbake variables")
-- 
2.9.4

-- 
_______________________________________________
meta-freescale mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-freescale

Reply via email to