add --use-mic-in-bootstrap option
authorDohyung Kim <dohyung2.kim@samsung.com>
Fri, 9 Jun 2017 11:00:01 +0000 (20:00 +0900)
committeryuhuan.yang <yuhuan.yang@samsung.com>
Tue, 30 Jan 2018 03:44:07 +0000 (11:44 +0800)
use mic in bootstrap without copy host mic to bootstrap.
by default, copy host mic to bootstrap and use it

Change-Id: I3f4f03cc666df05ad4a7c393b771a2487350b9fe
Signed-off-by: Dohyung Kim <dohyung2.kim@samsung.com>
etc/mic.conf.in
mic/cmd_create.py
mic/conf.py
mic/rt_util.py
tools/mic

index 3d41eff..81907ff 100644 (file)
@@ -10,6 +10,7 @@ tmpdir= /var/tmp/mic
 cachedir= /var/tmp/mic/cache
 outdir= ./mic-output
 runtime=bootstrap
+#use_mic_in_bootstrap = yes
 
 pkgmgr = auto
 
index 7ef7e46..203d08d 100755 (executable)
@@ -151,6 +151,9 @@ def main(parser, args, argv):
     if args.runtime:\r
         configmgr.set_runtime(args.runtime)\r
 \r
+    if args.use_mic_in_bootstrap:\r
+        configmgr.create['use_mic_in_bootstrap'] = args.use_mic_in_bootstrap\r
+\r
     if args.pack_to is not None:\r
         configmgr.create['pack_to'] = args.pack_to\r
 \r
index 40d4a64..33e534f 100755 (executable)
@@ -78,6 +78,7 @@ class ConfigMgr(object):
                     "strict_mode": False,
                     "run_script": None,
                     "tpk_install": None,
+                    "use_mic_in_bootstrap": False,
                 },
                 'chroot': {
                     "saveto": None,
@@ -195,6 +196,13 @@ class ConfigMgr(object):
                 packages = packages.split()
             self.bootstrap['packages'] = packages
 
+        if type(self.create['use_mic_in_bootstrap']) != 'bool':
+            use_mic_in_bootstrap = str(self.create['use_mic_in_bootstrap'])
+            if use_mic_in_bootstrap.lower() in ('on', 'yes', 'true', '1'):
+                self.create['use_mic_in_bootstrap'] = True
+            else:
+                self.create['use_mic_in_bootstrap'] = False
+
     def _parse_kickstart(self, ksconf=None):
         if not ksconf:
             return
index 316375d..61b0bb2 100644 (file)
@@ -104,7 +104,11 @@ def bootstrap_mic(argv=None):
             rootdir = os.path.join(rootdir, "bootstrap")
 
         bsenv.dirsetup(rootdir)
-        sync_mic(rootdir, plugin=cropts['plugin_dir'])
+        if cropts['use_mic_in_bootstrap']:
+            msger.info("No copy host mic")
+        else:
+            msger.info("Copy host mic to bootstrap")
+            sync_mic(rootdir, plugin=cropts['plugin_dir'])
 
         #FIXME: sync the ks file to bootstrap
         if "/" == os.path.dirname(os.path.abspath(configmgr._ksconf)):
index 70000a7..6cbfb45 100755 (executable)
--- a/tools/mic
+++ b/tools/mic
@@ -124,6 +124,11 @@ def create_parser(parser):
                                dest='strict_mode', default=False,
                                help='Abort creation of image, if there are some errors'
                                     ' during rpm installation. ')
+    parent_parser.add_argument('--use-mic-in-bootstrap', action='store_true',
+                               dest='use_mic_in_bootstrap', default=False,
+                               help='This option works in bootstrap runtime mode,'
+                                    ' Use mic in bootstrap to create image.'
+                                    ' By default, copy host mic to bootstrap and use it.')
 
     parent_parser.add_argument('-d', '--debug', action='store_true',
                                help='debug output')