mirror of
https://git.yoctoproject.org/git/poky
synced 2026-01-01 13:58:04 +00:00
bootimg_pcbios: move syslinux funcs to end of file
This commit moves the seperated syslinux creation functions from their current position to end of file in the order 1. _do_configure_syslinux 2. _do_prepare_syslinux 3. _do_install_syslinux This is to prepare for inclusion of other bootloaders. It also makes reading through the wics plugin much easier if you group bootloader specific partition creation functions together and place them at the bottom of the file versus leaving them in their current position. (From OE-Core rev: 9034dd23e4240536a37a2290f2f2dd48d9bddd29) Signed-off-by: Vincent Davis Jr. <vince@underview.tech> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
336a252dbb
commit
eb3df0324a
|
|
@ -54,36 +54,6 @@ class BootimgPcbiosPlugin(SourcePlugin):
|
|||
cls._do_install_syslinux(disk, disk_name, creator, workdir, oe_builddir,
|
||||
bootimg_dir, kernel_dir, native_sysroot)
|
||||
|
||||
@classmethod
|
||||
def _do_install_syslinux(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.
|
||||
"""
|
||||
|
||||
bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux')
|
||||
mbrfile = "%s/syslinux/" % bootimg_dir
|
||||
if creator.ptable_format == 'msdos':
|
||||
mbrfile += "mbr.bin"
|
||||
elif creator.ptable_format == 'gpt':
|
||||
mbrfile += "gptmbr.bin"
|
||||
else:
|
||||
raise WicError("Unsupported partition table: %s" %
|
||||
creator.ptable_format)
|
||||
|
||||
if not os.path.exists(mbrfile):
|
||||
raise WicError("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")
|
||||
logger.debug("Installing MBR on disk %s as %s with size %s bytes",
|
||||
disk_name, full_path, disk.min_size)
|
||||
|
||||
dd_cmd = "dd if=%s of=%s conv=notrunc" % (mbrfile, full_path)
|
||||
exec_cmd(dd_cmd, native_sysroot)
|
||||
|
||||
@classmethod
|
||||
def do_configure_partition(cls, part, source_params, creator, cr_workdir,
|
||||
oe_builddir, bootimg_dir, kernel_dir,
|
||||
|
|
@ -93,6 +63,15 @@ class BootimgPcbiosPlugin(SourcePlugin):
|
|||
oe_builddir, bootimg_dir, kernel_dir,
|
||||
native_sysroot)
|
||||
|
||||
@classmethod
|
||||
def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
|
||||
oe_builddir, bootimg_dir, kernel_dir,
|
||||
rootfs_dir, native_sysroot):
|
||||
|
||||
cls._do_prepare_syslinux(part, source_params, creator, cr_workdir,
|
||||
oe_builddir, bootimg_dir, kernel_dir,
|
||||
rootfs_dir, native_sysroot)
|
||||
|
||||
@classmethod
|
||||
def _do_configure_syslinux(cls, part, source_params, creator, cr_workdir,
|
||||
oe_builddir, bootimg_dir, kernel_dir,
|
||||
|
|
@ -152,15 +131,6 @@ class BootimgPcbiosPlugin(SourcePlugin):
|
|||
cfg.write(syslinux_conf)
|
||||
cfg.close()
|
||||
|
||||
@classmethod
|
||||
def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
|
||||
oe_builddir, bootimg_dir, kernel_dir,
|
||||
rootfs_dir, native_sysroot):
|
||||
|
||||
cls._do_prepare_syslinux(part, source_params, creator, cr_workdir,
|
||||
oe_builddir, bootimg_dir, kernel_dir,
|
||||
rootfs_dir, native_sysroot)
|
||||
|
||||
@classmethod
|
||||
def _do_prepare_syslinux(cls, part, source_params, creator, cr_workdir,
|
||||
oe_builddir, bootimg_dir, kernel_dir,
|
||||
|
|
@ -234,3 +204,33 @@ class BootimgPcbiosPlugin(SourcePlugin):
|
|||
|
||||
part.size = int(bootimg_size)
|
||||
part.source_file = bootimg
|
||||
|
||||
@classmethod
|
||||
def _do_install_syslinux(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.
|
||||
"""
|
||||
|
||||
bootimg_dir = cls._get_bootimg_dir(bootimg_dir, 'syslinux')
|
||||
mbrfile = "%s/syslinux/" % bootimg_dir
|
||||
if creator.ptable_format == 'msdos':
|
||||
mbrfile += "mbr.bin"
|
||||
elif creator.ptable_format == 'gpt':
|
||||
mbrfile += "gptmbr.bin"
|
||||
else:
|
||||
raise WicError("Unsupported partition table: %s" %
|
||||
creator.ptable_format)
|
||||
|
||||
if not os.path.exists(mbrfile):
|
||||
raise WicError("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")
|
||||
logger.debug("Installing MBR on disk %s as %s with size %s bytes",
|
||||
disk_name, full_path, disk.min_size)
|
||||
|
||||
dd_cmd = "dd if=%s of=%s conv=notrunc" % (mbrfile, full_path)
|
||||
exec_cmd(dd_cmd, native_sysroot)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user