From 0f8054fac4d121594476941307794d0b0b50bd89 Mon Sep 17 00:00:00 2001 From: Gabriel Ionescu Date: Mon, 12 Feb 2018 15:10:44 +0100 Subject: Customize NFV Access image for ODM kit Include element-odm in the image and customize the boot scripts Signed-off-by: Gabriel Ionescu Signed-off-by: Martin Borg --- images/enea-nfv-access-odm.bb | 130 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 images/enea-nfv-access-odm.bb 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 @@ +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 \ + " + +# 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() +} -- cgit v1.2.3-54-g00ecf