summaryrefslogtreecommitdiffstats
path: root/meta/classes/gummiboot.bbclass
diff options
context:
space:
mode:
authorStefan Stanacar <stefanx.stanacar@intel.com>2014-03-06 19:59:07 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-11 09:30:14 -0700
commit5f05bdda0bf3f9fadf287a0632c2fa697380273f (patch)
treedeb02d53b7f5aeaf5aa54969a60f53fba592061d /meta/classes/gummiboot.bbclass
parent9d04183cf8aed9eaa2aa03058488b1198f73cea0 (diff)
downloadpoky-5f05bdda0bf3f9fadf287a0632c2fa697380273f.tar.gz
classes: Add gummiboot class
Adds a gummiboot class similar to grub-efi class and makes the necessary changes so it can be used for live/hddimg images as well. One can set EFI_PROVIDER = "gummiboot" in local.conf to use gummiboot instead of grub-efi. Gummiboot requires some kernel options that are not enabled by default, so one has to build with KERNEL_FEATURES_append = " cfg/efi-ext". The install scripts have been updated too, keeping the old behaviour around, but accounting for the new boot loader config files (if they exist). It can be argued that the installer and bootimg are a bit wierd and not necessarily correct, but I wanted to have the exact same behviour with gummiboot. With the default EFI_PROVIDER = "grub-efi" nothing changes, everthing should be just as before. I've tested live boot, install and normal boot on: - FRI2 - genericx86-64 on NUC with: EFI_PROVIDER = "gummiboot" KERNEL_FEATURES_append = " cfg/efi-ext" in local.conf. (From OE-Core rev: b457e40fc69cc6503dc566f16495f03606e5333b) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/gummiboot.bbclass')
-rw-r--r--meta/classes/gummiboot.bbclass114
1 files changed, 114 insertions, 0 deletions
diff --git a/meta/classes/gummiboot.bbclass b/meta/classes/gummiboot.bbclass
new file mode 100644
index 0000000000..021465201f
--- /dev/null
+++ b/meta/classes/gummiboot.bbclass
@@ -0,0 +1,114 @@
1# Copyright (C) 2014 Intel Corporation
2#
3# Released under the MIT license (see COPYING.MIT)
4
5# gummiboot.bbclass - equivalent of grub-efi.bbclass
6# Set EFI_PROVIDER = "gummiboot" to use gummiboot on your live images instead of grub-efi
7# (images built by bootimage.bbclass or boot-directdisk.bbclass)
8
9do_bootimg[depends] += "gummiboot:do_deploy"
10do_bootdirectdisk[depends] += "gummiboot:do_deploy"
11
12EFIDIR = "/EFI/BOOT"
13
14GUMMIBOOT_CFG ?= "${S}/loader.conf"
15GUMMIBOOT_ENTRIES ?= ""
16GUMMIBOOT_TIMEOUT ?= "10"
17
18efi_populate() {
19 DEST=$1
20
21 EFI_IMAGE="gummibootia32.efi"
22 DEST_EFI_IMAGE="bootia32.efi"
23 if [ "${TARGET_ARCH}" = "x86_64" ]; then
24 EFI_IMAGE="gummibootx64.efi"
25 DEST_EFI_IMAGE="bootx64.efi"
26 fi
27
28 install -d ${DEST}${EFIDIR}
29 # gummiboot requires these paths for configuration files
30 # they are not customizable so no point in new vars
31 install -d ${DEST}/loader
32 install -d ${DEST}/loader/entries
33 install -m 0644 ${DEPLOY_DIR_IMAGE}/${EFI_IMAGE} ${DEST}${EFIDIR}/${DEST_EFI_IMAGE}
34 install -m 0644 ${GUMMIBOOT_CFG} ${DEST}/loader/loader.conf
35 for i in ${GUMMIBOOT_ENTRIES}; do
36 install -m 0644 ${i} ${DEST}/loader/entries
37 done
38}
39
40efi_iso_populate() {
41 iso_dir=$1
42 efi_populate $iso_dir
43 mkdir -p ${EFIIMGDIR}/${EFIDIR}
44 cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
45 cp $iso_dir/vmlinuz ${EFIIMGDIR}
46 echo "${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
47 if [ -f "$iso_dir/initrd" ] ; then
48 cp $iso_dir/initrd ${EFIIMGDIR}
49 fi
50}
51
52efi_hddimg_populate() {
53 efi_populate $1
54}
55
56python build_efi_cfg() {
57 s = d.getVar("S", True)
58 labels = d.getVar('LABELS', True)
59 if not labels:
60 bb.debug(1, "LABELS not defined, nothing to do")
61 return
62
63 if labels == []:
64 bb.debug(1, "No labels, nothing to do")
65 return
66
67 cfile = d.getVar('GUMMIBOOT_CFG', True)
68 try:
69 cfgfile = open(cfile, 'w')
70 except OSError:
71 raise bb.build.funcFailed('Unable to open %s' % (cfile))
72
73 cfgfile.write('# Automatically created by OE\n')
74 cfgfile.write('default %s\n' % (labels.split()[0]))
75 timeout = d.getVar('GUMMIBOOT_TIMEOUT', True)
76 if timeout:
77 cfgfile.write('timeout %s\n' % timeout)
78 else:
79 cfgfile.write('timeout 10\n')
80 cfgfile.close()
81
82 for label in labels.split():
83 localdata = d.createCopy()
84
85 overrides = localdata.getVar('OVERRIDES', True)
86 if not overrides:
87 raise bb.build.FuncFailed('OVERRIDES not defined')
88
89 entryfile = "%s/%s.conf" % (s, label)
90 d.appendVar("GUMMIBOOT_ENTRIES", " " + entryfile)
91 try:
92 entrycfg = open(entryfile, "w")
93 except OSError:
94 raise bb.build.funcFailed('Unable to open %s' % (entryfile))
95 localdata.setVar('OVERRIDES', label + ':' + overrides)
96 bb.data.update_data(localdata)
97
98 entrycfg.write('title %s\n' % label)
99 entrycfg.write('linux /vmlinuz\n')
100
101 append = localdata.getVar('APPEND', True)
102 initrd = localdata.getVar('INITRD', True)
103
104 if initrd:
105 entrycfg.write('initrd /initrd\n')
106 lb = label
107 if label == "install":
108 lb = "install-efi"
109 entrycfg.write('options LABEL=%s ' % lb)
110 if append:
111 entrycfg.write('%s' % append)
112 entrycfg.write('\n')
113 entrycfg.close()
114}