diff options
| -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 | |||
| 43 | class RootfsPlugin(SourcePlugin): | 43 | class RootfsPlugin(SourcePlugin): |
| 44 | name = 'rootfs' | 44 | name = 'rootfs' |
| 45 | 45 | ||
| 46 | @staticmethod | ||
| 47 | def __get_rootfs_dir(rootfs_dir): | ||
| 48 | if os.path.isdir(rootfs_dir): | ||
| 49 | return rootfs_dir | ||
| 50 | |||
| 51 | bitbake_env_lines = find_bitbake_env_lines(rootfs_dir) | ||
| 52 | if not bitbake_env_lines: | ||
| 53 | msg = "Couldn't get bitbake environment, exiting." | ||
| 54 | msger.error(msg) | ||
| 55 | |||
| 56 | image_rootfs_dir = find_artifact(bitbake_env_lines, "IMAGE_ROOTFS") | ||
| 57 | if not os.path.isdir(image_rootfs_dir): | ||
| 58 | msg = "No valid artifact IMAGE_ROOTFS from image named" | ||
| 59 | msg += " %s has been found at %s, exiting.\n" % \ | ||
| 60 | (rootfs_dir, image_rootfs_dir) | ||
| 61 | msger.error(msg) | ||
| 62 | |||
| 63 | return image_rootfs_dir | ||
| 64 | |||
| 46 | @classmethod | 65 | @classmethod |
| 47 | def do_prepare_partition(self, part, cr, cr_workdir, oe_builddir, bootimg_dir, | 66 | def do_prepare_partition(self, part, cr, cr_workdir, oe_builddir, bootimg_dir, |
| 48 | kernel_dir, krootfs_dir, native_sysroot): | 67 | kernel_dir, krootfs_dir, native_sysroot): |
| @@ -59,13 +78,15 @@ class RootfsPlugin(SourcePlugin): | |||
| 59 | else: | 78 | else: |
| 60 | if part.rootfs in krootfs_dir: | 79 | if part.rootfs in krootfs_dir: |
| 61 | rootfs_dir = krootfs_dir[part.rootfs] | 80 | rootfs_dir = krootfs_dir[part.rootfs] |
| 62 | elif os.path.isdir(part.rootfs): | 81 | elif part.rootfs: |
| 63 | rootfs_dir = part.rootfs | 82 | rootfs_dir = part.rootfs |
| 64 | else: | 83 | else: |
| 65 | msg = "Couldn't find --rootfs-dir=%s connection" | 84 | msg = "Couldn't find --rootfs-dir=%s connection" |
| 66 | msg += " or it is not a valid path, exiting" | 85 | msg += " or it is not a valid path, exiting" |
| 67 | msger.error(msg % part.rootfs) | 86 | msger.error(msg % part.rootfs) |
| 68 | 87 | ||
| 69 | part.set_rootfs(rootfs_dir) | 88 | real_rootfs_dir = self.__get_rootfs_dir(rootfs_dir) |
| 70 | part.prepare_rootfs(cr_workdir, oe_builddir, rootfs_dir, native_sysroot) | 89 | |
| 90 | part.set_rootfs(real_rootfs_dir) | ||
| 91 | part.prepare_rootfs(cr_workdir, oe_builddir, real_rootfs_dir, native_sysroot) | ||
| 71 | 92 | ||
