]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: Add option to not change fstab
authorFabio Berton <fabio.berton@ossystems.com.br>
Tue, 18 Apr 2017 14:57:32 +0000 (11:57 -0300)
committerOtavio Salvador <otavio@ossystems.com.br>
Tue, 25 Apr 2017 12:22:21 +0000 (09:22 -0300)
Create an option to wic do not change fstab file, so fstab file from
base-files recipe will be the same that in final image.

Change-Id: I6c023ffd32aa8966dab10ff0ecb311a08c34722c
Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
scripts/lib/wic/creator.py
scripts/lib/wic/engine.py
scripts/lib/wic/imager/direct.py
scripts/lib/wic/plugins/imager/direct_plugin.py
scripts/wic

index 8f7d1503f5622856e10bd2565643fa7eacc8f8e5..3039ec67c7e142ded9bc6e84ccc1ab45b5e23e56 100644 (file)
@@ -70,6 +70,8 @@ class Creator():
                              help='Setup tmpdir as tmpfs to accelerate, experimental'
                                   ' feature, use it if you have more than 4G memory')
         optparser.add_option('', '--bmap', action='store_true', help='generate .bmap')
+        optparser.add_option('', '--no-fstab-update', action='store_true',
+                             help='Do not change fstab file.')
         return optparser
 
     def postoptparse(self, options):
index 5b104631ca635b0183b601b5552036cc8e4a5f24..c47936c80874477f5d220a822906e33fcee07c75 100644 (file)
@@ -145,7 +145,7 @@ def list_source_plugins():
 
 def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
                native_sysroot, scripts_path, image_output_dir,
-               compressor, bmap, debug):
+               compressor, bmap, no_fstab_update, debug):
     """Create image
 
     wks_file - user-defined OE kickstart file
@@ -157,6 +157,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
     image_output_dir - dirname to create for image
     compressor - compressor utility to compress the image
     bmap - enable generation of .bmap
+    no_fstab_update - Do not change fstab file.
 
     Normally, the values for the build artifacts values are determined
     by 'wic -e' from the output of the 'bitbake -e' command given an
@@ -192,6 +193,9 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
     if bmap:
         cmdline.append('--bmap')
 
+    if no_fstab_update:
+        cmdline.append('--no-fstab-update')
+
     crobj.main(cmdline)
 
     print("\nThe image(s) were created using OE kickstart file:\n  %s" % wks_file)
index edf5e5d2214f8e78b6c2a98d7f6cd45fcc0065c4..b9f51478c81f638ebe08851c28c9ab23d1c9aac7 100644 (file)
@@ -73,7 +73,7 @@ class DirectImageCreator(BaseImageCreator):
 
     def __init__(self, oe_builddir, image_output_dir, rootfs_dir, bootimg_dir,
                  kernel_dir, native_sysroot, compressor, creatoropts=None,
-                 bmap=False):
+                 bmap=False, no_fstab_update=False):
         """
         Initialize a DirectImageCreator instance.
 
@@ -96,6 +96,7 @@ class DirectImageCreator(BaseImageCreator):
         self.native_sysroot = native_sysroot
         self.compressor = compressor
         self.bmap = bmap
+        self.no_fstab_update = no_fstab_update
 
     def __get_part_num(self, num, parts):
         """calculate the real partition number, accounting for partitions not
@@ -260,7 +261,10 @@ class DirectImageCreator(BaseImageCreator):
                     disk_id = disk_ids[part.disk]
                     part.uuid = '%0x-%02d' % (disk_id, self.__get_part_num(num, parts))
 
-        fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
+        if self.no_fstab_update:
+            fstab_path = None
+        else:
+            fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
 
         shutil.rmtree(self.workdir)
         os.mkdir(self.workdir)
@@ -416,4 +420,3 @@ class DirectImageCreator(BaseImageCreator):
                 self.__image.cleanup()
             except ImageError as err:
                 msger.warning("%s" % err)
-
index 8fe39308046fb3b067f96102bb6931d38c909d67..0d42592215f35e1293532836aa5914a52e53759e 100644 (file)
@@ -87,7 +87,8 @@ class DirectPlugin(ImagerPlugin):
                                             native_sysroot,
                                             compressor,
                                             creatoropts,
-                                            opts.bmap)
+                                            opts.bmap,
+                                            opts.no_fstab_update)
 
         try:
             creator.create()
index fe2c33f0e7b25c41aebee8c597f5541e81cc6e60..3689a6f01ddcd1918c0ce6405aa102db2c14b79c 100755 (executable)
@@ -114,6 +114,8 @@ def wic_create_subcommand(args, usage_str):
                       dest='compressor',
                       help="compress image with specified compressor")
     parser.add_option("-m", "--bmap", action="store_true", help="generate .bmap")
+    parser.add_option("", "--no-fstab-update" ,action="store_true",
+                      help="Do not change fstab file.")
     parser.add_option("-v", "--vars", dest='vars_dir',
                       help="directory with <image>.env files that store "
                            "bitbake variables")
@@ -244,7 +246,8 @@ def wic_create_subcommand(args, usage_str):
     print("Creating image(s)...\n")
     engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
                       native_sysroot, scripts_path, image_output_dir,
-                      options.compressor, options.bmap, options.debug)
+                      options.compressor, options.bmap, options.no_fstab_update,
+                      options.debug)
 
 
 def wic_list_subcommand(args, usage_str):