diff options
author | California Sullivan <california.l.sullivan@intel.com> | 2018-02-28 18:15:08 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-03-06 06:35:42 -0800 |
commit | dbe0736341abf008e45558abc65b275a83fc9db9 (patch) | |
tree | d869d058845d4c5a17e0381637cd0c92e9fd07d7 /meta/classes/systemd-boot.bbclass | |
parent | 49c638264c9fd83241ff75194439af0bb5b9e005 (diff) | |
download | poky-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.bbclass | 70 |
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 @@ | |||
12 | do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy" | 12 | do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy" |
13 | 13 | ||
14 | EFIDIR = "/EFI/BOOT" | 14 | EFIDIR = "/EFI/BOOT" |
15 | |||
16 | SYSTEMD_BOOT_CFG ?= "${S}/loader.conf" | ||
17 | SYSTEMD_BOOT_ENTRIES ?= "" | ||
18 | SYSTEMD_BOOT_TIMEOUT ?= "10" | ||
19 | |||
20 | # Need UUID utility code. | 15 | # Need UUID utility code. |
21 | inherit fs-uuid | 16 | inherit fs-uuid |
22 | 17 | ||
@@ -62,67 +57,4 @@ efi_hddimg_populate() { | |||
62 | efi_populate $1 | 57 | efi_populate $1 |
63 | } | 58 | } |
64 | 59 | ||
65 | python build_efi_cfg() { | 60 | inherit 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 | } | ||