[meta-xilinx] [PATCH] kernel-simpleimage.bbclass: Fix do_prep_simpleimage `[[: not found`
Manjukumar Harthikote Matha
MANJUKUM at xilinx.com
Thu Aug 15 17:22:56 PDT 2019
Hi Michael,
> -----Original Message-----
> From: meta-xilinx-bounces at yoctoproject.org <meta-xilinx-
> bounces at yoctoproject.org> On Behalf Of Monaghan, Michael L. (GSFC-5870)
> Sent: Tuesday, July 30, 2019 4:43 PM
> To: meta-xilinx at yoctoproject.org
> Subject: [meta-xilinx] [PATCH] kernel-simpleimage.bbclass: Fix
> do_prep_simpleimage `[[: not found`
>
> 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.
>
We haven’t run into this issue.
> 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"!
>
Bash programming supports "[[", not sure why you are seeing the error
> 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.
>
I am ok with the patch since it essentially does the same.
> Signed-off-by: Michael Monaghan <michael.l.monaghan at nasa.gov>
> ---
> 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)
>
Thanks,
Manju
More information about the meta-xilinx
mailing list