summaryrefslogtreecommitdiffstats
path: root/meta/classes/systemd-boot.bbclass
diff options
context:
space:
mode:
authorCalifornia Sullivan <california.l.sullivan@intel.com>2018-02-28 18:15:08 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-06 06:35:42 -0800
commitdbe0736341abf008e45558abc65b275a83fc9db9 (patch)
treed869d058845d4c5a17e0381637cd0c92e9fd07d7 /meta/classes/systemd-boot.bbclass
parent49c638264c9fd83241ff75194439af0bb5b9e005 (diff)
downloadpoky-dbe0736341abf008e45558abc65b275a83fc9db9.tar.gz
systemd-boot.bbclass: break out configuration creation
This class is useful on its own and can be used to create configuration recipes. (From OE-Core rev: 5d14ff6e25d3b334d4cc9363a6ddeb16f4c2911d) Signed-off-by: California Sullivan <california.l.sullivan@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/systemd-boot.bbclass')
-rw-r--r--meta/classes/systemd-boot.bbclass70
1 files changed, 1 insertions, 69 deletions
diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index 937307076f..14538fe2d7 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -12,11 +12,6 @@
12do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy" 12do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
13 13
14EFIDIR = "/EFI/BOOT" 14EFIDIR = "/EFI/BOOT"
15
16SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
17SYSTEMD_BOOT_ENTRIES ?= ""
18SYSTEMD_BOOT_TIMEOUT ?= "10"
19
20# Need UUID utility code. 15# Need UUID utility code.
21inherit fs-uuid 16inherit fs-uuid
22 17
@@ -62,67 +57,4 @@ efi_hddimg_populate() {
62 efi_populate $1 57 efi_populate $1
63} 58}
64 59
65python build_efi_cfg() { 60inherit systemd-boot-cfg
66 s = d.getVar("S")
67 labels = d.getVar('LABELS')
68 if not labels:
69 bb.debug(1, "LABELS not defined, nothing to do")
70 return
71
72 if labels == []:
73 bb.debug(1, "No labels, nothing to do")
74 return
75
76 cfile = d.getVar('SYSTEMD_BOOT_CFG')
77 cdir = os.path.dirname(cfile)
78 if not os.path.exists(cdir):
79 os.makedirs(cdir)
80 try:
81 cfgfile = open(cfile, 'w')
82 except OSError:
83 bb.fatal('Unable to open %s' % cfile)
84
85 cfgfile.write('# Automatically created by OE\n')
86 cfgfile.write('default %s\n' % (labels.split()[0]))
87 timeout = d.getVar('SYSTEMD_BOOT_TIMEOUT')
88 if timeout:
89 cfgfile.write('timeout %s\n' % timeout)
90 else:
91 cfgfile.write('timeout 10\n')
92 cfgfile.close()
93
94 for label in labels.split():
95 localdata = d.createCopy()
96
97 overrides = localdata.getVar('OVERRIDES')
98 if not overrides:
99 bb.fatal('OVERRIDES not defined')
100
101 entryfile = "%s/%s.conf" % (s, label)
102 if not os.path.exists(s):
103 os.makedirs(s)
104 d.appendVar("SYSTEMD_BOOT_ENTRIES", " " + entryfile)
105 try:
106 entrycfg = open(entryfile, "w")
107 except OSError:
108 bb.fatal('Unable to open %s' % entryfile)
109 localdata.setVar('OVERRIDES', label + ':' + overrides)
110
111 entrycfg.write('title %s\n' % label)
112 entrycfg.write('linux /vmlinuz\n')
113
114 append = localdata.getVar('APPEND')
115 initrd = localdata.getVar('INITRD')
116
117 if initrd:
118 entrycfg.write('initrd /initrd\n')
119 lb = label
120 if label == "install":
121 lb = "install-efi"
122 entrycfg.write('options LABEL=%s ' % lb)
123 if append:
124 append = replace_rootfs_uuid(d, append)
125 entrycfg.write('%s' % append)
126 entrycfg.write('\n')
127 entrycfg.close()
128}