diff options
Diffstat (limited to 'scripts/lib/wic/plugins/source')
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg_pcbios.py | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg_pcbios.py b/scripts/lib/wic/plugins/source/bootimg_pcbios.py index 6bde7a67d3..9ad301b008 100644 --- a/scripts/lib/wic/plugins/source/bootimg_pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg_pcbios.py | |||
@@ -55,36 +55,6 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
55 | bootimg_dir, kernel_dir, native_sysroot) | 55 | bootimg_dir, kernel_dir, native_sysroot) |
56 | 56 | ||
57 | @classmethod | 57 | @classmethod |
58 | def _do_install_syslinux(cls, disk, disk_name, creator, workdir, oe_builddir, | ||
59 | bootimg_dir, kernel_dir, native_sysroot): | ||
60 | """ | ||
61 | Called after all partitions have been prepared and assembled into a | ||
62 | disk image. In this case, we install the MBR. | ||
63 | """ | ||
64 | |||
65 | bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux') | ||
66 | mbrfile = "%s/syslinux/" % bootimg_dir | ||
67 | if creator.ptable_format == 'msdos': | ||
68 | mbrfile += "mbr.bin" | ||
69 | elif creator.ptable_format == 'gpt': | ||
70 | mbrfile += "gptmbr.bin" | ||
71 | else: | ||
72 | raise WicError("Unsupported partition table: %s" % | ||
73 | creator.ptable_format) | ||
74 | |||
75 | if not os.path.exists(mbrfile): | ||
76 | raise WicError("Couldn't find %s. If using the -e option, do you " | ||
77 | "have the right MACHINE set in local.conf? If not, " | ||
78 | "is the bootimg_dir path correct?" % mbrfile) | ||
79 | |||
80 | full_path = creator._full_path(workdir, disk_name, "direct") | ||
81 | logger.debug("Installing MBR on disk %s as %s with size %s bytes", | ||
82 | disk_name, full_path, disk.min_size) | ||
83 | |||
84 | dd_cmd = "dd if=%s of=%s conv=notrunc" % (mbrfile, full_path) | ||
85 | exec_cmd(dd_cmd, native_sysroot) | ||
86 | |||
87 | @classmethod | ||
88 | def do_configure_partition(cls, part, source_params, creator, cr_workdir, | 58 | def do_configure_partition(cls, part, source_params, creator, cr_workdir, |
89 | oe_builddir, bootimg_dir, kernel_dir, | 59 | oe_builddir, bootimg_dir, kernel_dir, |
90 | native_sysroot): | 60 | native_sysroot): |
@@ -94,6 +64,15 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
94 | native_sysroot) | 64 | native_sysroot) |
95 | 65 | ||
96 | @classmethod | 66 | @classmethod |
67 | def do_prepare_partition(cls, part, source_params, creator, cr_workdir, | ||
68 | oe_builddir, bootimg_dir, kernel_dir, | ||
69 | rootfs_dir, native_sysroot): | ||
70 | |||
71 | cls._do_prepare_syslinux(part, source_params, creator, cr_workdir, | ||
72 | oe_builddir, bootimg_dir, kernel_dir, | ||
73 | rootfs_dir, native_sysroot) | ||
74 | |||
75 | @classmethod | ||
97 | def _do_configure_syslinux(cls, part, source_params, creator, cr_workdir, | 76 | def _do_configure_syslinux(cls, part, source_params, creator, cr_workdir, |
98 | oe_builddir, bootimg_dir, kernel_dir, | 77 | oe_builddir, bootimg_dir, kernel_dir, |
99 | native_sysroot): | 78 | native_sysroot): |
@@ -153,15 +132,6 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
153 | cfg.close() | 132 | cfg.close() |
154 | 133 | ||
155 | @classmethod | 134 | @classmethod |
156 | def do_prepare_partition(cls, part, source_params, creator, cr_workdir, | ||
157 | oe_builddir, bootimg_dir, kernel_dir, | ||
158 | rootfs_dir, native_sysroot): | ||
159 | |||
160 | cls._do_prepare_syslinux(part, source_params, creator, cr_workdir, | ||
161 | oe_builddir, bootimg_dir, kernel_dir, | ||
162 | rootfs_dir, native_sysroot) | ||
163 | |||
164 | @classmethod | ||
165 | def _do_prepare_syslinux(cls, part, source_params, creator, cr_workdir, | 135 | def _do_prepare_syslinux(cls, part, source_params, creator, cr_workdir, |
166 | oe_builddir, bootimg_dir, kernel_dir, | 136 | oe_builddir, bootimg_dir, kernel_dir, |
167 | rootfs_dir, native_sysroot): | 137 | rootfs_dir, native_sysroot): |
@@ -234,3 +204,33 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
234 | 204 | ||
235 | part.size = int(bootimg_size) | 205 | part.size = int(bootimg_size) |
236 | part.source_file = bootimg | 206 | part.source_file = bootimg |
207 | |||
208 | @classmethod | ||
209 | def _do_install_syslinux(cls, disk, disk_name, creator, workdir, oe_builddir, | ||
210 | bootimg_dir, kernel_dir, native_sysroot): | ||
211 | """ | ||
212 | Called after all partitions have been prepared and assembled into a | ||
213 | disk image. In this case, we install the MBR. | ||
214 | """ | ||
215 | |||
216 | bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux') | ||
217 | mbrfile = "%s/syslinux/" % bootimg_dir | ||
218 | if creator.ptable_format == 'msdos': | ||
219 | mbrfile += "mbr.bin" | ||
220 | elif creator.ptable_format == 'gpt': | ||
221 | mbrfile += "gptmbr.bin" | ||
222 | else: | ||
223 | raise WicError("Unsupported partition table: %s" % | ||
224 | creator.ptable_format) | ||
225 | |||
226 | if not os.path.exists(mbrfile): | ||
227 | raise WicError("Couldn't find %s. If using the -e option, do you " | ||
228 | "have the right MACHINE set in local.conf? If not, " | ||
229 | "is the bootimg_dir path correct?" % mbrfile) | ||
230 | |||
231 | full_path = creator._full_path(workdir, disk_name, "direct") | ||
232 | logger.debug("Installing MBR on disk %s as %s with size %s bytes", | ||
233 | disk_name, full_path, disk.min_size) | ||
234 | |||
235 | dd_cmd = "dd if=%s of=%s conv=notrunc" % (mbrfile, full_path) | ||
236 | exec_cmd(dd_cmd, native_sysroot) | ||