diff options
-rw-r--r-- | classes/override_grub-efi.inc | 89 | ||||
-rw-r--r-- | images/enea-nfv-access-host-common.inc | 10 |
2 files changed, 94 insertions, 5 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 | } | ||
diff --git a/images/enea-nfv-access-host-common.inc b/images/enea-nfv-access-host-common.inc index 9958861..3015b0a 100644 --- a/images/enea-nfv-access-host-common.inc +++ b/images/enea-nfv-access-host-common.inc | |||
@@ -1,4 +1,5 @@ | |||
1 | require images/enea-nfv-access-common.inc | 1 | require images/enea-nfv-access-common.inc |
2 | require classes/override_grub-efi.inc | ||
2 | 3 | ||
3 | IMAGE_INSTALL += " \ | 4 | IMAGE_INSTALL += " \ |
4 | packagegroup-enea-virtualization-host \ | 5 | packagegroup-enea-virtualization-host \ |
@@ -8,11 +9,10 @@ IMAGE_INSTALL += " \ | |||
8 | # Set labels for GRUB and SYSLINUX | 9 | # Set labels for GRUB and SYSLINUX |
9 | LABELS_LIVE = "live-boot installer" | 10 | LABELS_LIVE = "live-boot installer" |
10 | 11 | ||
11 | # Append default parameters for x86-64 targets and avoid duplicate serial configs | 12 | GRUB_GFXSERIAL_x86-64 = "1" |
12 | APPEND_x86-64 = "console=ttyS0,115200 console=tty0 quiet" | 13 | # Append default parameters for x86-64 targets |
13 | GRUB_SERIAL_x86-64 = "" | 14 | APPEND_x86-64 = "quiet" |
14 | SYSLINUX_DEFAULT_CONSOLE_x86-64 = "" | 15 | SYSLINUX_DEFAULT_CONSOLE_x86-64 = "console=tty0" |
15 | SYSLINUX_SERIAL_TTY_x86-64 = "" | ||
16 | 16 | ||
17 | # Set timeout values | 17 | # Set timeout values |
18 | GRUB_TIMEOUT_x86-64 = "10" | 18 | GRUB_TIMEOUT_x86-64 = "10" |