[Xenomai] [patch] prepare_kernel.sh --board argument

Gilles Chanteperdrix gilles.chanteperdrix at xenomai.org
Fri Apr 4 22:02:38 CEST 2014


On 04/04/2014 05:42 PM, Gregory Dymarek wrote:
> New patch below.
> Changes:
> - wrap the ipipe apply patch piece with a for loop that splits the
> ipipe_patch variable by comma and new line
> 
> 
> diff -rupN xenomai-2.6.3.orig/scripts/prepare-kernel.sh
> xenomai-2.6.3/scripts/prepare-kernel.sh
> --- xenomai-2.6.3.orig/scripts/prepare-kernel.sh        2013-05-25
> 14:44:03.000000000 +0100
> +++ xenomai-2.6.3/scripts/prepare-kernel.sh     2014-04-04
> 16:38:38.490435289 +0100
> @@ -403,16 +403,21 @@ else
>           ipipe_patch=
>        fi
>     done
> -   patchdir=`dirname $ipipe_patch`;
> -   patchdir=`cd $patchdir && pwd`
> -   ipipe_patch=$patchdir/`basename $ipipe_patch`
> -   curdir=$PWD
> -   cd $linux_tree && patch --dry-run -p1 -f < $ipipe_patch || {
> -        cd $curdir;
> -        echo "$me: Unable to patch kernel
> $linux_version$linux_EXTRAVERSION with `basename $ipipe_patch`." >&2
> -        exit 2;
> -   }
> -   patch -p1 -f -s < $ipipe_patch
> +   startdir=`pwd`
> +   for patch in $(echo $ipipe_patch | tr "," "\n")

Just a minor nit, $() is not used anywhere else in the script, and is
not strictly necessary here, you may use ``

> +   do
> +          cd $startdir
> +          patchdir=`dirname $patch`;  #relative dir
> +          patchdir=`cd $patchdir && pwd`; #absolute dir
> +          patch=$patchdir/`basename $patch`
> +          curdir=$PWD
> +          cd $linux_tree && patch --dry-run -p1 -f < $patch || {
> +               cd $curdir;
> +               echo "$me: Unable to patch kernel
> $linux_version$linux_EXTRAVERSION with `basename $patch`." >&2
> +               exit 2;
> +          }
> +          patch -p1 -f -s < $patch

That is not really correct. The point of running patch --dry-run is to
avoid leaving the code in a state where the patch is half-applied. By
applying some patches and stopping if patch --dry-run fails for some
other patch, this is exactly what you do. Note that I do not know how to
solve this, though.


-- 
                                                                Gilles.




More information about the Xenomai mailing list