grub-efi.bbclass: Add serial and graphics menu options
The syslinux.bbclass already has support for automatically generated serial and graphics menu choices. This patch adds the same concept to the grub-efi menu. That makes it possible to generate a single image which can boot on a PCBIOS or EFI firmware with consistent looking boot options. [YOCTO #4100] (From OE-Core rev: 8444199fb598012f54853b010b5e5cce750db89d) Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
24ffda4701
commit
5a2d11e845
|
@ -9,6 +9,7 @@
|
||||||
# External variables
|
# External variables
|
||||||
# ${INITRD} - indicates a filesystem image to use as an initrd (optional)
|
# ${INITRD} - indicates a filesystem image to use as an initrd (optional)
|
||||||
# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
|
# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
|
||||||
|
# ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu
|
||||||
# ${LABELS} - a list of targets for the automatic config
|
# ${LABELS} - a list of targets for the automatic config
|
||||||
# ${APPEND} - an override list of append strings for each label
|
# ${APPEND} - an override list of append strings for each label
|
||||||
# ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
|
# ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
|
|
||||||
do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy"
|
do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy"
|
||||||
|
|
||||||
|
GRUB_SERIAL ?= "console=ttyS0,115200"
|
||||||
GRUBCFG = "${S}/grub.cfg"
|
GRUBCFG = "${S}/grub.cfg"
|
||||||
GRUB_TIMEOUT ?= "10"
|
GRUB_TIMEOUT ?= "10"
|
||||||
#FIXME: build this from the machine config
|
#FIXME: build this from the machine config
|
||||||
|
@ -63,6 +65,8 @@ python build_grub_cfg() {
|
||||||
bb.error("WORKDIR not defined, unable to package")
|
bb.error("WORKDIR not defined, unable to package")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
gfxserial = d.getVar('GRUB_GFXSERIAL', True) or ""
|
||||||
|
|
||||||
labels = d.getVar('LABELS', True)
|
labels = d.getVar('LABELS', True)
|
||||||
if not labels:
|
if not labels:
|
||||||
bb.debug(1, "LABELS not defined, nothing to do")
|
bb.debug(1, "LABELS not defined, nothing to do")
|
||||||
|
@ -96,6 +100,12 @@ python build_grub_cfg() {
|
||||||
else:
|
else:
|
||||||
cfgfile.write('timeout=50\n')
|
cfgfile.write('timeout=50\n')
|
||||||
|
|
||||||
|
if gfxserial == "1":
|
||||||
|
btypes = [ [ " graphics console", "" ],
|
||||||
|
[ " serial console", d.getVar('GRUB_SERIAL', True) or "" ] ]
|
||||||
|
else:
|
||||||
|
btypes = [ [ "", "" ] ]
|
||||||
|
|
||||||
for label in labels.split():
|
for label in labels.split():
|
||||||
localdata = d.createCopy()
|
localdata = d.createCopy()
|
||||||
|
|
||||||
|
@ -103,24 +113,27 @@ python build_grub_cfg() {
|
||||||
if not overrides:
|
if not overrides:
|
||||||
raise bb.build.FuncFailed('OVERRIDES not defined')
|
raise bb.build.FuncFailed('OVERRIDES not defined')
|
||||||
|
|
||||||
localdata.setVar('OVERRIDES', label + ':' + overrides)
|
for btype in btypes:
|
||||||
bb.data.update_data(localdata)
|
localdata.setVar('OVERRIDES', label + ':' + overrides)
|
||||||
|
bb.data.update_data(localdata)
|
||||||
|
|
||||||
cfgfile.write('\nmenuentry \'%s\'{\n' % (label))
|
cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0]))
|
||||||
if label == "install":
|
lb = label
|
||||||
label = "install-efi"
|
if label == "install":
|
||||||
cfgfile.write('linux /vmlinuz LABEL=%s' % (label))
|
lb = "install-efi"
|
||||||
|
cfgfile.write('linux /vmlinuz LABEL=%s' % (lb))
|
||||||
|
|
||||||
append = localdata.getVar('APPEND', True)
|
append = localdata.getVar('APPEND', True)
|
||||||
initrd = localdata.getVar('INITRD', True)
|
initrd = localdata.getVar('INITRD', True)
|
||||||
|
|
||||||
if append:
|
if append:
|
||||||
cfgfile.write('%s' % (append))
|
cfgfile.write('%s' % (append))
|
||||||
cfgfile.write('\n')
|
cfgfile.write(' %s' % btype[1])
|
||||||
|
cfgfile.write('\n')
|
||||||
|
|
||||||
if initrd:
|
if initrd:
|
||||||
cfgfile.write('initrd /initrd')
|
cfgfile.write('initrd /initrd')
|
||||||
cfgfile.write('\n}\n')
|
cfgfile.write('\n}\n')
|
||||||
|
|
||||||
cfgfile.close()
|
cfgfile.close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue