Return-Path: Received: from owm.eumx.net (eumx.net [91.82.101.43]) by mail.openembedded.org (Postfix) with ESMTP id 108CF6FF80 for ; Sat, 11 Mar 2017 14:16:09 +0000 (UTC) From: Jack Mitchell To: openembedded-core@lists.openembedded.org Date: Sat, 11 Mar 2017 14:16:03 +0000 Message-Id: <20170311141603.18357-2-ml@embed.me.uk> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170311141603.18357-1-ml@embed.me.uk> References: <20170311141603.18357-1-ml@embed.me.uk> Cc: Jack Mitchell Subject: [PATCH 2/2] u-boot: add option to specify FDT argument in extlinux.conf X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Mar 2017 14:16:12 -0000 From: Jack Mitchell Also fixes a use before defined bug with localdata. Signed-off-by: Jack Mitchell --- meta/classes/uboot-extlinux-config.bbclass | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/meta/classes/uboot-extlinux-config.bbclass b/meta/classes/uboot-extlinux-config.bbclass index aae21713e3..8447a047ee 100644 --- a/meta/classes/uboot-extlinux-config.bbclass +++ b/meta/classes/uboot-extlinux-config.bbclass @@ -12,6 +12,7 @@ # 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. @@ -59,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" @@ -84,6 +86,8 @@ python create_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') @@ -99,9 +103,8 @@ python create_extlinux_config() { 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') if not overrides: @@ -121,7 +124,13 @@ python create_extlinux_config() { kernel_image = localdata.getVar('UBOOT_EXTLINUX_KERNEL_IMAGE') fdtdir = localdata.getVar('UBOOT_EXTLINUX_FDTDIR') - if 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: -- 2.12.0