diff options
Diffstat (limited to 'meta/classes/grub-efi.bbclass')
-rw-r--r-- | meta/classes/grub-efi.bbclass | 41 |
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 | ||
17 | do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" | 18 | do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" |
18 | 19 | ||
20 | GRUB_SERIAL ?= "console=ttyS0,115200" | ||
19 | GRUBCFG = "${S}/grub.cfg" | 21 | GRUBCFG = "${S}/grub.cfg" |
20 | GRUB_TIMEOUT ?= "10" | 22 | GRUB_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 | } |