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