diff options
Diffstat (limited to 'import-layers/yocto-poky/meta/classes/uboot-extlinux-config.bbclass')
-rw-r--r-- | import-layers/yocto-poky/meta/classes/uboot-extlinux-config.bbclass | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/import-layers/yocto-poky/meta/classes/uboot-extlinux-config.bbclass b/import-layers/yocto-poky/meta/classes/uboot-extlinux-config.bbclass index df91386c00..8447a047ee 100644 --- a/import-layers/yocto-poky/meta/classes/uboot-extlinux-config.bbclass +++ b/import-layers/yocto-poky/meta/classes/uboot-extlinux-config.bbclass @@ -12,10 +12,15 @@ # UBOOT_EXTLINUX_KERNEL_ARGS - Add additional kernel arguments. # UBOOT_EXTLINUX_KERNEL_IMAGE - Kernel image name. # UBOOT_EXTLINUX_FDTDIR - Device tree directory. +# UBOOT_EXTLINUX_FDT - Device tree file. # UBOOT_EXTLINUX_INITRD - Indicates a list of filesystem images to # concatenate and use as an initrd (optional). # UBOOT_EXTLINUX_MENU_DESCRIPTION - Name to use as description. # UBOOT_EXTLINUX_ROOT - Root kernel cmdline. +# UBOOT_EXTLINUX_TIMEOUT - Timeout before DEFAULT selection is made. +# Measured in 1/10 of a second. +# UBOOT_EXTLINUX_DEFAULT_LABEL - Target to be selected by default after +# the timeout period # # If there's only one label system will boot automatically and menu won't be # created. If you want to use more than one labels, e.g linux and alternate, @@ -25,6 +30,9 @@ # # UBOOT_EXTLINUX_LABELS ??= "default fallback" # +# UBOOT_EXTLINUX_DEFAULT_LABEL ??= "Linux Default" +# UBOOT_EXTLINUX_TIMEOUT ??= "30" +# # UBOOT_EXTLINUX_KERNEL_IMAGE_default ??= "../zImage" # UBOOT_EXTLINUX_MENU_DESCRIPTION_default ??= "Linux Default" # @@ -34,6 +42,8 @@ # Results: # # menu title Select the boot mode +# TIMEOUT 30 +# DEFAULT Linux Default # LABEL Linux Default # KERNEL ../zImage # FDTDIR ../ @@ -50,6 +60,7 @@ # a console=...some_tty... UBOOT_EXTLINUX_CONSOLE ??= "console=${console}" UBOOT_EXTLINUX_LABELS ??= "linux" +UBOOT_EXTLINUX_FDT ??= "" UBOOT_EXTLINUX_FDTDIR ??= "../" UBOOT_EXTLINUX_KERNEL_IMAGE ??= "../${KERNEL_IMAGETYPE}" UBOOT_EXTLINUX_KERNEL_ARGS ??= "rootwait rw" @@ -58,23 +69,25 @@ UBOOT_EXTLINUX_MENU_DESCRIPTION_linux ??= "${DISTRO_NAME}" UBOOT_EXTLINUX_CONFIG = "${B}/extlinux.conf" python create_extlinux_config() { - if d.getVar("UBOOT_EXTLINUX", True) != "1": + if d.getVar("UBOOT_EXTLINUX") != "1": return - if not d.getVar('WORKDIR', True): + if not d.getVar('WORKDIR'): bb.error("WORKDIR not defined, unable to package") - labels = d.getVar('UBOOT_EXTLINUX_LABELS', True) + labels = d.getVar('UBOOT_EXTLINUX_LABELS') if not labels: bb.fatal("UBOOT_EXTLINUX_LABELS not defined, nothing to do") if not labels.strip(): bb.fatal("No labels, nothing to do") - cfile = d.getVar('UBOOT_EXTLINUX_CONFIG', True) + cfile = d.getVar('UBOOT_EXTLINUX_CONFIG') if not cfile: bb.fatal('Unable to read UBOOT_EXTLINUX_CONFIG') + localdata = bb.data.createCopy(d) + try: with open(cfile, 'w') as cfgfile: cfgfile.write('# Generic Distro Configuration file generated by OpenEmbedded\n') @@ -82,37 +95,50 @@ python create_extlinux_config() { if len(labels.split()) > 1: cfgfile.write('menu title Select the boot mode\n') + timeout = localdata.getVar('UBOOT_EXTLINUX_TIMEOUT') + if timeout: + cfgfile.write('TIMEOUT %s\n' % (timeout)) + + if len(labels.split()) > 1: + default = localdata.getVar('UBOOT_EXTLINUX_DEFAULT_LABEL') + if default: + cfgfile.write('DEFAULT %s\n' % (default)) + for label in labels.split(): - localdata = bb.data.createCopy(d) - overrides = localdata.getVar('OVERRIDES', True) + overrides = localdata.getVar('OVERRIDES') if not overrides: bb.fatal('OVERRIDES not defined') localdata.setVar('OVERRIDES', label + ':' + overrides) - bb.data.update_data(localdata) - extlinux_console = localdata.getVar('UBOOT_EXTLINUX_CONSOLE', True) + extlinux_console = localdata.getVar('UBOOT_EXTLINUX_CONSOLE') - menu_description = localdata.getVar('UBOOT_EXTLINUX_MENU_DESCRIPTION', True) + menu_description = localdata.getVar('UBOOT_EXTLINUX_MENU_DESCRIPTION') if not menu_description: menu_description = label - root = localdata.getVar('UBOOT_EXTLINUX_ROOT', True) + root = localdata.getVar('UBOOT_EXTLINUX_ROOT') if not root: bb.fatal('UBOOT_EXTLINUX_ROOT not defined') - kernel_image = localdata.getVar('UBOOT_EXTLINUX_KERNEL_IMAGE', True) - fdtdir = localdata.getVar('UBOOT_EXTLINUX_FDTDIR', True) - if fdtdir: + kernel_image = localdata.getVar('UBOOT_EXTLINUX_KERNEL_IMAGE') + fdtdir = localdata.getVar('UBOOT_EXTLINUX_FDTDIR') + + fdt = localdata.getVar('UBOOT_EXTLINUX_FDT') + + if fdt: + cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDT %s\n' % + (menu_description, kernel_image, fdt)) + elif fdtdir: cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDTDIR %s\n' % (menu_description, kernel_image, fdtdir)) else: cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image)) - kernel_args = localdata.getVar('UBOOT_EXTLINUX_KERNEL_ARGS', True) + kernel_args = localdata.getVar('UBOOT_EXTLINUX_KERNEL_ARGS') - initrd = localdata.getVar('UBOOT_EXTLINUX_INITRD', True) + initrd = localdata.getVar('UBOOT_EXTLINUX_INITRD') if initrd: cfgfile.write('\tINITRD %s\n'% initrd) |