diff options
| author | Matei Valeanu <Matei.Valeanu@enea.com> | 2018-07-27 02:36:43 +0200 |
|---|---|---|
| committer | Martin Borg <martin.borg@enea.com> | 2018-09-21 10:16:33 +0200 |
| commit | a1c49a0482b0087ac82774603ed3ed8a9b4ce627 (patch) | |
| tree | af7a48d4bb15f174fd19c85412da8a7661218ac4 /classes | |
| parent | c9dbb6f104dd53b524074a3692e01974e97708d4 (diff) | |
| download | meta-el-nfv-access-a1c49a0482b0087ac82774603ed3ed8a9b4ce627.tar.gz | |
boot menu: Add graphics and serial choices
Add override_grub-efi.inc to override "build_efi_cfg" function
from grub-efi.bbclass, in order to add GRUB_GRAPHICS variable
for grub menuentry specific parameters.
Set "console=tty0" for graphic console options for grub
and syslinux, and also "console=ttyS0" for serial.
Change-Id: If338d9f7e1b82fc91a026ef48ae30647c1049f8b
Signed-off-by: Matei Valeanu <Matei.Valeanu@enea.com>
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/override_grub-efi.inc | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/classes/override_grub-efi.inc b/classes/override_grub-efi.inc new file mode 100644 index 0000000..4c2ae64 --- /dev/null +++ b/classes/override_grub-efi.inc | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | GRUB_GRAPHICS ?= "console=tty0" | ||
| 2 | |||
| 3 | python build_efi_cfg() { | ||
| 4 | import sys | ||
| 5 | |||
| 6 | workdir = d.getVar('WORKDIR') | ||
| 7 | if not workdir: | ||
| 8 | bb.error("WORKDIR not defined, unable to package") | ||
| 9 | return | ||
| 10 | |||
| 11 | gfxserial = d.getVar('GRUB_GFXSERIAL') or "" | ||
| 12 | |||
| 13 | labels = d.getVar('LABELS') | ||
| 14 | if not labels: | ||
| 15 | bb.debug(1, "LABELS not defined, nothing to do") | ||
| 16 | return | ||
| 17 | |||
| 18 | if labels == []: | ||
| 19 | bb.debug(1, "No labels, nothing to do") | ||
| 20 | return | ||
| 21 | |||
| 22 | cfile = d.getVar('GRUB_CFG') | ||
| 23 | if not cfile: | ||
| 24 | bb.fatal('Unable to read GRUB_CFG') | ||
| 25 | |||
| 26 | try: | ||
| 27 | cfgfile = open(cfile, 'w') | ||
| 28 | except OSError: | ||
| 29 | bb.fatal('Unable to open %s' % cfile) | ||
| 30 | |||
| 31 | cfgfile.write('# Automatically created by OE\n') | ||
| 32 | |||
| 33 | opts = d.getVar('GRUB_OPTS') | ||
| 34 | if opts: | ||
| 35 | for opt in opts.split(';'): | ||
| 36 | cfgfile.write('%s\n' % opt) | ||
| 37 | |||
| 38 | cfgfile.write('default=%s\n' % (labels.split()[0])) | ||
| 39 | |||
| 40 | timeout = d.getVar('GRUB_TIMEOUT') | ||
| 41 | if timeout: | ||
| 42 | cfgfile.write('timeout=%s\n' % timeout) | ||
| 43 | else: | ||
| 44 | cfgfile.write('timeout=50\n') | ||
| 45 | |||
| 46 | root = d.getVar('GRUB_ROOT') | ||
| 47 | if not root: | ||
| 48 | bb.fatal('GRUB_ROOT not defined') | ||
| 49 | |||
| 50 | if gfxserial == "1": | ||
| 51 | btypes = [ [ " graphics console", d.getVar('GRUB_GRAPHICS') or "" ], | ||
| 52 | [ " serial console", d.getVar('GRUB_SERIAL') or "" ] ] | ||
| 53 | else: | ||
| 54 | btypes = [ [ "", "" ] ] | ||
| 55 | |||
| 56 | for label in labels.split(): | ||
| 57 | localdata = d.createCopy() | ||
| 58 | |||
| 59 | overrides = localdata.getVar('OVERRIDES') | ||
| 60 | if not overrides: | ||
| 61 | bb.fatal('OVERRIDES not defined') | ||
| 62 | |||
| 63 | for btype in btypes: | ||
| 64 | localdata.setVar('OVERRIDES', label + ':' + overrides) | ||
| 65 | |||
| 66 | cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0])) | ||
| 67 | lb = label | ||
| 68 | if label == "install": | ||
| 69 | lb = "install-efi" | ||
| 70 | cfgfile.write('linux /vmlinuz LABEL=%s' % (lb)) | ||
| 71 | |||
| 72 | cfgfile.write(' %s' % replace_rootfs_uuid(d, root)) | ||
| 73 | |||
| 74 | append = localdata.getVar('APPEND') | ||
| 75 | initrd = localdata.getVar('INITRD') | ||
| 76 | |||
| 77 | if append: | ||
| 78 | append = replace_rootfs_uuid(d, append) | ||
| 79 | cfgfile.write(' %s' % (append)) | ||
| 80 | |||
| 81 | cfgfile.write(' %s' % btype[1]) | ||
| 82 | cfgfile.write('\n') | ||
| 83 | |||
| 84 | if initrd: | ||
| 85 | cfgfile.write('initrd /initrd') | ||
| 86 | cfgfile.write('\n}\n') | ||
| 87 | |||
| 88 | cfgfile.close() | ||
| 89 | } | ||
