/
bootspec.bbclass
48 lines (33 loc) · 1.48 KB
/
bootspec.bbclass
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
# Adds boot spec entry for first FSTYPE found
BOOTSPEC_TITLE ?= "${SUMMARY}"
BOOTSPEC_TITLE[doc] = "Content of the boot spec entry 'title' line"
BOOTSPEC_FILENAME ?= "${MACHINE}.conf"
BOOTSPEC_FILENAME[doc] = "Name of the created boot spec entry file"
BOOTSPEC_OPTIONS_ext4 = "rootfstype=ext4 rootwait"
BOOTSPEC_OPTIONS_ubi = "rootfstype=ubifs"
BOOTSPEC_OPTIONS_DEFAULT = ""
python () {
option = ""
for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
option = d.getVar('BOOTSPEC_OPTIONS_%s' % type)
if option:
break;
d.setVar('BOOTSPEC_OPTIONS_DEFAULT', option)
}
BOOTSPEC_OPTIONS ?= "${BOOTSPEC_OPTIONS_DEFAULT}"
BOOTSPEC_OPTIONS[doc] = "Content of the boot spec entry 'options' line"
python create_bootspec() {
bb.note("Creating boot spec entry /loader/entries/${BOOTSPEC_FILENAME} ...")
bb.utils.mkdirhier("${IMAGE_ROOTFS}/loader/entries/")
try:
bootspecfile = open("${IMAGE_ROOTFS}/loader/entries/${BOOTSPEC_FILENAME}", 'w')
except OSError:
raise bb.build.FuncFailed('Unable to open boot spec file for writing')
bootspecfile.write('title ${BOOTSPEC_TITLE} boot spec entry\n')
bootspecfile.write('version 1.0\n')
bootspecfile.write('options ${BOOTSPEC_OPTIONS}\n')
bootspecfile.write('linux /boot/${KERNEL_IMAGETYPE}\n')
bootspecfile.write('devicetree /boot/devicetree-${KERNEL_IMAGETYPE}-${KERNEL_DEVICETREE}\n')
bootspecfile.close()
}
ROOTFS_POSTPROCESS_COMMAND += " create_bootspec; "