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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
DESCRIPTION = "Image for the host side of the Enea NFV Access Platform with ODM customizations"
LICENSE=""
require images/enea-nfv-access-common.inc
IMAGE_INSTALL += " \
packagegroup-enea-virtualization-element-odm \
packagegroup-enea-virtualization-host \
element-odm \
nfv-init-host \
"
# Customize the syslinux config file
python build_syslinux_cfg () {
import copy
import sys
workdir = d.getVar('WORKDIR')
if not workdir:
bb.error("WORKDIR not defined, unable to package")
return
cfile = d.getVar('SYSLINUX_CFG')
if not cfile:
bb.fatal('Unable to read SYSLINUX_CFG')
try:
cfgfile = open(cfile, 'w')
except OSError:
bb.fatal('Unable to open %s' % cfile)
cfgfile.write('# Automatically created by OE - Customized for NFV Access\n')
opts = d.getVar('SYSLINUX_OPTS')
if opts:
for opt in opts.split(';'):
cfgfile.write('%s\n' % opt)
allowoptions = d.getVar('SYSLINUX_ALLOWOPTIONS')
if allowoptions:
cfgfile.write('ALLOWOPTIONS %s\n' % allowoptions)
else:
cfgfile.write('ALLOWOPTIONS 1\n')
syslinux_default_console = d.getVar('SYSLINUX_DEFAULT_CONSOLE')
syslinux_serial_tty = d.getVar('SYSLINUX_SERIAL_TTY')
syslinux_serial = d.getVar('SYSLINUX_SERIAL')
if syslinux_serial:
cfgfile.write('SERIAL %s\n' % syslinux_serial)
menu = (d.getVar('AUTO_SYSLINUXMENU') == "1")
cfgfile.write("DEFAULT Install NFV Access\n")
cfgfile.write('TIMEOUT 10\n')
prompt = d.getVar('SYSLINUX_PROMPT')
if prompt:
cfgfile.write('PROMPT %s\n' % prompt)
else:
cfgfile.write('PROMPT 1\n')
if menu:
cfgfile.write('ui vesamenu.c32\n')
cfgfile.write('menu title Select kernel options and boot kernel\n')
cfgfile.write('menu tabmsg Press [Tab] to edit, [Return] to select\n')
cfgfile.write("LABEL Boot NFV Access\n")
cfgfile.write("KERNEL /vmlinuz\n")
cfgfile.write("APPEND initrd=/initrd LABEL=boot root=/dev/ram0 rootwait console=ttyS0,115200\n")
cfgfile.write("LABEL Install NFV Access\n")
cfgfile.write("KERNEL /vmlinuz\n")
cfgfile.write("APPEND initrd=/initrd LABEL=installer root=/dev/ram0 rootwait console=ttyS0,115200\n")
cfgfile.close()
}
# Customize the GRUB config file
python build_efi_cfg() {
import sys
workdir = d.getVar('WORKDIR')
if not workdir:
bb.error("WORKDIR not defined, unable to package")
return
gfxserial = d.getVar('GRUB_GFXSERIAL') or ""
cfile = d.getVar('GRUB_CFG')
if not cfile:
bb.fatal('Unable to read GRUB_CFG')
try:
cfgfile = open(cfile, 'w')
except OSError:
bb.fatal('Unable to open %s' % cfile)
cfgfile.write('# Automatically created by OE - customized for NFV Access\n')
cfgfile.write('default=Boot NFV Access\n')
timeout = d.getVar('GRUB_TIMEOUT')
if timeout:
cfgfile.write('timeout=%s\n' % timeout)
else:
cfgfile.write('timeout=50\n')
root = d.getVar('GRUB_ROOT')
if not root:
bb.fatal('GRUB_ROOT not defined')
if gfxserial == "1":
btypes = [ [ " graphics console", "" ],
[ " serial console", d.getVar('GRUB_SERIAL') or "" ] ]
else:
btypes = [ [ "", "" ] ]
cfgfile.write("menuentry 'Boot NFV Access'{\n")
cfgfile.write("linux /vmlinuz %s rootwait LABEL=boot console=ttyS0,115200\n" % root)
cfgfile.write("initrd /initrd\n")
cfgfile.write("}\n")
cfgfile.write("menuentry 'Install NFV Access'{\n")
cfgfile.write("linux /vmlinuz %s rootwait LABEL=installer console=ttyS0,115200\n" % root)
cfgfile.write("initrd /initrd\n")
cfgfile.write("}\n")
cfgfile.close()
}
|