diff options
author | João Henrique Ferreira de Freitas <joaohf@gmail.com> | 2014-04-04 23:14:11 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-05-13 19:35:06 +0100 |
commit | 58417093d7ce83c8a2f683a356fddc23aaee5e8e (patch) | |
tree | 56df8f2b6b0eed9f7179cbf3f6ff0dcdcb2c4361 | |
parent | b8e51f73bc8e67ca60b7dd8d67091257aad62efd (diff) | |
download | openembedded-core-58417093d7ce83c8a2f683a356fddc23aaee5e8e.tar.gz openembedded-core-58417093d7ce83c8a2f683a356fddc23aaee5e8e.tar.bz2 openembedded-core-58417093d7ce83c8a2f683a356fddc23aaee5e8e.zip |
wic: Extend indirect string connection to support image names and rootfs
The wic command-line param --rootfs-dir gets extended to support
multiple directories and image names. Each '--rootfs-dir' could be
connected using a special string. This special string is a image
name which gets expanded by bitbake to get 'IMAGE_ROOTFS' or
a rootfs-dir path pointing to rootfs directory. Like this:
wic create ... --rootfs-dir rootfs1=core-image-minimal \
--rootfs-dir rootfs2=core-image-minimal-dev
.wks:
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
Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/mic/plugins/source/rootfs.py | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/scripts/lib/mic/plugins/source/rootfs.py b/scripts/lib/mic/plugins/source/rootfs.py index 75999e03d2..a4d4547318 100644 --- a/scripts/lib/mic/plugins/source/rootfs.py +++ b/scripts/lib/mic/plugins/source/rootfs.py @@ -43,6 +43,25 @@ from mic.imager.direct import DirectImageCreator class RootfsPlugin(SourcePlugin): name = 'rootfs' + @staticmethod + def __get_rootfs_dir(rootfs_dir): + if os.path.isdir(rootfs_dir): + return rootfs_dir + + bitbake_env_lines = find_bitbake_env_lines(rootfs_dir) + if not bitbake_env_lines: + msg = "Couldn't get bitbake environment, exiting." + msger.error(msg) + + image_rootfs_dir = find_artifact(bitbake_env_lines, "IMAGE_ROOTFS") + if not os.path.isdir(image_rootfs_dir): + msg = "No valid artifact IMAGE_ROOTFS from image named" + msg += " %s has been found at %s, exiting.\n" % \ + (rootfs_dir, image_rootfs_dir) + msger.error(msg) + + return image_rootfs_dir + @classmethod def do_prepare_partition(self, part, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, krootfs_dir, native_sysroot): @@ -59,13 +78,15 @@ class RootfsPlugin(SourcePlugin): else: if part.rootfs in krootfs_dir: rootfs_dir = krootfs_dir[part.rootfs] - elif os.path.isdir(part.rootfs): + elif 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) + real_rootfs_dir = self.__get_rootfs_dir(rootfs_dir) + + part.set_rootfs(real_rootfs_dir) + part.prepare_rootfs(cr_workdir, oe_builddir, real_rootfs_dir, native_sysroot) |