Module: xenomai-2.6
Branch: master
Commit: 21a1dd8cc0786c32d96092444be440a688729589
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=21a1dd8cc0786c32d96092444be440a688729589

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Dec 30 18:59:11 2011 +0100

scripts: prepare for upcoming pipeline core series

---

 scripts/prepare-kernel.sh |   71 ++++++++++++++++++++++++++------------------
 1 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh
index b64724f..2e9509b 100755
--- a/scripts/prepare-kernel.sh
+++ b/scripts/prepare-kernel.sh
@@ -170,7 +170,7 @@ generate_patch() {
 }
 
 
-usage='usage: prepare-kernel --linux=<linux-tree> --adeos=<adeos-patch> 
[--arch=<arch>] [--outpatch=<file> [--filterkvers=y|n] [--filterarch=y|n]] 
[--forcelink] [--default] [--verbose]'
+usage='usage: prepare-kernel --linux=<linux-tree> --ipipe=<ipipe-patch> 
[--arch=<arch>] [--outpatch=<file> [--filterkvers=y|n] [--filterarch=y|n]] 
[--forcelink] [--default] [--verbose]'
 me=`basename $0`
 
 while test $# -gt 0; do
@@ -180,8 +180,12 @@ while test $# -gt 0; do
        linux_tree=`eval "echo $linux_tree"`
        ;;
     --adeos=*)
-       adeos_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
-       adeos_patch=`eval "echo $adeos_patch"`
+       ipipe_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
+       ipipe_patch=`eval "echo $ipipe_patch"`
+       ;;
+    --ipipe=*)
+       ipipe_patch=`echo $1|sed -e 's,^--ipipe=\\(.*\\)$,\\1,g'`
+       ipipe_patch=`eval "echo $ipipe_patch"`
        ;;
     --arch=*)
        linux_arch=`echo $1|sed -e 's,^--arch=\\(.*\\)$,\\1,g'`
@@ -364,46 +368,48 @@ fi
 
 if test -r $linux_tree/include/linux/ipipe.h; then
     if test x$verbose = x1; then
-    echo "Adeos found - bypassing patch."
+    echo "I-Pipe found - bypassing patch."
     fi
 elif test -r $linux_tree/include/linux/adeos.h; then
    echo "$me: Deprecated Adeos (oldgen) support found in $linux_tree;" >&2
-   echo "Upgrade required to Adeos/I-pipe (newgen)." >&2
+   echo "Upgrade required to I-pipe." >&2
    exit 2
 else
-   if test x$adeos_patch = x; then
-      default_adeos_patch="`( ls 
$xenomai_root/ksrc/arch/$xenomai_arch/patches/adeos-ipipe-$linux_version*-{$linux_arch,$xenomai_arch}-*|sort
 -r ) 2>/dev/null | head -n1`"
+   if test x$ipipe_patch = x; then
+      # We pick ipipe-core-* patches first over adeos-ipipe-* ones,
+      # then the highest numbered sequence/release number.
+      default_ipipe_patch="`( ls 
$xenomai_root/ksrc/arch/$xenomai_arch/patches/ipipe-core-$linux_version*-$xenomai_arch-*
 
$xenomai_root/ksrc/arch/$xenomai_arch/patches/adeos-ipipe-$linux_version*-{$linux_arch,$xenomai_arch}-*|sort
 -r ) 2>/dev/null | head -n1`"
    fi
-   if test x$default_adeos_patch = x; then
+   if test x$default_ipipe_patch = x; then
       if test x$verbose = x1; then
-         echo "$me: no default Adeos patch found." >&2
+         echo "$me: no default I-pipe patch found." >&2
       fi
-      default_adeos_patch=/dev/null
+      default_ipipe_patch=/dev/null
    fi
-   while test x$adeos_patch = x; do
+   while test x$ipipe_patch = x; do
       if test x$usedefault = x; then
-         echo -n "Adeos patch [default $default_adeos_patch]: "
-         read adeos_patch
+         echo -n "I-pipe patch [default $default_ipipe_patch]: "
+         read ipipe_patch
       fi
-      if test x$adeos_patch = x; then
-         adeos_patch=$default_adeos_patch
+      if test x$ipipe_patch = x; then
+         ipipe_patch=$default_ipipe_patch
       fi
-      if test \! -r "$adeos_patch" -o x$adeos_patch = x/dev/null; then
-         echo "$me: cannot read Adeos patch from $adeos_patch" >&2
+      if test \! -r "$ipipe_patch" -o x$ipipe_patch = x/dev/null; then
+         echo "$me: cannot read I-pipe patch from $ipipe_patch" >&2
          usedefault=
-         adeos_patch=
+         ipipe_patch=
       fi
    done
-   patchdir=`dirname $adeos_patch`; 
+   patchdir=`dirname $ipipe_patch`; 
    patchdir=`cd $patchdir && pwd`
-   adeos_patch=$patchdir/`basename $adeos_patch`
+   ipipe_patch=$patchdir/`basename $ipipe_patch`
    curdir=$PWD
-   cd $linux_tree && patch --dry-run -p1 -f < $adeos_patch || { 
+   cd $linux_tree && patch --dry-run -p1 -f < $ipipe_patch || { 
         cd $curdir;
-        echo "$me: Unable to patch kernel $linux_version$linux_EXTRAVERSION 
with `basename $adeos_patch`." >&2
+        echo "$me: Unable to patch kernel $linux_version$linux_EXTRAVERSION 
with `basename $ipipe_patch`." >&2
         exit 2;
    }
-   patch -p1 -f -s < $adeos_patch
+   patch -p1 -f -s < $ipipe_patch
    cd $curdir
 fi
 
@@ -418,18 +424,25 @@ else
 fi
 
 if test -z "$asm_ipipe_h"; then
-   echo "$me: $linux_tree has no Adeos support for $linux_arch" >&2
+   echo "$me: $linux_tree has no I-pipe support for $linux_arch" >&2
    exit 2
 fi
-adeos_version=`grep '^#define.*IPIPE_ARCH_STRING.*"' $asm_ipipe_h 
2>/dev/null|head -n1|sed -e 's,.*"\(.*\)"$,\1,'`
 
-if test \! "x$adeos_version" = x; then
+ipipe_legacy=`grep '^#define.*IPIPE_ARCH_STRING.*"' $asm_ipipe_h 
2>/dev/null|head -n1|sed -e 's,.*"\(.*\)"$,\1,'`
+
+if test \! "x$ipipe_legacy" = x; then
    if test x$verbose = x1; then
-   echo "Adeos/$linux_arch $adeos_version installed."
+     echo "Legacy I-pipe/$linux_arch $ipipe_legacy installed."
    fi
 else
-   echo "$me: $linux_tree has no Adeos support for $linux_arch" >&2
-   exit 2
+   ipipe_core=`grep '^#define.*IPIPE_CORE_RELEASE.*' $asm_ipipe_h 
2>/dev/null|head -n1|sed -e 's,[^0-9]*\([0-9]*\)$,\1,'`
+   if test "x$ipipe_core" = x; then
+       echo "$me: $linux_tree has no I-pipe support for $linux_arch" >&2
+       exit 2
+   fi
+   if test x$verbose = x1; then
+     echo "I-pipe core/$linux_arch #$ipipe_core installed."
+   fi
 fi
 
 patch_kernelversion_specific="y"


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to