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
        
/yocto/builds/microblaze/tmp/work/kcu102_microblazeel-poky-linux/linux-xlnx/4.14-xilinx-v2018.3+gitAUTOINC+eeab73d120-r0/temp/run.do_prep_simpleimage.66740:
 112:       
/yocto/builds/microblaze/tmp/work/kcu102_microblazeel-poky-linux/linux-xlnx/4.14-xilinx-v2018.3+gitAUTOINC+eeab73d120-r0/temp/run.do_prep_simpleimage.66740:
 [[: not found
        
/yocto/builds/microblaze/tmp/work/kcu102_microblazeel-poky-linux/linux-xlnx/4.14-xilinx-v2018.3+gitAUTOINC+eeab73d120-r0/temp/run.do_prep_simpleimage.66740:
 112:       
/yocto/builds/microblaze/tmp/work/kcu102_microblazeel-poky-linux/linux-xlnx/4.14-xilinx-v2018.3+gitAUTOINC+eeab73d120-r0/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 <[email protected]>
---
 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 348d0a7..6da28f3 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
-- 
2.20.1 (Apple Git-117)


-- 
_______________________________________________
meta-xilinx mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-xilinx

Reply via email to