mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
wic: isoimage-isohybrid: add grubefi configfile support
The latest wic kickstart refactoring introduced a bootloader option "--configfile" which lets wks' specify a custom grub.cfg for use while booting. This is very useful for creating stuff like boot menus. This change lets isoimage-isohybrid use --configfile; if this option is not specified in a wks, it generates a default cfg as before. (From OE-Core rev: bf673a769514b13558ad9c785ae4da3a5adfd1e0) Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
5073e5bbf1
commit
222c5c65b1
@@ -27,6 +27,7 @@ import glob
|
|||||||
|
|
||||||
from wic import msger
|
from wic import msger
|
||||||
from wic.pluginbase import SourcePlugin
|
from wic.pluginbase import SourcePlugin
|
||||||
|
from wic.utils.misc import get_custom_config
|
||||||
from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
|
from wic.utils.oe.misc import exec_cmd, exec_native_cmd, get_bitbake_var
|
||||||
|
|
||||||
class IsoImagePlugin(SourcePlugin):
|
class IsoImagePlugin(SourcePlugin):
|
||||||
@@ -94,33 +95,43 @@ class IsoImagePlugin(SourcePlugin):
|
|||||||
"""
|
"""
|
||||||
Create loader-specific (grub-efi) config
|
Create loader-specific (grub-efi) config
|
||||||
"""
|
"""
|
||||||
splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
|
configfile = creator.ks.bootloader.configfile
|
||||||
if os.path.exists(splash):
|
if configfile:
|
||||||
splashline = "menu background splash.jpg"
|
grubefi_conf = get_custom_config(configfile)
|
||||||
|
if grubefi_conf:
|
||||||
|
msger.debug("Using custom configuration file "
|
||||||
|
"%s for grub.cfg" % configfile)
|
||||||
|
else:
|
||||||
|
msger.error("configfile is specified but failed to "
|
||||||
|
"get it from %s." % configfile)
|
||||||
else:
|
else:
|
||||||
splashline = ""
|
splash = os.path.join(cr_workdir, "/EFI/boot/splash.jpg")
|
||||||
|
if os.path.exists(splash):
|
||||||
|
splashline = "menu background splash.jpg"
|
||||||
|
else:
|
||||||
|
splashline = ""
|
||||||
|
|
||||||
bootloader = creator.ks.bootloader
|
bootloader = creator.ks.bootloader
|
||||||
|
|
||||||
grubefi_conf = ""
|
grubefi_conf = ""
|
||||||
grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
|
grubefi_conf += "serial --unit=0 --speed=115200 --word=8 "
|
||||||
grubefi_conf += "--parity=no --stop=1\n"
|
grubefi_conf += "--parity=no --stop=1\n"
|
||||||
grubefi_conf += "default=boot\n"
|
grubefi_conf += "default=boot\n"
|
||||||
grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
|
grubefi_conf += "timeout=%s\n" % (bootloader.timeout or 10)
|
||||||
grubefi_conf += "\n"
|
grubefi_conf += "\n"
|
||||||
grubefi_conf += "search --set=root --label %s " % part.label
|
grubefi_conf += "search --set=root --label %s " % part.label
|
||||||
grubefi_conf += "\n"
|
grubefi_conf += "\n"
|
||||||
grubefi_conf += "menuentry 'boot'{\n"
|
grubefi_conf += "menuentry 'boot'{\n"
|
||||||
|
|
||||||
kernel = "/bzImage"
|
kernel = "/bzImage"
|
||||||
|
|
||||||
grubefi_conf += "linux %s rootwait %s\n" \
|
grubefi_conf += "linux %s rootwait %s\n" \
|
||||||
% (kernel, bootloader.append)
|
% (kernel, bootloader.append)
|
||||||
grubefi_conf += "initrd /initrd \n"
|
grubefi_conf += "initrd /initrd \n"
|
||||||
grubefi_conf += "}\n"
|
grubefi_conf += "}\n"
|
||||||
|
|
||||||
if splashline:
|
if splashline:
|
||||||
grubefi_conf += "%s\n" % splashline
|
grubefi_conf += "%s\n" % splashline
|
||||||
|
|
||||||
msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \
|
msger.debug("Writing grubefi config %s/EFI/BOOT/grub.cfg" \
|
||||||
% cr_workdir)
|
% cr_workdir)
|
||||||
|
|||||||
Reference in New Issue
Block a user