From a0cec9bc3ea52c373a93ddd5d3356927a121f9b4 Mon Sep 17 00:00:00 2001 From: Michael Monaghan Date: Tue, 30 Jul 2019 23:43:25 +0000 Subject: kernel-simpleimage.bbclass: Fix do_prep_simpleimage `[[: not found` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While developing a custom MicroBlaze machine configuration with meta-xilinx-bsp, the linux-xlnx recipe would fail when configured to use the “simpleImage.devicetree-name” kernel image type. Though the do_prep_simpleimage task does not fail, messages were left in the log indicating the “[[“ bash extension could not be found. DEBUG: Executing shell function do_prep_simpleimage temp/run.do_prep_simpleimage.66740: [[: not found DEBUG: Shell function do_prep_simpleimage finished The two offending lines are in kernel-simpleimage.bbclass. Here's one of them for reference. if [[ "${type}" =~ "simpleImage" ]] && [ ${ARCH} = "microblaze" ]; then The problem is that “[[“ will return -1 since the extension is not found and the if statement will simply interpret the error as false causing the task to continue, even if the image type was "simpleImage"! Testing was done using the official crops/poky docker image. The crops/poky system shell was confirmed to include the “[[“ extension however, it appears that the extension is disabled within the recipe shell scripts. In addition, "[[" does not appear to be used by any openembedded-core recipes so I made this patch to convert the two instances of "[[" to "[". The patch was created for master, but the problem appears to exist on all branches of meta-xilinx. Signed-off-by: Michael Monaghan Signed-off-by: Manjukumar Matha --- meta-xilinx-bsp/classes/kernel-simpleimage.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta-xilinx-bsp/classes/kernel-simpleimage.bbclass b/meta-xilinx-bsp/classes/kernel-simpleimage.bbclass index 348d0a73..6da28f36 100644 --- a/meta-xilinx-bsp/classes/kernel-simpleimage.bbclass +++ b/meta-xilinx-bsp/classes/kernel-simpleimage.bbclass @@ -13,7 +13,7 @@ do_prep_simpleimage[dirs] += "${B}" do_prep_simpleimage () { install -d ${B}/arch/${ARCH}/boot/dts for type in ${KERNEL_IMAGETYPES} ; do - if [[ "${type}" =~ "simpleImage" ]] && [ ${ARCH} = "microblaze" ]; then + if [ -z "${type##*simpleImage*}" ] && [ ${ARCH} = "microblaze" ]; then ext="${type##*.}" # Microblaze simpleImage only works with dts file cp ${RECIPE_SYSROOT}/boot/devicetree/${ext}.dts ${B}/arch/${ARCH}/boot/dts/ @@ -23,7 +23,7 @@ do_prep_simpleimage () { do_deploy_append () { for type in ${KERNEL_IMAGETYPES} ; do - if [[ "${type}" =~ "simpleImage" ]] && [ ${ARCH} = "microblaze" ]; then + if [ -z "${type##*simpleImage*}" ] && [ ${ARCH} = "microblaze" ]; then base_name=${imageType}-${KERNEL_IMAGE_NAME} install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.strip $deployDir/${base_name}.strip install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.unstrip $deployDir/${base_name}.unstrip -- cgit v1.2.3-54-g00ecf