From 719d093c40e4c259a4c97d6c8a5efb5aeef5fd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Henrique=20Ferreira=20de=20Freitas?= Date: Sat, 29 Mar 2014 00:12:08 -0300 Subject: wic: Extend --rootfs-dir to connect rootfs-dirs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wic command-line param --rootfs-dir gets generalized to support multiple directories. Each '--rootfs-dir' could be connected using a special string, that should be present in .wks. I.e: wic create ... --rootfs-dir rootfs1=/some/rootfs/dir \ --rootfs-dir rootfs2=/some/other/rootfs/dir part / --source rootfs --rootfs-dir="rootfs1" --ondisk sda --fstype=ext3 \ --label primary --align 1024 part /standby --source rootfs --rootfs-dir="rootfs2" \ --ondisk sda --fstype=ext3 --label secondary --align 1024 The user could use harded-code directory instead of connectors. Like this: wic create ... hard-coded-path.wks -r /some/rootfs/dir part / --source rootfs --ondisk sda --fstype=ext3 --label primary --align 1024 part /standby --source rootfs --rootfs-dir=/some/rootfs/dir \ --ondisk sda --fstype=ext3 --label secondary --align 1024 Signed-off-by: João Henrique Ferreira de Freitas Signed-off-by: Richard Purdie --- scripts/lib/mic/plugins/imager/direct_plugin.py | 17 ++++++++++++++++- scripts/lib/mic/plugins/source/rootfs.py | 18 +++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'scripts/lib/mic/plugins') diff --git a/scripts/lib/mic/plugins/imager/direct_plugin.py b/scripts/lib/mic/plugins/imager/direct_plugin.py index e015256fa1..fc7c10c3df 100644 --- a/scripts/lib/mic/plugins/imager/direct_plugin.py +++ b/scripts/lib/mic/plugins/imager/direct_plugin.py @@ -42,6 +42,19 @@ from mic.pluginbase import ImagerPlugin class DirectPlugin(ImagerPlugin): name = 'direct' + @classmethod + def __rootfs_dir_to_dict(self, rootfs_dirs): + """ + Gets a string that contain 'connection=dir' splitted by + space and return a dict + """ + krootfs_dir = {} + for rootfs_dir in rootfs_dirs.split(' '): + k, v = rootfs_dir.split('=') + krootfs_dir[k] = v + + return krootfs_dir + @classmethod def do_create(self, subcmd, opts, *args): """ @@ -63,11 +76,13 @@ class DirectPlugin(ImagerPlugin): image_output_dir = args[7] oe_builddir = args[8] + krootfs_dir = self.__rootfs_dir_to_dict(rootfs_dir) + configmgr._ksconf = ksconf creator = direct.DirectImageCreator(oe_builddir, image_output_dir, - rootfs_dir, + krootfs_dir, bootimg_dir, kernel_dir, native_sysroot, diff --git a/scripts/lib/mic/plugins/source/rootfs.py b/scripts/lib/mic/plugins/source/rootfs.py index 6323811183..75999e03d2 100644 --- a/scripts/lib/mic/plugins/source/rootfs.py +++ b/scripts/lib/mic/plugins/source/rootfs.py @@ -45,14 +45,26 @@ class RootfsPlugin(SourcePlugin): @classmethod def do_prepare_partition(self, part, cr, cr_workdir, oe_builddir, bootimg_dir, - kernel_dir, rootfs_dir, native_sysroot): + kernel_dir, krootfs_dir, native_sysroot): """ Called to do the actual content population for a partition i.e. it 'prepares' the partition to be incorporated into the image. In this case, prepare content for legacy bios boot partition. """ - if part.rootfs: - rootfs_dir = part.rootfs + if part.rootfs is None: + if not 'ROOTFS_DIR' in krootfs_dir: + msg = "Couldn't find --rootfs-dir, exiting" + msger.error(msg) + rootfs_dir = krootfs_dir['ROOTFS_DIR'] + else: + if part.rootfs in krootfs_dir: + rootfs_dir = krootfs_dir[part.rootfs] + elif os.path.isdir(part.rootfs): + rootfs_dir = part.rootfs + else: + msg = "Couldn't find --rootfs-dir=%s connection" + msg += " or it is not a valid path, exiting" + msger.error(msg % part.rootfs) part.set_rootfs(rootfs_dir) part.prepare_rootfs(cr_workdir, oe_builddir, rootfs_dir, native_sysroot) -- cgit v1.2.3