blob: b3e0e6ad41026dfdf714538d668d1f3ae82df551 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
SYSTEMD_BOOT_ENTRIES ?= ""
SYSTEMD_BOOT_TIMEOUT ?= "10"
# Uses MACHINE specific KERNEL_IMAGETYPE
PACKAGE_ARCH = "${MACHINE_ARCH}"
# Need UUID utility code.
inherit fs-uuid
python build_efi_cfg() {
s = d.getVar("S")
labels = d.getVar('LABELS')
if not labels:
bb.debug(1, "LABELS not defined, nothing to do")
return
if labels == []:
bb.debug(1, "No labels, nothing to do")
return
cfile = d.getVar('SYSTEMD_BOOT_CFG')
cdir = os.path.dirname(cfile)
if not os.path.exists(cdir):
os.makedirs(cdir)
try:
cfgfile = open(cfile, 'w')
except OSError:
bb.fatal('Unable to open %s' % cfile)
cfgfile.write('# Automatically created by OE\n')
cfgfile.write('default %s\n' % (labels.split()[0]))
timeout = d.getVar('SYSTEMD_BOOT_TIMEOUT')
if timeout:
cfgfile.write('timeout %s\n' % timeout)
else:
cfgfile.write('timeout 10\n')
cfgfile.close()
for label in labels.split():
localdata = d.createCopy()
entryfile = "%s/%s.conf" % (s, label)
if not os.path.exists(s):
os.makedirs(s)
d.appendVar("SYSTEMD_BOOT_ENTRIES", " " + entryfile)
try:
entrycfg = open(entryfile, "w")
except OSError:
bb.fatal('Unable to open %s' % entryfile)
entrycfg.write('title %s\n' % label)
kernel = localdata.getVar("KERNEL_IMAGETYPE")
entrycfg.write('linux /%s\n' % kernel)
append = localdata.getVar('APPEND')
initrd = localdata.getVar('INITRD')
if initrd:
entrycfg.write('initrd /initrd\n')
lb = label
if label == "install":
lb = "install-efi"
entrycfg.write('options LABEL=%s ' % lb)
if append:
append = replace_rootfs_uuid(d, append)
entrycfg.write('%s' % append)
entrycfg.write('\n')
entrycfg.close()
}
|