本文整理汇总了Python中wic.msger.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: do_install_disk
def do_install_disk(cls, disk, disk_name, image_creator, workdir, oe_builddir,
bootimg_dir, kernel_dir, native_sysroot):
"""
Assemble partitions to disk image
Called after all partitions have been prepared and assembled into a
disk image. In this case, we install the MBR.
"""
mbrfile = os.path.join(native_sysroot, "usr/share/syslinux/")
if image_creator.ptable_format == 'msdos':
mbrfile += "mbr.bin"
elif image_creator.ptable_format == 'gpt':
mbrfile += "gptmbr.bin"
else:
msger.error("Unsupported partition table: %s" % \
image_creator.ptable_format)
if not os.path.exists(mbrfile):
msger.error("Couldn't find %s. Has syslinux-native been baked?" % mbrfile)
full_path = disk['disk'].device
msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
% (disk_name, full_path, disk['min_size']))
ret_code = runner.show(['dd', 'if=%s' % mbrfile, 'of=%s' % full_path, 'conv=notrunc'])
if ret_code != 0:
raise ImageError("Unable to set MBR to %s" % full_path)
开发者ID:Brainbuster,项目名称:openpli-buildumgebung,代码行数:27,代码来源:rootfs_pcbios_ext.py
示例2: do_install_disk
def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
bootimg_dir, kernel_dir, native_sysroot):
"""
Called after all partitions have been prepared and assembled into a
disk image. In this case, we insert/modify the MBR using isohybrid
utility for booting via BIOS from disk storage devices.
"""
full_path = creator._full_path(workdir, disk_name, "direct")
iso_img = "%s.p1" % full_path
full_path_iso = creator._full_path(workdir, disk_name, "iso")
isohybrid_cmd = "isohybrid -u %s" % iso_img
msger.debug("running command: %s" % \
isohybrid_cmd)
exec_native_cmd(isohybrid_cmd, native_sysroot)
# Replace the image created by direct plugin with the one created by
# mkisofs command. This is necessary because the iso image created by
# mkisofs has a very specific MBR is system area of the ISO image, and
# direct plugin adds and configures an another MBR.
msger.debug("Replaceing the image created by direct plugin\n")
os.remove(full_path)
shutil.copy2(iso_img, full_path_iso)
shutil.copy2(full_path_iso, full_path)
# Remove temporary ISO file
os.remove(iso_img)
开发者ID:KenChenIEC,项目名称:openbmc,代码行数:28,代码来源:isoimage-isohybrid.py
示例3: exec_native_cmd
def exec_native_cmd(cmd_and_args, native_sysroot, catch = 3):
"""
Execute native command, catching stderr, stdout
Need to execute as_shell if the command uses wildcards
Always need to execute native commands as_shell
"""
native_paths = \
"export PATH=%s/sbin:%s/usr/sbin:%s/usr/bin" % \
(native_sysroot, native_sysroot, native_sysroot)
native_cmd_and_args = "%s;%s" % (native_paths, cmd_and_args)
msger.debug("exec_native_cmd: %s" % cmd_and_args)
args = cmd_and_args.split()
msger.debug(args)
rc, out = __exec_cmd(native_cmd_and_args, True, catch)
if rc == 127: # shell command-not-found
msger.error("A native program %s required to build the image "
"was not found (see details above). Please make sure "
"it's installed and try again." % args[0])
return (rc, out)
开发者ID:sheungkim,项目名称:openembedded-core,代码行数:25,代码来源:misc.py
示例4: do_configure_partition
def do_configure_partition(cls, part, source_params, image_creator,
image_creator_workdir, oe_builddir, bootimg_dir,
kernel_dir, native_sysroot):
"""
Creates syslinux config in rootfs directory
Called before do_prepare_partition()
"""
options = image_creator.ks.handler.bootloader.appendLine
syslinux_conf = ""
syslinux_conf += "PROMPT 0\n"
timeout = kickstart.get_timeout(image_creator.ks)
if not timeout:
timeout = 0
syslinux_conf += "TIMEOUT " + str(timeout) + "\n"
syslinux_conf += "ALLOWOPTIONS 1\n"
# Derive SERIAL... line from from kernel boot parameters
syslinux_conf += syslinux.serial_console_form_kargs(options) + "\n"
syslinux_conf += "DEFAULT linux\n"
syslinux_conf += "LABEL linux\n"
syslinux_conf += " KERNEL /boot/bzImage\n"
syslinux_conf += " APPEND label=boot root=%s %s\n" % \
(image_creator.rootdev, options)
syslinux_cfg = os.path.join(image_creator.rootfs_dir['ROOTFS_DIR'], "boot", "syslinux.cfg")
msger.debug("Writing syslinux config %s" % syslinux_cfg)
with open(syslinux_cfg, "w") as cfg:
cfg.write(syslinux_conf)
开发者ID:Brainbuster,项目名称:openpli-buildumgebung,代码行数:33,代码来源:rootfs_pcbios_ext.py
示例5: do_prepare_partition
def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
rootfs_dir, native_sysroot):
"""
Called to do the actual content population for a partition i.e. it
'prepares' the partition to be incorporated into the image.
"""
if not bootimg_dir:
bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
if not bootimg_dir:
msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
msger.debug('Bootimg dir: %s' % bootimg_dir)
if 'file' not in source_params:
msger.error("No file specified\n")
return
src = os.path.join(bootimg_dir, source_params['file'])
dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno))
if 'skip' in source_params:
sparse_copy(src, dst, skip=source_params['skip'])
else:
sparse_copy(src, dst)
# get the size in the right units for kickstart (kB)
du_cmd = "du -Lbks %s" % dst
out = exec_cmd(du_cmd)
filesize = out.split()[0]
if int(filesize) > int(part.size):
part.size = filesize
part.source_file = dst
开发者ID:agangidi53,项目名称:openbmc,代码行数:35,代码来源:rawcopy.py
示例6: do_install_disk
def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir, bootimg_dir, kernel_dir, native_sysroot):
"""
Called after all partitions have been prepared and assembled into a
disk image. This provides a hook to allow finalization of a
disk image e.g. to write an MBR to it.
"""
msger.debug("SourcePlugin: do_install_disk: disk: %s" % disk_name)
开发者ID:kanjiviroja,项目名称:openembedded,代码行数:7,代码来源:pluginbase.py
示例7: do_install_disk
def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
bootimg_dir, kernel_dir, native_sysroot):
"""
Called after all partitions have been prepared and assembled into a
disk image. In this case, we install the MBR.
"""
mbrfile = "%s/syslinux/" % bootimg_dir
if creator.ptable_format == 'msdos':
mbrfile += "mbr.bin"
elif creator.ptable_format == 'gpt':
mbrfile += "gptmbr.bin"
else:
msger.error("Unsupported partition table: %s" % creator.ptable_format)
if not os.path.exists(mbrfile):
msger.error("Couldn't find %s. If using the -e option, do you "
"have the right MACHINE set in local.conf? If not, "
"is the bootimg_dir path correct?" % mbrfile)
full_path = creator._full_path(workdir, disk_name, "direct")
msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
% (disk_name, full_path, disk['min_size']))
rcode = runner.show(['dd', 'if=%s' % mbrfile,
'of=%s' % full_path, 'conv=notrunc'])
if rcode != 0:
raise ImageError("Unable to set MBR to %s" % full_path)
开发者ID:nathanrossi,项目名称:meta-random,代码行数:27,代码来源:bootimg-initramfs-pcbios.py
示例8: finalize
def finalize(self):
"""
Finalize the disk image.
For example, prepare the image to be bootable by e.g.
creating and installing a bootloader configuration.
"""
source_plugin = self.get_default_source_plugin()
if source_plugin:
self._source_methods = pluginmgr.get_source_plugin_methods(source_plugin, disk_methods)
for disk_name, disk in self.__image.disks.items():
self._source_methods["do_install_disk"](disk, disk_name, self,
self.workdir,
self.oe_builddir,
self.bootimg_dir,
self.kernel_dir,
self.native_sysroot)
# Compress the image
if self.compressor:
for disk_name, disk in self.__image.disks.items():
full_path = self._full_path(self.__imgdir, disk_name, "direct")
msger.debug("Compressing disk %s with %s" % \
(disk_name, self.compressor))
exec_cmd("%s %s" % (self.compressor, full_path))
开发者ID:Technux,项目名称:poky,代码行数:25,代码来源:direct.py
示例9: do_configure_grubefi
def do_configure_grubefi(cls, hdddir, cr, cr_workdir):
"""
Create loader-specific (grub-efi) config
"""
splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
if os.path.exists(splash):
splashline = "menu background splash.jpg"
else:
splashline = ""
options = cr.ks.handler.bootloader.appendLine
grubefi_conf = ""
grubefi_conf += "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\n"
grubefi_conf += "default=boot\n"
timeout = kickstart.get_timeout(cr.ks)
if not timeout:
timeout = 0
grubefi_conf += "timeout=%s\n" % timeout
grubefi_conf += "menuentry 'boot'{\n"
kernel = "/bzImage"
grubefi_conf += "linux %s root=%s rootwait %s\n" % (kernel, cr.rootdev, options)
grubefi_conf += "}\n"
msger.debug("Writing grubefi config %s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir)
cfg = open("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "w")
cfg.write(grubefi_conf)
cfg.close()
开发者ID:ajaypai,项目名称:oe-core,代码行数:30,代码来源:bootimg-efi.py
示例10: do_configure_syslinux
def do_configure_syslinux(cls, creator, cr_workdir):
"""
Create loader-specific (syslinux) config
"""
splash = os.path.join(cr_workdir, "/ISO/boot/splash.jpg")
if os.path.exists(splash):
splashline = "menu background splash.jpg"
else:
splashline = ""
bootloader = creator.ks.bootloader
syslinux_conf = ""
syslinux_conf += "PROMPT 0\n"
syslinux_conf += "TIMEOUT %s \n" % (bootloader.timeout or 10)
syslinux_conf += "\n"
syslinux_conf += "ALLOWOPTIONS 1\n"
syslinux_conf += "SERIAL 0 115200\n"
syslinux_conf += "\n"
if splashline:
syslinux_conf += "%s\n" % splashline
syslinux_conf += "DEFAULT boot\n"
syslinux_conf += "LABEL boot\n"
kernel = "/bzImage"
syslinux_conf += "KERNEL " + kernel + "\n"
syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" \
% bootloader.append
msger.debug("Writing syslinux config %s/ISO/isolinux/isolinux.cfg" \
% cr_workdir)
with open("%s/ISO/isolinux/isolinux.cfg" % cr_workdir, "w") as cfg:
cfg.write(syslinux_conf)
开发者ID:KenChenIEC,项目名称:openbmc,代码行数:33,代码来源:isoimage-isohybrid.py
示例11: do_prepare_partition
def do_prepare_partition(self, part, source_params, cr, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir, rootfs_dir,
native_sysroot):
"""
Called to do the actual content population for a partition i.e. it
'prepares' the partition to be incorporated into the image.
"""
msger.debug("SourcePlugin: do_prepare_partition: part: %s" % part)
开发者ID:Brainbuster,项目名称:openpli-buildumgebung,代码行数:8,代码来源:pluginbase.py
示例12: assemble
def assemble(self):
"""
Assemble partitions into disk image(s)
"""
for disk_name, disk in self.__image.disks.items():
full_path = self._full_path(self.__imgdir, disk_name, "direct")
msger.debug("Assembling disk %s as %s with size %s bytes" % (disk_name, full_path, disk["min_size"]))
self.__image.assemble(full_path)
开发者ID:carosio,项目名称:poky,代码行数:8,代码来源:direct.py
示例13: do_prepare_partition
def do_prepare_partition(self, part, source_params, cr, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
rootfs_dir, native_sysroot):
"""
Called to do the actual content population for a partition i.e. it
'prepares' the partition to be incorporated into the image.
In this case, does the following:
- sets up a vfat partition
- copies all files listed in IMAGE_BOOT_FILES variable
"""
hdddir = "%s/boot" % cr_workdir
rm_cmd = "rm -rf %s" % cr_workdir
exec_cmd(rm_cmd)
install_cmd = "install -d %s" % hdddir
exec_cmd(install_cmd)
if not bootimg_dir:
bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
if not bootimg_dir:
msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
msger.debug('Bootimg dir: %s' % bootimg_dir)
boot_files = get_bitbake_var("IMAGE_BOOT_FILES")
if not boot_files:
msger.error('No boot files defined, IMAGE_BOOT_FILES unset')
msger.debug('Boot files: %s' % boot_files)
# list of tuples (src_name, dst_name)
deploy_files = []
for src_entry in re.findall(r'[\w;\-\./]+', boot_files):
if ';' in src_entry:
dst_entry = tuple(src_entry.split(';'))
if not dst_entry[0] or not dst_entry[1]:
msger.error('Malformed boot file entry: %s' % (src_entry))
else:
dst_entry = (src_entry, src_entry)
msger.debug('Destination entry: %r' % (dst_entry,))
deploy_files.append(dst_entry)
for deploy_entry in deploy_files:
src, dst = deploy_entry
src_path = os.path.join(bootimg_dir, src)
dst_path = os.path.join(hdddir, dst)
msger.debug('Install %s as %s' % (os.path.basename(src_path),
dst_path))
install_cmd = "install -m 0644 -D %s %s" \
% (src_path, dst_path)
exec_cmd(install_cmd)
msger.debug('Prepare boot partition using rootfs in %s' % (hdddir))
part.prepare_rootfs(cr_workdir, oe_builddir, hdddir,
native_sysroot)
开发者ID:feramo,项目名称:qylp,代码行数:58,代码来源:bootimg-partition.py
示例14: _create
def _create(self):
"""
For 'wic', we already have our build artifacts - we just create
filesystems from the artifacts directly and combine them into
a partitioned image.
"""
parts = self._get_parts()
self.__image = Image(self.native_sysroot)
for p in parts:
# as a convenience, set source to the boot partition source
# instead of forcing it to be set via bootloader --source
if not self.ks.handler.bootloader.source and p.mountpoint == "/boot":
self.ks.handler.bootloader.source = p.source
fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
for p in parts:
# need to create the filesystems in order to get their
# sizes before we can add them and do the layout.
# Image.create() actually calls __format_disks() to create
# the disk images and carve out the partitions, then
# self.assemble() calls Image.assemble() which calls
# __write_partitition() for each partition to dd the fs
# into the partitions.
p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir,
self.bootimg_dir, self.kernel_dir, self.native_sysroot)
self.__image.add_partition(int(p.size),
p.disk,
p.mountpoint,
p.source_file,
p.fstype,
p.label,
fsopts=p.fsopts,
boot=p.active,
align=p.align,
no_table=p.no_table,
part_type=p.part_type,
uuid=p.uuid)
if fstab_path:
shutil.move(fstab_path + ".orig", fstab_path)
self.__image.layout_partitions(self.ptable_format)
self.__imgdir = self.workdir
for disk_name, disk in self.__image.disks.items():
full_path = self._full_path(self.__imgdir, disk_name, "direct")
msger.debug("Adding disk %s as %s with size %s bytes" \
% (disk_name, full_path, disk['min_size']))
disk_obj = fs_related.DiskImage(full_path, disk['min_size'])
self.__disks[disk_name] = disk_obj
self.__image.add_disk(disk_name, disk_obj)
self.__image.create()
开发者ID:Technux,项目名称:poky,代码行数:58,代码来源:direct.py
示例15: do_configure_partition
def do_configure_partition(cls, part, source_params, creator, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
"""
Called before do_prepare_partition(), creates syslinux config
"""
hdddir = "%s/hdd/boot" % cr_workdir
rm_cmd = "rm -rf " + cr_workdir
exec_cmd(rm_cmd)
install_cmd = "install -d %s" % hdddir
exec_cmd(install_cmd)
bootloader = creator.ks.bootloader
custom_cfg = None
if bootloader.configfile:
custom_cfg = get_custom_config(bootloader.configfile)
if custom_cfg:
# Use a custom configuration for grub
syslinux_conf = custom_cfg
msger.debug("Using custom configuration file "
"%s for syslinux.cfg" % bootloader.configfile)
else:
msger.error("configfile is specified but failed to "
"get it from %s." % bootloader.configfile)
if not custom_cfg:
# Create syslinux configuration using parameters from wks file
splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg")
if os.path.exists(splash):
splashline = "menu background splash.jpg"
else:
splashline = ""
syslinux_conf = ""
syslinux_conf += "PROMPT 0\n"
syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n"
syslinux_conf += "\n"
syslinux_conf += "ALLOWOPTIONS 1\n"
syslinux_conf += "SERIAL 0 115200\n"
syslinux_conf += "\n"
if splashline:
syslinux_conf += "%s\n" % splashline
syslinux_conf += "DEFAULT boot\n"
syslinux_conf += "LABEL boot\n"
kernel = "/vmlinuz"
syslinux_conf += "KERNEL " + kernel + "\n"
syslinux_conf += "APPEND label=boot root=%s %s\n" % \
(creator.rootdev, bootloader.append)
msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \
% cr_workdir)
cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w")
cfg.write(syslinux_conf)
cfg.close()
开发者ID:carosio,项目名称:poky,代码行数:58,代码来源:bootimg-pcbios.py
示例16: _add_plugindir
def _add_plugindir(self, path):
path = os.path.abspath(os.path.expanduser(path))
if not os.path.isdir(path):
msger.debug("Plugin dir is not a directory or does not exist: %s" % path)
return
if path not in self.plugin_dirs:
self.plugin_dirs[path] = False
开发者ID:rtollert,项目名称:openembedded-core,代码行数:9,代码来源:plugin.py
示例17: do_configure_partition
def do_configure_partition(self, part, source_params, cr, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
"""
Called before do_prepare_partition(), typically used to create
custom configuration files for a partition, for example
syslinux or grub config files.
"""
msger.debug("SourcePlugin: do_configure_partition: part: %s" % part)
开发者ID:Brainbuster,项目名称:openpli-buildumgebung,代码行数:9,代码来源:pluginbase.py
示例18: assemble
def assemble(self, image_file):
msger.debug("Installing partitions")
self.image_file = image_file
for p in self.partitions:
d = self.disks[p['disk_name']]
self.__write_partition(p['num'], p['source_file'],
p['start'], p['size'])
开发者ID:Brainbuster,项目名称:opennfr-buildumgebung,代码行数:10,代码来源:partitionedfs.py
示例19: do_configure_partition
def do_configure_partition(self, part, source_params, cr, cr_workdir,
oe_builddir, bootimg_dir, kernel_dir,
native_sysroot):
"""
Called before do_prepare_partition(), creates syslinux config
"""
hdddir = "%s/hdd/boot" % cr_workdir
rm_cmd = "rm -rf " + cr_workdir
exec_cmd(rm_cmd)
install_cmd = "install -d %s" % hdddir
exec_cmd(install_cmd)
splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg")
if os.path.exists(splash):
splashline = "menu background splash.jpg"
else:
splashline = ""
(rootdev, root_part_uuid) = cr._get_boot_config()
options = cr.ks.handler.bootloader.appendLine
syslinux_conf = ""
syslinux_conf += "PROMPT 0\n"
timeout = kickstart.get_timeout(cr.ks)
if not timeout:
timeout = 0
syslinux_conf += "TIMEOUT " + str(timeout) + "\n"
syslinux_conf += "\n"
syslinux_conf += "ALLOWOPTIONS 1\n"
syslinux_conf += "SERIAL 0 115200\n"
syslinux_conf += "\n"
if splashline:
syslinux_conf += "%s\n" % splashline
syslinux_conf += "DEFAULT boot\n"
syslinux_conf += "LABEL boot\n"
kernel = "/vmlinuz"
syslinux_conf += "KERNEL " + kernel + "\n"
if cr._ptable_format == 'msdos':
rootstr = rootdev
else:
raise ImageError("Unsupported partition table format found")
syslinux_conf += "APPEND label=boot root=%s %s\n" % (rootstr, options)
msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \
% cr_workdir)
cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w")
cfg.write(syslinux_conf)
cfg.close()
开发者ID:RafaelPalomar,项目名称:poky,代码行数:52,代码来源:bootimg-pcbios.py
示例20: __create_partition
def __create_partition(self, device, parttype, fstype, start, size):
""" Create a partition on an image described by the 'device' object. """
# Start is included to the size so we need to substract one from the end.
end = start + size - 1
msger.debug("Added '%s' partition, sectors %d-%d, size %d sectors" %
(parttype, start, end, size))
args = ["-s", device, "unit", "s", "mkpart", parttype]
if fstype:
args.extend([fstype])
args.extend(["%d" % start, "%d" % end])
return self.__run_parted(args)
开发者ID:abelal,项目名称:openembedded-core,代码行数:14,代码来源:partitionedfs.py
注:本文中的wic.msger.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论