diff options
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-partition.py')
| -rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-partition.py | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py index 9480eed6d8..364b189758 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py | |||
| @@ -44,27 +44,17 @@ class BootimgPartitionPlugin(SourcePlugin): | |||
| 44 | name = 'bootimg-partition' | 44 | name = 'bootimg-partition' |
| 45 | 45 | ||
| 46 | @classmethod | 46 | @classmethod |
| 47 | def do_prepare_partition(cls, part, source_params, cr, cr_workdir, | 47 | def do_configure_partition(cls, part, source_params, cr, cr_workdir, |
| 48 | oe_builddir, bootimg_dir, kernel_dir, | 48 | oe_builddir, bootimg_dir, kernel_dir, |
| 49 | rootfs_dir, native_sysroot): | 49 | native_sysroot): |
| 50 | """ | 50 | """ |
| 51 | Called to do the actual content population for a partition i.e. it | 51 | Called before do_prepare_partition() |
| 52 | 'prepares' the partition to be incorporated into the image. | ||
| 53 | In this case, does the following: | ||
| 54 | - sets up a vfat partition | ||
| 55 | - copies all files listed in IMAGE_BOOT_FILES variable | ||
| 56 | """ | 52 | """ |
| 57 | hdddir = "%s/boot.%d" % (cr_workdir, part.lineno) | ||
| 58 | install_cmd = "install -d %s" % hdddir | ||
| 59 | exec_cmd(install_cmd) | ||
| 60 | |||
| 61 | if not kernel_dir: | 53 | if not kernel_dir: |
| 62 | kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") | 54 | kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") |
| 63 | if not kernel_dir: | 55 | if not kernel_dir: |
| 64 | raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") | 56 | raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") |
| 65 | 57 | ||
| 66 | logger.debug('Kernel dir: %s', bootimg_dir) | ||
| 67 | |||
| 68 | boot_files = None | 58 | boot_files = None |
| 69 | for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)): | 59 | for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)): |
| 70 | if fmt: | 60 | if fmt: |
| @@ -94,9 +84,9 @@ class BootimgPartitionPlugin(SourcePlugin): | |||
| 94 | logger.debug('Destination entry: %r', dst_entry) | 84 | logger.debug('Destination entry: %r', dst_entry) |
| 95 | deploy_files.append(dst_entry) | 85 | deploy_files.append(dst_entry) |
| 96 | 86 | ||
| 87 | cls.install_task = []; | ||
| 97 | for deploy_entry in deploy_files: | 88 | for deploy_entry in deploy_files: |
| 98 | src, dst = deploy_entry | 89 | src, dst = deploy_entry |
| 99 | install_task = [] | ||
| 100 | if '*' in src: | 90 | if '*' in src: |
| 101 | # by default install files under their basename | 91 | # by default install files under their basename |
| 102 | entry_name_fn = os.path.basename | 92 | entry_name_fn = os.path.basename |
| @@ -113,17 +103,40 @@ class BootimgPartitionPlugin(SourcePlugin): | |||
| 113 | for entry in srcs: | 103 | for entry in srcs: |
| 114 | src = os.path.relpath(entry, kernel_dir) | 104 | src = os.path.relpath(entry, kernel_dir) |
| 115 | entry_dst_name = entry_name_fn(entry) | 105 | entry_dst_name = entry_name_fn(entry) |
| 116 | install_task.append((src, entry_dst_name))) | 106 | cls.install_task.append((src, entry_dst_name)) |
| 117 | else: | 107 | else: |
| 118 | install_task = [(src, dst)] | 108 | cls.install_task.append((src, dst)) |
| 119 | 109 | ||
| 120 | for task in install_task: | 110 | @classmethod |
| 121 | src_path, dst_path = task | 111 | def do_prepare_partition(cls, part, source_params, cr, cr_workdir, |
| 122 | logger.debug('Install %s as %s', src_path, dst_path) | 112 | oe_builddir, bootimg_dir, kernel_dir, |
| 123 | install_cmd = "install -m 0644 -D %s %s" \ | 113 | rootfs_dir, native_sysroot): |
| 124 | % (os.path.join(kernel_dir, src_path), | 114 | """ |
| 125 | os.path.join(hdddir, dst_path)) | 115 | Called to do the actual content population for a partition i.e. it |
| 126 | exec_cmd(install_cmd) | 116 | 'prepares' the partition to be incorporated into the image. |
| 117 | In this case, does the following: | ||
| 118 | - sets up a vfat partition | ||
| 119 | - copies all files listed in IMAGE_BOOT_FILES variable | ||
| 120 | """ | ||
| 121 | hdddir = "%s/boot.%d" % (cr_workdir, part.lineno) | ||
| 122 | install_cmd = "install -d %s" % hdddir | ||
| 123 | exec_cmd(install_cmd) | ||
| 124 | |||
| 125 | if not kernel_dir: | ||
| 126 | kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") | ||
| 127 | if not kernel_dir: | ||
| 128 | raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") | ||
| 129 | |||
| 130 | logger.debug('Kernel dir: %s', bootimg_dir) | ||
| 131 | |||
| 132 | |||
| 133 | for task in cls.install_task: | ||
| 134 | src_path, dst_path = task | ||
| 135 | logger.debug('Install %s as %s', src_path, dst_path) | ||
| 136 | install_cmd = "install -m 0644 -D %s %s" \ | ||
| 137 | % (os.path.join(kernel_dir, src_path), | ||
| 138 | os.path.join(hdddir, dst_path)) | ||
| 139 | exec_cmd(install_cmd) | ||
| 127 | 140 | ||
| 128 | logger.debug('Prepare boot partition using rootfs in %s', hdddir) | 141 | logger.debug('Prepare boot partition using rootfs in %s', hdddir) |
| 129 | part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, | 142 | part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, |
