summaryrefslogtreecommitdiffstats
path: root/images
diff options
context:
space:
mode:
authorGabriel Ionescu <gabriel.ionescu@enea.com>2018-02-12 15:10:44 +0100
committerMartin Borg <martin.borg@enea.com>2018-02-12 16:20:36 +0100
commit0f8054fac4d121594476941307794d0b0b50bd89 (patch)
treea5934bcb0a25b6442f796678a2df23c0f1f99240 /images
parente6d4dd15a2b12adc99e8ae63663a349ccc95728d (diff)
downloadmeta-el-nfv-access-0f8054fac4d121594476941307794d0b0b50bd89.tar.gz
Customize NFV Access image for ODM kit
Include element-odm in the image and customize the boot scripts Signed-off-by: Gabriel Ionescu <gabriel.ionescu@enea.com> Signed-off-by: Martin Borg <martin.borg@enea.com>
Diffstat (limited to 'images')
-rw-r--r--images/enea-nfv-access-odm.bb130
1 files changed, 130 insertions, 0 deletions
diff --git a/images/enea-nfv-access-odm.bb b/images/enea-nfv-access-odm.bb
new file mode 100644
index 0000000..2509f2e
--- /dev/null
+++ b/images/enea-nfv-access-odm.bb
@@ -0,0 +1,130 @@
1DESCRIPTION = "Image for the host side of the Enea NFV Access Platform with ODM customizations"
2LICENSE=""
3require images/enea-nfv-access-common.inc
4
5IMAGE_INSTALL += " \
6 packagegroup-enea-virtualization-element-odm \
7 packagegroup-enea-virtualization-host \
8 element-odm \
9 "
10
11# Customize the syslinux config file
12python build_syslinux_cfg () {
13 import copy
14 import sys
15
16 workdir = d.getVar('WORKDIR')
17 if not workdir:
18 bb.error("WORKDIR not defined, unable to package")
19 return
20
21 cfile = d.getVar('SYSLINUX_CFG')
22 if not cfile:
23 bb.fatal('Unable to read SYSLINUX_CFG')
24
25 try:
26 cfgfile = open(cfile, 'w')
27 except OSError:
28 bb.fatal('Unable to open %s' % cfile)
29
30 cfgfile.write('# Automatically created by OE - Customized for NFV Access\n')
31
32 opts = d.getVar('SYSLINUX_OPTS')
33
34 if opts:
35 for opt in opts.split(';'):
36 cfgfile.write('%s\n' % opt)
37
38 allowoptions = d.getVar('SYSLINUX_ALLOWOPTIONS')
39 if allowoptions:
40 cfgfile.write('ALLOWOPTIONS %s\n' % allowoptions)
41 else:
42 cfgfile.write('ALLOWOPTIONS 1\n')
43
44 syslinux_default_console = d.getVar('SYSLINUX_DEFAULT_CONSOLE')
45 syslinux_serial_tty = d.getVar('SYSLINUX_SERIAL_TTY')
46 syslinux_serial = d.getVar('SYSLINUX_SERIAL')
47 if syslinux_serial:
48 cfgfile.write('SERIAL %s\n' % syslinux_serial)
49
50 menu = (d.getVar('AUTO_SYSLINUXMENU') == "1")
51
52 cfgfile.write("DEFAULT Install NFV Access\n")
53
54 cfgfile.write('TIMEOUT 10\n')
55
56 prompt = d.getVar('SYSLINUX_PROMPT')
57 if prompt:
58 cfgfile.write('PROMPT %s\n' % prompt)
59 else:
60 cfgfile.write('PROMPT 1\n')
61
62 if menu:
63 cfgfile.write('ui vesamenu.c32\n')
64 cfgfile.write('menu title Select kernel options and boot kernel\n')
65 cfgfile.write('menu tabmsg Press [Tab] to edit, [Return] to select\n')
66
67 cfgfile.write("LABEL Boot NFV Access\n")
68 cfgfile.write("KERNEL /vmlinuz\n")
69 cfgfile.write("APPEND initrd=/initrd LABEL=boot root=/dev/ram0 rootwait console=ttyS0,115200\n")
70
71 cfgfile.write("LABEL Install NFV Access\n")
72 cfgfile.write("KERNEL /vmlinuz\n")
73 cfgfile.write("APPEND initrd=/initrd LABEL=installer root=/dev/ram0 rootwait console=ttyS0,115200\n")
74
75
76 cfgfile.close()
77}
78
79# Customize the GRUB config file
80python build_efi_cfg() {
81 import sys
82
83 workdir = d.getVar('WORKDIR')
84 if not workdir:
85 bb.error("WORKDIR not defined, unable to package")
86 return
87
88 gfxserial = d.getVar('GRUB_GFXSERIAL') or ""
89
90 cfile = d.getVar('GRUB_CFG')
91 if not cfile:
92 bb.fatal('Unable to read GRUB_CFG')
93
94 try:
95 cfgfile = open(cfile, 'w')
96 except OSError:
97 bb.fatal('Unable to open %s' % cfile)
98
99 cfgfile.write('# Automatically created by OE - customized for NFV Access\n')
100
101 cfgfile.write('default=Boot NFV Access\n')
102
103 timeout = d.getVar('GRUB_TIMEOUT')
104 if timeout:
105 cfgfile.write('timeout=%s\n' % timeout)
106 else:
107 cfgfile.write('timeout=50\n')
108
109 root = d.getVar('GRUB_ROOT')
110 if not root:
111 bb.fatal('GRUB_ROOT not defined')
112
113 if gfxserial == "1":
114 btypes = [ [ " graphics console", "" ],
115 [ " serial console", d.getVar('GRUB_SERIAL') or "" ] ]
116 else:
117 btypes = [ [ "", "" ] ]
118
119 cfgfile.write("menuentry 'Boot NFV Access'{\n")
120 cfgfile.write("linux /vmlinuz %s rootwait LABEL=boot console=ttyS0,115200\n" % root)
121 cfgfile.write("initrd /initrd\n")
122 cfgfile.write("}\n")
123
124 cfgfile.write("menuentry 'Install NFV Access'{\n")
125 cfgfile.write("linux /vmlinuz %s rootwait LABEL=installer console=ttyS0,115200\n" % root)
126 cfgfile.write("initrd /initrd\n")
127 cfgfile.write("}\n")
128
129 cfgfile.close()
130}