summaryrefslogtreecommitdiffstats
path: root/classes/override_grub-efi.inc
diff options
context:
space:
mode:
Diffstat (limited to 'classes/override_grub-efi.inc')
-rw-r--r--classes/override_grub-efi.inc89
1 files changed, 0 insertions, 89 deletions
diff --git a/classes/override_grub-efi.inc b/classes/override_grub-efi.inc
deleted file mode 100644
index 15a7063..0000000
--- a/classes/override_grub-efi.inc
+++ /dev/null
@@ -1,89 +0,0 @@
1GRUB_GRAPHICS ?= "console=tty0"
2
3python 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 = [ [ " serial console", d.getVar('GRUB_SERIAL') or "" ],
52 [ " graphics console", d.getVar('GRUB_GRAPHICS') 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}