diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-02-14 20:13:46 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-04 23:18:16 +0000 |
commit | 1dd8cca63102b1718609c5e2903e1ea468c4c469 (patch) | |
tree | f777759b24a40426cbfbf6332f65f8f7d16b52ad /scripts/lib/wic/plugins/source/bootimg-pcbios.py | |
parent | 7c163ada95d2b304371f4d7a5dbef73ac37c1836 (diff) | |
download | poky-1dd8cca63102b1718609c5e2903e1ea468c4c469.tar.gz |
wic: use wic logger in wic source plugins
Replaced msger with wic logger in wic source plugins.
(From OE-Core rev: 19a868e9ad12fb27a7f713685d12f3d310fd6961)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-pcbios.py')
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-pcbios.py | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index e5f6a328ed..590d3d6784 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py | |||
@@ -24,9 +24,10 @@ | |||
24 | # Tom Zanussi <tom.zanussi (at] linux.intel.com> | 24 | # Tom Zanussi <tom.zanussi (at] linux.intel.com> |
25 | # | 25 | # |
26 | 26 | ||
27 | import logging | ||
27 | import os | 28 | import os |
29 | import sys | ||
28 | 30 | ||
29 | from wic import msger | ||
30 | from wic.engine import get_custom_config | 31 | from wic.engine import get_custom_config |
31 | from wic.utils import runner | 32 | from wic.utils import runner |
32 | from wic.utils.errors import ImageError | 33 | from wic.utils.errors import ImageError |
@@ -34,6 +35,8 @@ from wic.pluginbase import SourcePlugin | |||
34 | from wic.utils.misc import (exec_cmd, exec_native_cmd, | 35 | from wic.utils.misc import (exec_cmd, exec_native_cmd, |
35 | get_bitbake_var, BOOTDD_EXTRA_SPACE) | 36 | get_bitbake_var, BOOTDD_EXTRA_SPACE) |
36 | 37 | ||
38 | logger = logging.getLogger('wic') | ||
39 | |||
37 | class BootimgPcbiosPlugin(SourcePlugin): | 40 | class BootimgPcbiosPlugin(SourcePlugin): |
38 | """ | 41 | """ |
39 | Create MBR boot partition and install syslinux on it. | 42 | Create MBR boot partition and install syslinux on it. |
@@ -54,16 +57,18 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
54 | elif creator.ptable_format == 'gpt': | 57 | elif creator.ptable_format == 'gpt': |
55 | mbrfile += "gptmbr.bin" | 58 | mbrfile += "gptmbr.bin" |
56 | else: | 59 | else: |
57 | msger.error("Unsupported partition table: %s" % creator.ptable_format) | 60 | logger.error("Unsupported partition table: %s", creator.ptable_format) |
61 | sys.exit(1) | ||
58 | 62 | ||
59 | if not os.path.exists(mbrfile): | 63 | if not os.path.exists(mbrfile): |
60 | msger.error("Couldn't find %s. If using the -e option, do you " | 64 | logger.error("Couldn't find %s. If using the -e option, do you " |
61 | "have the right MACHINE set in local.conf? If not, " | 65 | "have the right MACHINE set in local.conf? If not, " |
62 | "is the bootimg_dir path correct?" % mbrfile) | 66 | "is the bootimg_dir path correct?", mbrfile) |
67 | sys.exit(1) | ||
63 | 68 | ||
64 | full_path = creator._full_path(workdir, disk_name, "direct") | 69 | full_path = creator._full_path(workdir, disk_name, "direct") |
65 | msger.debug("Installing MBR on disk %s as %s with size %s bytes" \ | 70 | logger.debug("Installing MBR on disk %s as %s with size %s bytes", |
66 | % (disk_name, full_path, disk.min_size)) | 71 | disk_name, full_path, disk.min_size) |
67 | 72 | ||
68 | rcode = runner.show(['dd', 'if=%s' % mbrfile, | 73 | rcode = runner.show(['dd', 'if=%s' % mbrfile, |
69 | 'of=%s' % full_path, 'conv=notrunc']) | 74 | 'of=%s' % full_path, 'conv=notrunc']) |
@@ -90,11 +95,11 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
90 | if custom_cfg: | 95 | if custom_cfg: |
91 | # Use a custom configuration for grub | 96 | # Use a custom configuration for grub |
92 | syslinux_conf = custom_cfg | 97 | syslinux_conf = custom_cfg |
93 | msger.debug("Using custom configuration file " | 98 | logger.debug("Using custom configuration file %s " |
94 | "%s for syslinux.cfg" % bootloader.configfile) | 99 | "for syslinux.cfg", bootloader.configfile) |
95 | else: | 100 | else: |
96 | msger.error("configfile is specified but failed to " | 101 | logger.error("configfile is specified but failed to " |
97 | "get it from %s." % bootloader.configfile) | 102 | "get it from %s.", bootloader.configfile) |
98 | 103 | ||
99 | if not custom_cfg: | 104 | if not custom_cfg: |
100 | # Create syslinux configuration using parameters from wks file | 105 | # Create syslinux configuration using parameters from wks file |
@@ -122,8 +127,8 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
122 | syslinux_conf += "APPEND label=boot root=%s %s\n" % \ | 127 | syslinux_conf += "APPEND label=boot root=%s %s\n" % \ |
123 | (creator.rootdev, bootloader.append) | 128 | (creator.rootdev, bootloader.append) |
124 | 129 | ||
125 | msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \ | 130 | logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg", |
126 | % cr_workdir) | 131 | cr_workdir) |
127 | cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") | 132 | cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") |
128 | cfg.write(syslinux_conf) | 133 | cfg.write(syslinux_conf) |
129 | cfg.close() | 134 | cfg.close() |
@@ -147,9 +152,11 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
147 | if not _has_syslinux(bootimg_dir): | 152 | if not _has_syslinux(bootimg_dir): |
148 | bootimg_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools") | 153 | bootimg_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools") |
149 | if not bootimg_dir: | 154 | if not bootimg_dir: |
150 | msger.error("Couldn't find STAGING_DATADIR, exiting\n") | 155 | logger.error("Couldn't find STAGING_DATADIR, exiting\n") |
156 | sys.exit(1) | ||
151 | if not _has_syslinux(bootimg_dir): | 157 | if not _has_syslinux(bootimg_dir): |
152 | msger.error("Please build syslinux first\n") | 158 | logger.error("Please build syslinux first\n") |
159 | sys.exit(1) | ||
153 | # just so the result notes display it | 160 | # just so the result notes display it |
154 | creator.bootimg_dir = bootimg_dir | 161 | creator.bootimg_dir = bootimg_dir |
155 | 162 | ||
@@ -176,8 +183,8 @@ class BootimgPcbiosPlugin(SourcePlugin): | |||
176 | 183 | ||
177 | blocks += extra_blocks | 184 | blocks += extra_blocks |
178 | 185 | ||
179 | msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ | 186 | logger.debug("Added %d extra blocks to %s to get to %d total blocks", |
180 | (extra_blocks, part.mountpoint, blocks)) | 187 | extra_blocks, part.mountpoint, blocks) |
181 | 188 | ||
182 | # dosfs image, created by mkdosfs | 189 | # dosfs image, created by mkdosfs |
183 | bootimg = "%s/boot.img" % cr_workdir | 190 | bootimg = "%s/boot.img" % cr_workdir |