summaryrefslogtreecommitdiffstats
path: root/meta/classes/grub-efi.bbclass
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2013-09-17 13:32:15 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-30 22:11:56 +0100
commit5a2d11e845a52d932f9c546142fb58122ed2cba0 (patch)
tree8734584655fdcba70c2617813294204ee6d2084e /meta/classes/grub-efi.bbclass
parent24ffda4701371f6a2e88c10e5a20cf3a5bedbc15 (diff)
downloadpoky-5a2d11e845a52d932f9c546142fb58122ed2cba0.tar.gz
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>
Diffstat (limited to 'meta/classes/grub-efi.bbclass')
-rw-r--r--meta/classes/grub-efi.bbclass41
1 files changed, 27 insertions, 14 deletions
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index c21babb293..591bee25ef 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -9,6 +9,7 @@
9# External variables 9# External variables
10# ${INITRD} - indicates a filesystem image to use as an initrd (optional) 10# ${INITRD} - indicates a filesystem image to use as an initrd (optional)
11# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) 11# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
12# ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu
12# ${LABELS} - a list of targets for the automatic config 13# ${LABELS} - a list of targets for the automatic config
13# ${APPEND} - an override list of append strings for each label 14# ${APPEND} - an override list of append strings for each label
14# ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional) 15# ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
@@ -16,6 +17,7 @@
16 17
17do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" 18do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy"
18 19
20GRUB_SERIAL ?= "console=ttyS0,115200"
19GRUBCFG = "${S}/grub.cfg" 21GRUBCFG = "${S}/grub.cfg"
20GRUB_TIMEOUT ?= "10" 22GRUB_TIMEOUT ?= "10"
21#FIXME: build this from the machine config 23#FIXME: build this from the machine config
@@ -63,6 +65,8 @@ python build_grub_cfg() {
63 bb.error("WORKDIR not defined, unable to package") 65 bb.error("WORKDIR not defined, unable to package")
64 return 66 return
65 67
68 gfxserial = d.getVar('GRUB_GFXSERIAL', True) or ""
69
66 labels = d.getVar('LABELS', True) 70 labels = d.getVar('LABELS', True)
67 if not labels: 71 if not labels:
68 bb.debug(1, "LABELS not defined, nothing to do") 72 bb.debug(1, "LABELS not defined, nothing to do")
@@ -96,6 +100,12 @@ python build_grub_cfg() {
96 else: 100 else:
97 cfgfile.write('timeout=50\n') 101 cfgfile.write('timeout=50\n')
98 102
103 if gfxserial == "1":
104 btypes = [ [ " graphics console", "" ],
105 [ " serial console", d.getVar('GRUB_SERIAL', True) or "" ] ]
106 else:
107 btypes = [ [ "", "" ] ]
108
99 for label in labels.split(): 109 for label in labels.split():
100 localdata = d.createCopy() 110 localdata = d.createCopy()
101 111
@@ -103,24 +113,27 @@ python build_grub_cfg() {
103 if not overrides: 113 if not overrides:
104 raise bb.build.FuncFailed('OVERRIDES not defined') 114 raise bb.build.FuncFailed('OVERRIDES not defined')
105 115
106 localdata.setVar('OVERRIDES', label + ':' + overrides) 116 for btype in btypes:
107 bb.data.update_data(localdata) 117 localdata.setVar('OVERRIDES', label + ':' + overrides)
118 bb.data.update_data(localdata)
108 119
109 cfgfile.write('\nmenuentry \'%s\'{\n' % (label)) 120 cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0]))
110 if label == "install": 121 lb = label
111 label = "install-efi" 122 if label == "install":
112 cfgfile.write('linux /vmlinuz LABEL=%s' % (label)) 123 lb = "install-efi"
124 cfgfile.write('linux /vmlinuz LABEL=%s' % (lb))
113 125
114 append = localdata.getVar('APPEND', True) 126 append = localdata.getVar('APPEND', True)
115 initrd = localdata.getVar('INITRD', True) 127 initrd = localdata.getVar('INITRD', True)
116 128
117 if append: 129 if append:
118 cfgfile.write('%s' % (append)) 130 cfgfile.write('%s' % (append))
119 cfgfile.write('\n') 131 cfgfile.write(' %s' % btype[1])
132 cfgfile.write('\n')
120 133
121 if initrd: 134 if initrd:
122 cfgfile.write('initrd /initrd') 135 cfgfile.write('initrd /initrd')
123 cfgfile.write('\n}\n') 136 cfgfile.write('\n}\n')
124 137
125 cfgfile.close() 138 cfgfile.close()
126} 139}