All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Xenomai patch packaging concerns
@ 2006-02-23  3:24 Romain Lenglet
  2006-02-23 15:21 ` Philippe Gerum
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Lenglet @ 2006-02-23  3:24 UTC (permalink / raw)
  To: xenomai

Hi,


I understand that the prepare-kernel.sh script is a kind of 
"smart patch" program. It is very nice, but for packaging for 
Debian we need a real diff file. So I am currently modifying 
prepare-kernel.sh to be even smarter, so that it can optionally 
generate a diff file instead of actually modifying the Linux 
tree. This is done efficiently in terms of disk space, i.e. it 	
does not duplicate the Linux tree to generate the diff file.
I will send a patch for prepare-kernel.sh once I have finished.


However, I have a problem: some files are copied (linked) several 
times into the Linux tree. As a consequence, in a generated diff 
file those files would be duplicated. And I believe that such a 
duplication is unecessary.

Here are the sets of links that are currently made by 
prepare-kernel.sh (on every line: Linux tree -> Xeno tree):

1- arch/<arch>/xenomai/* -> ksrc/arch/<arch>/*
2- kernel/xenomai/* -> ksrc/*
3- kernel/xenomai/arch/* -> ksrc/arch/<arch>/*
4- kernel/xenomai/drivers/*... -> ksrc/drivers/*...
5- kernel/xenomai/nucleus/*... -> ksrc/nucleus/*...
6- kernel/xenomai/skins/*... -> ksrc/skins/*...
7- drivers/xenomai/*... -> ksrc/drivers/*...
8- include/asm-<arch>/xenomai/* -> include/asm-<arch>/*
9- include/asm-generic/xenomai/* -> include/asm-generic/*
10- include/xenomai/* -> include/*
11- include/xenomai/asm-<arch>/* -> include/asm-<arch>/*
12- include/xenomai/asm-generic/* -> include/asm-generic/*
...

1- and 3- are redundant: I guess that 3- is not required?
4- and 7- are redundant: I guess that 4- is not required?
8- and 11- are redundant: I guess that 11- is not required?
9- and 12- are redundant: I guess that 12- is not required?
I everybody agrees, I will modify prepare-kernel.sh to not 
generate the 3-, 4-, 11- and 12- sets of links.

Note that removing the 3- and 4- sets of links would also require 
to modify the ksrc/Makefile file, so that the line:
obj-$(CONFIG_XENOMAI) += arch/ nucleus/ skins/
becomes:
obj-$(CONFIG_XENOMAI) += nucleus/ skins/
and the following line should be suppressed:
subdir-$(CONFIG_XENOMAI) += arch
Is that OK?

It would even be better and easier to modify the Xenomai source 
tree to match better the Linux tree:
ksrc/
    L arch
    L drivers
    L kernel
        L nucleus
        L skins

And I also will make prepare-kernel.sh not link (or generate 
diff) for the asm-<arch> and arch/<arch>/ directories for 
architectures that are different from the built architecture.

-- 
Romain LENGLET


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Xenomai patch packaging concerns
  2006-02-23  3:24 [Xenomai-core] Xenomai patch packaging concerns Romain Lenglet
@ 2006-02-23 15:21 ` Philippe Gerum
  2006-02-24 11:56   ` Romain Lenglet
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Gerum @ 2006-02-23 15:21 UTC (permalink / raw)
  To: Romain Lenglet; +Cc: xenomai

Romain Lenglet wrote:
> Hi,
> 
> 
> I understand that the prepare-kernel.sh script is a kind of 
> "smart patch" program. It is very nice, but for packaging for 
> Debian we need a real diff file. So I am currently modifying 
> prepare-kernel.sh to be even smarter, so that it can optionally 
> generate a diff file instead of actually modifying the Linux 
> tree. This is done efficiently in terms of disk space, i.e. it 	
> does not duplicate the Linux tree to generate the diff file.
> I will send a patch for prepare-kernel.sh once I have finished.
> 
> 
> However, I have a problem: some files are copied (linked) several 
> times into the Linux tree. As a consequence, in a generated diff 
> file those files would be duplicated. And I believe that such a 
> duplication is unecessary.
> 
> Here are the sets of links that are currently made by 
> prepare-kernel.sh (on every line: Linux tree -> Xeno tree):
> 
> 1- arch/<arch>/xenomai/* -> ksrc/arch/<arch>/*
> 2- kernel/xenomai/* -> ksrc/*
> 3- kernel/xenomai/arch/* -> ksrc/arch/<arch>/*
> 4- kernel/xenomai/drivers/*... -> ksrc/drivers/*...
> 5- kernel/xenomai/nucleus/*... -> ksrc/nucleus/*...
> 6- kernel/xenomai/skins/*... -> ksrc/skins/*...
> 7- drivers/xenomai/*... -> ksrc/drivers/*...
> 8- include/asm-<arch>/xenomai/* -> include/asm-<arch>/*
> 9- include/asm-generic/xenomai/* -> include/asm-generic/*
> 10- include/xenomai/* -> include/*
> 11- include/xenomai/asm-<arch>/* -> include/asm-<arch>/*
> 12- include/xenomai/asm-generic/* -> include/asm-generic/*
> ...
> 
> 1- and 3- are redundant: I guess that 3- is not required?
> 4- and 7- are redundant: I guess that 4- is not required?
> 8- and 11- are redundant: I guess that 11- is not required?
> 9- and 12- are redundant: I guess that 12- is not required?
> I everybody agrees, I will modify prepare-kernel.sh to not 
> generate the 3-, 4-, 11- and 12- sets of links.
> 
> Note that removing the 3- and 4- sets of links would also require 
> to modify the ksrc/Makefile file, so that the line:
> obj-$(CONFIG_XENOMAI) += arch/ nucleus/ skins/
> becomes:
> obj-$(CONFIG_XENOMAI) += nucleus/ skins/
> and the following line should be suppressed:
> subdir-$(CONFIG_XENOMAI) += arch
> Is that OK?
> 

Entering arch/ from the kernel section is needed to compile the generic HAL part; 
this is why 3- is currently needed. How would this fit into your new layout?
Filtering out the rest looks ok though.

> It would even be better and easier to modify the Xenomai source 
> tree to match better the Linux tree:
> ksrc/
>     L arch
>     L drivers
>     L kernel
>         L nucleus
>         L skins
>

We could do that for later versions, but the generic HAL issue needs to be 
addressed first.

> And I also will make prepare-kernel.sh not link (or generate 
> diff) for the asm-<arch> and arch/<arch>/ directories for 
> architectures that are different from the built architecture.
> 


-- 

Philippe.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Xenomai patch packaging concerns
  2006-02-23 15:21 ` Philippe Gerum
@ 2006-02-24 11:56   ` Romain Lenglet
       [not found]     ` <17407.3428.428108.146818@domain.hid>
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Lenglet @ 2006-02-24 11:56 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Hi Philippe,

I figured out where to link/copy every file. There was no need to 
modify any file in ksrc/...

Here is my patch. The new option to prepare-kernel.sh is:
--outpatch=<patchfiletocreate> <tempdir>

For instance you can run:

> mkdir /tmp/temptree
> ./scripts/prepare-kernel.sh 
--outpatch=/tmp/patch.diff /tmp/temptree

I tested that at least I get the same result as before without 
using the new option.
I have only tested with the Linux 2.6.15 source tree, not with 
Linux 2.4. But as you can see, my modifications are simple and 
conservative, so it should work.


Regards,

-- 
Romain LENGLET

[-- Attachment #2: diffgen_2006-02-24.patch --]
[-- Type: text/x-diff, Size: 11413 bytes --]

--- xenomai/ChangeLog	2006-02-24 20:39:57.302874592 +0900
+++ xenomai-new/ChangeLog	2006-02-24 20:43:46.811983904 +0900
@@ -1,3 +1,10 @@
+2006-02-24  Romain Lenglet <rlenglet@domain.hid>
+
+	* scripts/prepare-kernel.sh: Added option to generate a diff file
+	instead of actually modifying the Linux source tree. Cleanup to not
+	link / copy files for other architectures than the built architecture,
+	and to not link / copy some files twice.
+
 2006-02-22  Gilles Chanteperdrix  <gilles.chanteperdrix@xenomai.org>
 
 	* include/nucleus/timer.h: Use binary heaps for the aperiodic
--- xenomai/CREDITS	2006-02-22 10:28:53.229253976 +0900
+++ xenomai-new/CREDITS	2006-02-24 20:39:16.378096104 +0900
@@ -80,7 +80,7 @@
 
 N: Romain Lenglet
 E: <rlenglet@domain.hid>
-D: Man pages.
+D: Man pages, and patch generation script changes.
 
 N: Heikki Lindholm
 E: holindho@domain.hid
--- xenomai/scripts/prepare-kernel.sh	2006-02-24 19:48:17.038186464 +0900
+++ xenomai-new/scripts/prepare-kernel.sh	2006-02-24 20:38:32.647744128 +0900
@@ -1,37 +1,105 @@
 #! /bin/bash
 set -e
 
-do_links() {
-    ( if test -x $2; then
-      cd $2 &&
-      find . \( -name Makefile -o -name $config_file -o -name '*.[chS]' \) |
-      while read f; do
-        if test ! -e $1/$f; then rm -f $f; fi
-      done; else true; fi &&
-      cd $1 &&
-      find . \( -name Makefile -o -name $config_file -o -name '*.[chS]' \) |
-      while read f; do
-        f=`echo $f | cut -d/ -f2-`
-        d=`dirname $f`
-	mkdir -p $2/$d && ln -sf $1/$f $2/$f
-      done )
+patch_copytempfile() {
+    file="$1"
+    if ! test -f "$temp_tree/$file"; then
+        subdir=`dirname "$file"`
+        mkdir -p "$temp_tree/$subdir"
+        cp "$linux_tree/$file" "$temp_tree/$file"
+    fi
 }
 
-usage='usage: prepare-kernel --linux=<linux-tree> --adeos=<adeos-patch> [--arch=<arch>]'
+patch_append() {
+    file="$1"
+    if test "x$output_patch" = "x"; then
+        realfile="$linux_tree/$file"
+    else
+        patch_copytempfile "$file"
+        realfile="$temp_tree/$file"
+    fi
+    cat >> "$realfile"
+}
+
+patch_ed() {
+    file="$1"
+    if test "x$output_patch" = "x"; then
+        realfile="$linux_tree/$file"
+    else
+        patch_copytempfile "$file"
+        realfile="$temp_tree/$file"
+    fi
+    ed -s "$realfile" > /dev/null
+}
+
+patch_link() {
+    recursive="$1"              # "r" or "n"
+    link_makefiles="$2"         # "m" or "n"
+    target_dir="$3"
+    link_dir="$4"
+
+    (
+        recursive_opt=""
+        if test x$recursive != xr; then
+            recursive_opt="-maxdepth 1"
+        fi
+        link_makefiles_opt=""
+        if test x$link_makefiles = xm; then
+            link_makefiles_opt="-name Makefile -o"
+        fi
+
+        cd $xenomai_root/$target_dir &&
+        find . $recursive_opt \
+            \( $link_makefiles_opt -name $config_file -o -name '*.[chS]' \) |
+        while read f; do
+            f=`echo $f | cut -d/ -f2-`
+            d=`dirname $f`
+            if test "x$output_patch" = "x"; then
+                mkdir -p $linux_tree/$link_dir/$d && \
+                    rm -f $linux_tree/$link_dir/$f && \
+                    ln -sf $xenomai_root/$target_dir/$f $linux_tree/$link_dir/$f
+            else
+                mkdir -p $temp_tree/$link_dir/$d
+                cp $xenomai_root/$target_dir/$f $temp_tree/$link_dir/$f
+            fi
+        done
+    )
+
+}
+
+generate_patch() {
+    (
+    cd "$temp_tree"
+    find . -type f |
+    while read f; do
+        diff -Naurd "$linux_tree/$f" "$f" |
+        sed -e "s,^--- ${linux_tree}/\.\(/.*\)$,--- linux\1," \
+            -e "s,^+++ \.\(/.*\)$,+++ linux-patched\1,"
+    done
+    )
+}
+
+
+usage='usage: prepare-kernel --linux=<linux-tree> --adeos=<adeos-patch> [--arch=<arch>] [--outpatch=<file> <tempdir>]'
 me=`basename $0`
 
 while test $# -gt 0; do
     case "$1" in
     --linux=*)
-	linux_tree=`echo $1|sed -e 's,--linux=\\(.*\\)$,\\1,g'`;
+	linux_tree=`echo $1|sed -e 's,^--linux=\\(.*\\)$,\\1,g'`;
 	linux_tree=`eval "echo $linux_tree"`
 	;;
     --adeos=*)
-	adeos_patch=`echo $1|sed -e 's,--adeos=\\(.*\\)$,\\1,g'`;
+	adeos_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`;
 	adeos_patch=`eval "echo $adeos_patch"`
 	;;
     --arch=*)
-	linux_arch=`echo $1|sed -e 's,--arch=\\(.*\\)$,\\1,g'`;
+	linux_arch=`echo $1|sed -e 's,^--arch=\\(.*\\)$,\\1,g'`;
+	;;
+    --outpatch=*)
+	output_patch=`echo $1|sed -e 's,^--outpatch=\\(.*\\)$,\\1,g'`;
+	shift
+	temp_tree=`echo $1|sed -e 's,^--tempdir=\\(.*\\)$,\\1,g'`;
 	;;
     --verbose)
 	verbose=1
@@ -41,8 +109,8 @@
 	exit 0
 	;;
     *)
-	echo "$me: unknown flag: $1"
-	echo "$usage"
+	echo "$me: unknown flag: $1" >&2
+	echo "$usage" >&2
 	exit 1
 	;;
     esac
@@ -82,6 +150,22 @@
    exit 2
 fi
 
+# Create an empty output patch file, and initialize the temporary tree.
+if test "x$output_patch" != "x"; then
+
+    if test ! -d $temp_tree; then
+        echo "$me: $temp_tree (temporary tree) is not an existing directory"
+        exit 2
+    fi
+    temp_tree=`cd $temp_tree && pwd`
+
+    patchdir=`dirname $output_patch`
+    patchdir=`cd $patchdir && pwd`
+    output_patch=$patchdir/`basename $output_patch`
+    echo > "$output_patch"
+
+fi
+
 # Infer the default architecture if unspecified.
 
 if test x$linux_arch = x; then
@@ -159,13 +243,17 @@
 
 linux_version="$linux_VERSION.$linux_PATCHLEVEL.$linux_SUBLEVEL$linux_EXTRAVERSION"
 
+if test x$verbose = x1; then
 echo "Preparing kernel $linux_version in $linux_tree..."
+fi
 
 if test -r $linux_tree/include/linux/ipipe.h; then
+    if test x$verbose = x1; then
     echo "Adeos found - bypassing patch."
+    fi
 elif test -r $linux_tree/include/linux/adeos.h; then
-   echo "$me: Deprecated Adeos (oldgen) support found in $linux_tree;"
-   echo "Upgrade required to Adeos/I-pipe (newgen)."
+   echo "$me: Deprecated Adeos (oldgen) support found in $linux_tree;" >&2
+   echo "Upgrade required to Adeos/I-pipe (newgen)." >&2
    exit 2
 else
    if test x$adeos_patch = x; then
@@ -191,7 +279,7 @@
    curdir=$PWD
    cd $linux_tree && patch --dry-run -p1 -f < $adeos_patch || { 
         cd $curdir;
-        echo "$me: Unable to patch kernel $linux_version with `basename $adeos_patch`."
+        echo "$me: Unable to patch kernel $linux_version with `basename $adeos_patch`." >&2
         exit 2;
    }
    patch -p1 -f -s < $adeos_patch
@@ -201,9 +289,11 @@
 adeos_version=`grep '^#define.*IPIPE_ARCH_STRING.*"' $linux_tree/include/asm-$linux_arch/ipipe.h|sed -e 's,.*"\(.*\)"$,\1,'`
 
 if test \! x$adeos_version = x; then
+   if test x$verbose = x1; then
    echo "Adeos/$linux_arch $adeos_version installed."
+   fi
 else
-   echo "$me: $linux_tree has no Adeos support for $linux_arch"
+   echo "$me: $linux_tree has no Adeos support for $linux_arch" >&2
    exit 2
 fi
 
@@ -218,22 +308,23 @@
     config_file=Kconfig
 
     if ! grep -q XENOMAI $linux_tree/init/Kconfig; then
-	sed -e "s,@LINUX_ARCH@,$linux_arch,g" $xenomai_root/scripts/Kconfig.frag >> $linux_tree/init/Kconfig
+	sed -e "s,@LINUX_ARCH@,$linux_arch,g" $xenomai_root/scripts/Kconfig.frag |
+            patch_append init/Kconfig
     fi
 
     if ! grep -q CONFIG_XENOMAI $linux_tree/arch/$linux_arch/Makefile; then
 	p="drivers-\$(CONFIG_XENOMAI)		+= arch/$linux_arch/xenomai/"
-	( echo ; echo $p ) >> $linux_tree/arch/$linux_arch/Makefile
+	( echo ; echo $p ) | patch_append arch/$linux_arch/Makefile
     fi
 
     if ! grep -q CONFIG_XENOMAI $linux_tree/drivers/Makefile; then
 	p="obj-\$(CONFIG_XENOMAI)		+= xenomai/"
-	( echo ; echo $p ) >> $linux_tree/drivers/Makefile
+	( echo ; echo $p ) | patch_append drivers/Makefile
     fi
 
     if ! grep -q CONFIG_XENOMAI $linux_tree/kernel/Makefile; then
 	p="obj-\$(CONFIG_XENOMAI)		+= xenomai/"
-	( echo ; echo $p ) >> $linux_tree/kernel/Makefile
+	( echo ; echo $p ) | patch_append kernel/Makefile
     fi
     ;;
 
@@ -247,7 +338,7 @@
     config_file=Config.in
 
     if ! grep -q CONFIG_XENO $linux_tree/Makefile; then
-	ed -s $linux_tree/Makefile > /dev/null <<EOF
+	patch_ed Makefile <<EOF
 /DRIVERS := \$(DRIVERS-y)
 ^r $xenomai_root/scripts/Modules.frag
 
@@ -255,10 +346,10 @@
 wq
 EOF
     fi
-    for defconfig_file in .config $linux_tree/arch/$linux_arch/defconfig; do
-       if test -w $defconfig_file; then
-          if ! grep -q CONFIG_XENO $defconfig_file; then
-	      ed -s $defconfig_file > /dev/null <<EOF
+    for defconfig_file in .config arch/$linux_arch/defconfig; do
+       if test -w $linux_tree/$defconfig_file; then
+          if ! grep -q CONFIG_XENO $linux_tree/$defconfig_file; then
+	      patch_ed $defconfig_file <<EOF
 $
 r $xenomai_root/scripts/defconfig.frag
 .
@@ -268,7 +359,7 @@
        fi
     done
     if ! grep -q CONFIG_XENO $linux_tree/arch/$linux_arch/Makefile; then
-	ed -s $linux_tree/arch/$linux_arch/Makefile > /dev/null <<EOF
+	patch_ed arch/$linux_arch/Makefile <<EOF
 $
 a
 
@@ -281,7 +372,7 @@
 EOF
     fi
     if ! grep -q CONFIG_XENO $linux_tree/drivers/Makefile; then
-	ed -s $linux_tree/drivers/Makefile > /dev/null <<EOF
+	patch_ed drivers/Makefile <<EOF
 /include \$(TOPDIR)\/Rules.make
 i
 mod-subdirs := xenomai
@@ -292,7 +383,7 @@
 EOF
     fi
     if ! grep -q CONFIG_XENO $linux_tree/kernel/Makefile; then
-	ed -s $linux_tree/kernel/Makefile > /dev/null <<EOF
+	patch_ed kernel/Makefile <<EOF
 /include \$(TOPDIR)\/Rules.make
 i
 mod-subdirs := xenomai
@@ -304,7 +395,7 @@
 EOF
     fi
     if ! grep -iq xenomai $linux_tree/arch/$linux_arch/config.in; then
-	ed -s $linux_tree/arch/$linux_arch/config.in > /dev/null <<EOF
+	patch_ed arch/$linux_arch/config.in <<EOF
 $
 a
 
@@ -321,7 +412,7 @@
 
     *)
 
-    echo "$me: Unsupported kernel version $linux_VERSION.$linux_PATCHLEVEL.x"
+    echo "$me: Unsupported kernel version $linux_VERSION.$linux_PATCHLEVEL.x" >&2
     exit 2
     ;;
 
@@ -331,15 +422,34 @@
 # there, so that we don't pollute the Xenomai source tree with
 # compilation files.
 
-do_links $xenomai_root/ksrc/arch/$xenomai_arch $linux_tree/arch/$linux_arch/xenomai
-do_links $xenomai_root/ksrc $linux_tree/kernel/xenomai
-do_links $xenomai_root/ksrc/drivers $linux_tree/drivers/xenomai
-do_links $xenomai_root/include/asm-$xenomai_arch $linux_tree/include/asm-$linux_arch/xenomai
-do_links $xenomai_root/include/asm-generic $linux_tree/include/asm-generic/xenomai
-do_links $xenomai_root/include $linux_tree/include/xenomai
+patch_link r m ksrc/arch/$xenomai_arch arch/$linux_arch/xenomai
+patch_link n m ksrc/ kernel/xenomai
+patch_link n m ksrc/arch kernel/xenomai/arch
+patch_link r m ksrc/arch/generic kernel/xenomai/arch/generic
+patch_link r m ksrc/nucleus kernel/xenomai/nucleus
+patch_link r m ksrc/skins kernel/xenomai/skins
+patch_link r m ksrc/drivers drivers/xenomai
+patch_link r n include/asm-$xenomai_arch include/asm-$linux_arch/xenomai
+patch_link r n include/asm-generic include/asm-generic/xenomai
+patch_link n n include include/xenomai
+for d in include/* ; do
+    if test -d $d -a -z "`echo $d | grep '^include/asm-'`"; then
+        destdir=`echo $d | sed -e 's,^\(include\)\(/.*\)$,\1/xenomai\2,'`
+        patch_link r n $d $destdir
+    fi
+done
 
-echo 'Links installed.'
+if test "x$output_patch" != "x"; then
+    if test x$verbose = x1; then
+    echo 'Generating patch.'
+    fi
+    generate_patch > "$output_patch"
+fi
 
+if test x$verbose = x1; then
+echo 'Links installed.'
 echo 'Build system ready.'
+fi
 
 exit 0
+

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Xenomai patch packaging concerns
       [not found]     ` <17407.3428.428108.146818@domain.hid>
@ 2006-02-25  5:13       ` Romain Lenglet
  2006-02-27  9:10         ` Philippe Gerum
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Lenglet @ 2006-02-25  5:13 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

Gilles Chanteperdrix wrote:
> Romain Lenglet wrote:
>  > +        while read f; do
>  > +            f=`echo $f | cut -d/ -f2-`
>  > +            d=`dirname $f`
>  > +            if test "x$output_patch" = "x"; then
>  > +                mkdir -p $linux_tree/$link_dir/$d && \
>  > +                    rm -f $linux_tree/$link_dir/$f && \
>
> Could you remove this rm ? It causes Xenomai to be rebuilt
> everytime the prepare-kernel is run. And when using configure
> option --enable-linux-build, prepare-kernel is run for every
> build.

OK, here is a corrected patch.

-- 
Romain LENGLET

[-- Attachment #2: diffgen_2006-02-25.patch --]
[-- Type: text/x-diff, Size: 12112 bytes --]

--- xenomai/ChangeLog	2006-02-25 13:43:31.193371768 +0900
+++ xenomai-new2/ChangeLog	2006-02-25 14:08:09.657611040 +0900
@@ -1,3 +1,12 @@
+2006-02-25  Romain Lenglet <rlenglet@domain.hid>
+
+	* scripts/prepare-kernel.sh: Added option to generate a diff file
+	instead of actually modifying the Linux source tree. Cleanup to not
+	link / copy files for other architectures than the built architecture,
+	and to not link / copy some files twice. Links to Xenomai files in the
+	Linux tree are no more created by default if they already exists. Added
+	--forcelink option to force the creation of links.
+
 2006-02-24  Philippe Gerum  <rpm@xenomai.org>
 
 	* ksrc/nucleus/pod.c: Make sure that
--- xenomai/CREDITS	2006-02-22 10:28:53.229253976 +0900
+++ xenomai-new2/CREDITS	2006-02-25 13:34:54.115979480 +0900
@@ -80,7 +80,7 @@
 
 N: Romain Lenglet
 E: <rlenglet@domain.hid>
-D: Man pages.
+D: Man pages, and patch generation script changes.
 
 N: Heikki Lindholm
 E: holindho@domain.hid
--- xenomai/scripts/prepare-kernel.sh	2006-02-24 19:48:17.038186464 +0900
+++ xenomai-new2/scripts/prepare-kernel.sh	2006-02-25 14:07:30.838512440 +0900
@@ -1,38 +1,122 @@
 #! /bin/bash
 set -e
 
-do_links() {
-    ( if test -x $2; then
-      cd $2 &&
-      find . \( -name Makefile -o -name $config_file -o -name '*.[chS]' \) |
-      while read f; do
-        if test ! -e $1/$f; then rm -f $f; fi
-      done; else true; fi &&
-      cd $1 &&
-      find . \( -name Makefile -o -name $config_file -o -name '*.[chS]' \) |
-      while read f; do
-        f=`echo $f | cut -d/ -f2-`
-        d=`dirname $f`
-	mkdir -p $2/$d && ln -sf $1/$f $2/$f
-      done )
+patch_copytempfile() {
+    file="$1"
+    if ! test -f "$temp_tree/$file"; then
+        subdir=`dirname "$file"`
+        mkdir -p "$temp_tree/$subdir"
+        cp "$linux_tree/$file" "$temp_tree/$file"
+    fi
 }
 
-usage='usage: prepare-kernel --linux=<linux-tree> --adeos=<adeos-patch> [--arch=<arch>]'
+patch_append() {
+    file="$1"
+    if test "x$output_patch" = "x"; then
+        realfile="$linux_tree/$file"
+    else
+        patch_copytempfile "$file"
+        realfile="$temp_tree/$file"
+    fi
+    cat >> "$realfile"
+}
+
+patch_ed() {
+    file="$1"
+    if test "x$output_patch" = "x"; then
+        realfile="$linux_tree/$file"
+    else
+        patch_copytempfile "$file"
+        realfile="$temp_tree/$file"
+    fi
+    ed -s "$realfile" > /dev/null
+}
+
+patch_link() {
+    recursive="$1"              # "r" or "n"
+    link_makefiles="$2"         # "m" or "n"
+    target_dir="$3"
+    link_dir="$4"
+
+    (
+        recursive_opt=""
+        directorytype_opt=""
+        if test x$recursive = xr; then
+            directorytype_opt="\( -type d -mindepth 1 \) -o"
+        else
+            recursive_opt="-maxdepth 1"
+        fi
+        link_makefiles_opt=""
+        if test x$link_makefiles = xm; then
+            link_makefiles_opt="-name Makefile -o"
+        fi
+
+        if test "x$output_patch" = "x"; then
+            cd $linux_tree/$link_dir &&
+	    find . $recursive_opt \( $directorytype_opt \
+                $link_makefiles_opt -name $config_file -o -name '*.[chS]' \) |
+            while read f; do
+                if test ! -e $xenomai_root/$target_dir/$f; then rm -Rf $f; fi
+            done; else true; fi &&
+        fi
+
+        cd $xenomai_root/$target_dir &&
+        find . $recursive_opt \
+            \( $link_makefiles_opt -name $config_file -o -name '*.[chS]' \) |
+        while read f; do
+            f=`echo $f | cut -d/ -f2-`
+            d=`dirname $f`
+            if test "x$output_patch" = "x"; then
+                mkdir -p $linux_tree/$link_dir/$d
+                if test x$forcelink = x1 -o ! -h $linux_tree/$link_dir/$f; then
+                    ln -sf $xenomai_root/$target_dir/$f $linux_tree/$link_dir/$f
+                fi
+            else
+                mkdir -p $temp_tree/$link_dir/$d
+                cp $xenomai_root/$target_dir/$f $temp_tree/$link_dir/$f
+            fi
+        done
+    )
+
+}
+
+generate_patch() {
+    (
+    cd "$temp_tree"
+    find . -type f |
+    while read f; do
+        diff -Naurd "$linux_tree/$f" "$f" |
+        sed -e "s,^--- ${linux_tree}/\.\(/.*\)$,--- linux\1," \
+            -e "s,^+++ \.\(/.*\)$,+++ linux-patched\1,"
+    done
+    )
+}
+
+
+usage='usage: prepare-kernel --linux=<linux-tree> --adeos=<adeos-patch> [--arch=<arch>] [--outpatch=<file> <tempdir>] [--forcelink]'
 me=`basename $0`
 
 while test $# -gt 0; do
     case "$1" in
     --linux=*)
-	linux_tree=`echo $1|sed -e 's,--linux=\\(.*\\)$,\\1,g'`;
+	linux_tree=`echo $1|sed -e 's,^--linux=\\(.*\\)$,\\1,g'`
 	linux_tree=`eval "echo $linux_tree"`
 	;;
     --adeos=*)
-	adeos_patch=`echo $1|sed -e 's,--adeos=\\(.*\\)$,\\1,g'`;
+	adeos_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
 	adeos_patch=`eval "echo $adeos_patch"`
 	;;
     --arch=*)
-	linux_arch=`echo $1|sed -e 's,--arch=\\(.*\\)$,\\1,g'`;
+	linux_arch=`echo $1|sed -e 's,^--arch=\\(.*\\)$,\\1,g'`
+	;;
+    --outpatch=*)
+	output_patch=`echo $1|sed -e 's,^--outpatch=\\(.*\\)$,\\1,g'`
+	shift
+	temp_tree=`echo $1|sed -e 's,^--tempdir=\\(.*\\)$,\\1,g'`
 	;;
+    --forcelink)
+        forcelink=1
+        ;;
     --verbose)
 	verbose=1
 	;;
@@ -41,8 +125,8 @@
 	exit 0
 	;;
     *)
-	echo "$me: unknown flag: $1"
-	echo "$usage"
+	echo "$me: unknown flag: $1" >&2
+	echo "$usage" >&2
 	exit 1
 	;;
     esac
@@ -82,6 +166,22 @@
    exit 2
 fi
 
+# Create an empty output patch file, and initialize the temporary tree.
+if test "x$output_patch" != "x"; then
+
+    if test ! -d $temp_tree; then
+        echo "$me: $temp_tree (temporary tree) is not an existing directory"
+        exit 2
+    fi
+    temp_tree=`cd $temp_tree && pwd`
+
+    patchdir=`dirname $output_patch`
+    patchdir=`cd $patchdir && pwd`
+    output_patch=$patchdir/`basename $output_patch`
+    echo > "$output_patch"
+
+fi
+
 # Infer the default architecture if unspecified.
 
 if test x$linux_arch = x; then
@@ -159,13 +259,17 @@
 
 linux_version="$linux_VERSION.$linux_PATCHLEVEL.$linux_SUBLEVEL$linux_EXTRAVERSION"
 
+if test x$verbose = x1; then
 echo "Preparing kernel $linux_version in $linux_tree..."
+fi
 
 if test -r $linux_tree/include/linux/ipipe.h; then
+    if test x$verbose = x1; then
     echo "Adeos found - bypassing patch."
+    fi
 elif test -r $linux_tree/include/linux/adeos.h; then
-   echo "$me: Deprecated Adeos (oldgen) support found in $linux_tree;"
-   echo "Upgrade required to Adeos/I-pipe (newgen)."
+   echo "$me: Deprecated Adeos (oldgen) support found in $linux_tree;" >&2
+   echo "Upgrade required to Adeos/I-pipe (newgen)." >&2
    exit 2
 else
    if test x$adeos_patch = x; then
@@ -191,7 +295,7 @@
    curdir=$PWD
    cd $linux_tree && patch --dry-run -p1 -f < $adeos_patch || { 
         cd $curdir;
-        echo "$me: Unable to patch kernel $linux_version with `basename $adeos_patch`."
+        echo "$me: Unable to patch kernel $linux_version with `basename $adeos_patch`." >&2
         exit 2;
    }
    patch -p1 -f -s < $adeos_patch
@@ -201,9 +305,11 @@
 adeos_version=`grep '^#define.*IPIPE_ARCH_STRING.*"' $linux_tree/include/asm-$linux_arch/ipipe.h|sed -e 's,.*"\(.*\)"$,\1,'`
 
 if test \! x$adeos_version = x; then
+   if test x$verbose = x1; then
    echo "Adeos/$linux_arch $adeos_version installed."
+   fi
 else
-   echo "$me: $linux_tree has no Adeos support for $linux_arch"
+   echo "$me: $linux_tree has no Adeos support for $linux_arch" >&2
    exit 2
 fi
 
@@ -218,22 +324,23 @@
     config_file=Kconfig
 
     if ! grep -q XENOMAI $linux_tree/init/Kconfig; then
-	sed -e "s,@LINUX_ARCH@,$linux_arch,g" $xenomai_root/scripts/Kconfig.frag >> $linux_tree/init/Kconfig
+	sed -e "s,@LINUX_ARCH@,$linux_arch,g" $xenomai_root/scripts/Kconfig.frag |
+            patch_append init/Kconfig
     fi
 
     if ! grep -q CONFIG_XENOMAI $linux_tree/arch/$linux_arch/Makefile; then
 	p="drivers-\$(CONFIG_XENOMAI)		+= arch/$linux_arch/xenomai/"
-	( echo ; echo $p ) >> $linux_tree/arch/$linux_arch/Makefile
+	( echo ; echo $p ) | patch_append arch/$linux_arch/Makefile
     fi
 
     if ! grep -q CONFIG_XENOMAI $linux_tree/drivers/Makefile; then
 	p="obj-\$(CONFIG_XENOMAI)		+= xenomai/"
-	( echo ; echo $p ) >> $linux_tree/drivers/Makefile
+	( echo ; echo $p ) | patch_append drivers/Makefile
     fi
 
     if ! grep -q CONFIG_XENOMAI $linux_tree/kernel/Makefile; then
 	p="obj-\$(CONFIG_XENOMAI)		+= xenomai/"
-	( echo ; echo $p ) >> $linux_tree/kernel/Makefile
+	( echo ; echo $p ) | patch_append kernel/Makefile
     fi
     ;;
 
@@ -247,7 +354,7 @@
     config_file=Config.in
 
     if ! grep -q CONFIG_XENO $linux_tree/Makefile; then
-	ed -s $linux_tree/Makefile > /dev/null <<EOF
+	patch_ed Makefile <<EOF
 /DRIVERS := \$(DRIVERS-y)
 ^r $xenomai_root/scripts/Modules.frag
 
@@ -255,10 +362,10 @@
 wq
 EOF
     fi
-    for defconfig_file in .config $linux_tree/arch/$linux_arch/defconfig; do
-       if test -w $defconfig_file; then
-          if ! grep -q CONFIG_XENO $defconfig_file; then
-	      ed -s $defconfig_file > /dev/null <<EOF
+    for defconfig_file in .config arch/$linux_arch/defconfig; do
+       if test -w $linux_tree/$defconfig_file; then
+          if ! grep -q CONFIG_XENO $linux_tree/$defconfig_file; then
+	      patch_ed $defconfig_file <<EOF
 $
 r $xenomai_root/scripts/defconfig.frag
 .
@@ -268,7 +375,7 @@
        fi
     done
     if ! grep -q CONFIG_XENO $linux_tree/arch/$linux_arch/Makefile; then
-	ed -s $linux_tree/arch/$linux_arch/Makefile > /dev/null <<EOF
+	patch_ed arch/$linux_arch/Makefile <<EOF
 $
 a
 
@@ -281,7 +388,7 @@
 EOF
     fi
     if ! grep -q CONFIG_XENO $linux_tree/drivers/Makefile; then
-	ed -s $linux_tree/drivers/Makefile > /dev/null <<EOF
+	patch_ed drivers/Makefile <<EOF
 /include \$(TOPDIR)\/Rules.make
 i
 mod-subdirs := xenomai
@@ -292,7 +399,7 @@
 EOF
     fi
     if ! grep -q CONFIG_XENO $linux_tree/kernel/Makefile; then
-	ed -s $linux_tree/kernel/Makefile > /dev/null <<EOF
+	patch_ed kernel/Makefile <<EOF
 /include \$(TOPDIR)\/Rules.make
 i
 mod-subdirs := xenomai
@@ -304,7 +411,7 @@
 EOF
     fi
     if ! grep -iq xenomai $linux_tree/arch/$linux_arch/config.in; then
-	ed -s $linux_tree/arch/$linux_arch/config.in > /dev/null <<EOF
+	patch_ed arch/$linux_arch/config.in <<EOF
 $
 a
 
@@ -321,7 +428,7 @@
 
     *)
 
-    echo "$me: Unsupported kernel version $linux_VERSION.$linux_PATCHLEVEL.x"
+    echo "$me: Unsupported kernel version $linux_VERSION.$linux_PATCHLEVEL.x" >&2
     exit 2
     ;;
 
@@ -331,15 +438,34 @@
 # there, so that we don't pollute the Xenomai source tree with
 # compilation files.
 
-do_links $xenomai_root/ksrc/arch/$xenomai_arch $linux_tree/arch/$linux_arch/xenomai
-do_links $xenomai_root/ksrc $linux_tree/kernel/xenomai
-do_links $xenomai_root/ksrc/drivers $linux_tree/drivers/xenomai
-do_links $xenomai_root/include/asm-$xenomai_arch $linux_tree/include/asm-$linux_arch/xenomai
-do_links $xenomai_root/include/asm-generic $linux_tree/include/asm-generic/xenomai
-do_links $xenomai_root/include $linux_tree/include/xenomai
+patch_link r m ksrc/arch/$xenomai_arch arch/$linux_arch/xenomai
+patch_link n m ksrc/ kernel/xenomai
+patch_link n m ksrc/arch kernel/xenomai/arch
+patch_link r m ksrc/arch/generic kernel/xenomai/arch/generic
+patch_link r m ksrc/nucleus kernel/xenomai/nucleus
+patch_link r m ksrc/skins kernel/xenomai/skins
+patch_link r m ksrc/drivers drivers/xenomai
+patch_link r n include/asm-$xenomai_arch include/asm-$linux_arch/xenomai
+patch_link r n include/asm-generic include/asm-generic/xenomai
+patch_link n n include include/xenomai
+for d in include/* ; do
+    if test -d $d -a -z "`echo $d | grep '^include/asm-'`"; then
+        destdir=`echo $d | sed -e 's,^\(include\)\(/.*\)$,\1/xenomai\2,'`
+        patch_link r n $d $destdir
+    fi
+done
 
-echo 'Links installed.'
+if test "x$output_patch" != "x"; then
+    if test x$verbose = x1; then
+    echo 'Generating patch.'
+    fi
+    generate_patch > "$output_patch"
+fi
 
+if test x$verbose = x1; then
+echo 'Links installed.'
 echo 'Build system ready.'
+fi
 
 exit 0
+

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Xenomai patch packaging concerns
  2006-02-25  5:13       ` Romain Lenglet
@ 2006-02-27  9:10         ` Philippe Gerum
  2006-02-27 13:55           ` Philippe Gerum
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Gerum @ 2006-02-27  9:10 UTC (permalink / raw)
  To: Romain Lenglet; +Cc: xenomai

Romain Lenglet wrote:
> Gilles Chanteperdrix wrote:
> 
>>Romain Lenglet wrote:
>> > +        while read f; do
>> > +            f=`echo $f | cut -d/ -f2-`
>> > +            d=`dirname $f`
>> > +            if test "x$output_patch" = "x"; then
>> > +                mkdir -p $linux_tree/$link_dir/$d && \
>> > +                    rm -f $linux_tree/$link_dir/$f && \
>>
>>Could you remove this rm ? It causes Xenomai to be rebuilt
>>everytime the prepare-kernel is run. And when using configure
>>option --enable-linux-build, prepare-kernel is run for every
>>build.
> 
> 
> OK, here is a corrected patch.
> 

Applied, thanks.

> 
> 
> ------------------------------------------------------------------------
> 
> --- xenomai/ChangeLog	2006-02-25 13:43:31.193371768 +0900
> +++ xenomai-new2/ChangeLog	2006-02-25 14:08:09.657611040 +0900
> @@ -1,3 +1,12 @@
> +2006-02-25  Romain Lenglet <rlenglet@domain.hid>
> +
> +	* scripts/prepare-kernel.sh: Added option to generate a diff file
> +	instead of actually modifying the Linux source tree. Cleanup to not
> +	link / copy files for other architectures than the built architecture,
> +	and to not link / copy some files twice. Links to Xenomai files in the
> +	Linux tree are no more created by default if they already exists. Added
> +	--forcelink option to force the creation of links.
> +
>  2006-02-24  Philippe Gerum  <rpm@xenomai.org>
>  
>  	* ksrc/nucleus/pod.c: Make sure that
> --- xenomai/CREDITS	2006-02-22 10:28:53.229253976 +0900
> +++ xenomai-new2/CREDITS	2006-02-25 13:34:54.115979480 +0900
> @@ -80,7 +80,7 @@
>  
>  N: Romain Lenglet
>  E: <rlenglet@domain.hid>
> -D: Man pages.
> +D: Man pages, and patch generation script changes.
>  
>  N: Heikki Lindholm
>  E: holindho@domain.hid
> --- xenomai/scripts/prepare-kernel.sh	2006-02-24 19:48:17.038186464 +0900
> +++ xenomai-new2/scripts/prepare-kernel.sh	2006-02-25 14:07:30.838512440 +0900
> @@ -1,38 +1,122 @@
>  #! /bin/bash
>  set -e
>  
> -do_links() {
> -    ( if test -x $2; then
> -      cd $2 &&
> -      find . \( -name Makefile -o -name $config_file -o -name '*.[chS]' \) |
> -      while read f; do
> -        if test ! -e $1/$f; then rm -f $f; fi
> -      done; else true; fi &&
> -      cd $1 &&
> -      find . \( -name Makefile -o -name $config_file -o -name '*.[chS]' \) |
> -      while read f; do
> -        f=`echo $f | cut -d/ -f2-`
> -        d=`dirname $f`
> -	mkdir -p $2/$d && ln -sf $1/$f $2/$f
> -      done )
> +patch_copytempfile() {
> +    file="$1"
> +    if ! test -f "$temp_tree/$file"; then
> +        subdir=`dirname "$file"`
> +        mkdir -p "$temp_tree/$subdir"
> +        cp "$linux_tree/$file" "$temp_tree/$file"
> +    fi
>  }
>  
> -usage='usage: prepare-kernel --linux=<linux-tree> --adeos=<adeos-patch> [--arch=<arch>]'
> +patch_append() {
> +    file="$1"
> +    if test "x$output_patch" = "x"; then
> +        realfile="$linux_tree/$file"
> +    else
> +        patch_copytempfile "$file"
> +        realfile="$temp_tree/$file"
> +    fi
> +    cat >> "$realfile"
> +}
> +
> +patch_ed() {
> +    file="$1"
> +    if test "x$output_patch" = "x"; then
> +        realfile="$linux_tree/$file"
> +    else
> +        patch_copytempfile "$file"
> +        realfile="$temp_tree/$file"
> +    fi
> +    ed -s "$realfile" > /dev/null
> +}
> +
> +patch_link() {
> +    recursive="$1"              # "r" or "n"
> +    link_makefiles="$2"         # "m" or "n"
> +    target_dir="$3"
> +    link_dir="$4"
> +
> +    (
> +        recursive_opt=""
> +        directorytype_opt=""
> +        if test x$recursive = xr; then
> +            directorytype_opt="\( -type d -mindepth 1 \) -o"
> +        else
> +            recursive_opt="-maxdepth 1"
> +        fi
> +        link_makefiles_opt=""
> +        if test x$link_makefiles = xm; then
> +            link_makefiles_opt="-name Makefile -o"
> +        fi
> +
> +        if test "x$output_patch" = "x"; then
> +            cd $linux_tree/$link_dir &&
> +	    find . $recursive_opt \( $directorytype_opt \
> +                $link_makefiles_opt -name $config_file -o -name '*.[chS]' \) |
> +            while read f; do
> +                if test ! -e $xenomai_root/$target_dir/$f; then rm -Rf $f; fi
> +            done; else true; fi &&
> +        fi
> +
> +        cd $xenomai_root/$target_dir &&
> +        find . $recursive_opt \
> +            \( $link_makefiles_opt -name $config_file -o -name '*.[chS]' \) |
> +        while read f; do
> +            f=`echo $f | cut -d/ -f2-`
> +            d=`dirname $f`
> +            if test "x$output_patch" = "x"; then
> +                mkdir -p $linux_tree/$link_dir/$d
> +                if test x$forcelink = x1 -o ! -h $linux_tree/$link_dir/$f; then
> +                    ln -sf $xenomai_root/$target_dir/$f $linux_tree/$link_dir/$f
> +                fi
> +            else
> +                mkdir -p $temp_tree/$link_dir/$d
> +                cp $xenomai_root/$target_dir/$f $temp_tree/$link_dir/$f
> +            fi
> +        done
> +    )
> +
> +}
> +
> +generate_patch() {
> +    (
> +    cd "$temp_tree"
> +    find . -type f |
> +    while read f; do
> +        diff -Naurd "$linux_tree/$f" "$f" |
> +        sed -e "s,^--- ${linux_tree}/\.\(/.*\)$,--- linux\1," \
> +            -e "s,^+++ \.\(/.*\)$,+++ linux-patched\1,"
> +    done
> +    )
> +}
> +
> +
> +usage='usage: prepare-kernel --linux=<linux-tree> --adeos=<adeos-patch> [--arch=<arch>] [--outpatch=<file> <tempdir>] [--forcelink]'
>  me=`basename $0`
>  
>  while test $# -gt 0; do
>      case "$1" in
>      --linux=*)
> -	linux_tree=`echo $1|sed -e 's,--linux=\\(.*\\)$,\\1,g'`;
> +	linux_tree=`echo $1|sed -e 's,^--linux=\\(.*\\)$,\\1,g'`
>  	linux_tree=`eval "echo $linux_tree"`
>  	;;
>      --adeos=*)
> -	adeos_patch=`echo $1|sed -e 's,--adeos=\\(.*\\)$,\\1,g'`;
> +	adeos_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
>  	adeos_patch=`eval "echo $adeos_patch"`
>  	;;
>      --arch=*)
> -	linux_arch=`echo $1|sed -e 's,--arch=\\(.*\\)$,\\1,g'`;
> +	linux_arch=`echo $1|sed -e 's,^--arch=\\(.*\\)$,\\1,g'`
> +	;;
> +    --outpatch=*)
> +	output_patch=`echo $1|sed -e 's,^--outpatch=\\(.*\\)$,\\1,g'`
> +	shift
> +	temp_tree=`echo $1|sed -e 's,^--tempdir=\\(.*\\)$,\\1,g'`
>  	;;
> +    --forcelink)
> +        forcelink=1
> +        ;;
>      --verbose)
>  	verbose=1
>  	;;
> @@ -41,8 +125,8 @@
>  	exit 0
>  	;;
>      *)
> -	echo "$me: unknown flag: $1"
> -	echo "$usage"
> +	echo "$me: unknown flag: $1" >&2
> +	echo "$usage" >&2
>  	exit 1
>  	;;
>      esac
> @@ -82,6 +166,22 @@
>     exit 2
>  fi
>  
> +# Create an empty output patch file, and initialize the temporary tree.
> +if test "x$output_patch" != "x"; then
> +
> +    if test ! -d $temp_tree; then
> +        echo "$me: $temp_tree (temporary tree) is not an existing directory"
> +        exit 2
> +    fi
> +    temp_tree=`cd $temp_tree && pwd`
> +
> +    patchdir=`dirname $output_patch`
> +    patchdir=`cd $patchdir && pwd`
> +    output_patch=$patchdir/`basename $output_patch`
> +    echo > "$output_patch"
> +
> +fi
> +
>  # Infer the default architecture if unspecified.
>  
>  if test x$linux_arch = x; then
> @@ -159,13 +259,17 @@
>  
>  linux_version="$linux_VERSION.$linux_PATCHLEVEL.$linux_SUBLEVEL$linux_EXTRAVERSION"
>  
> +if test x$verbose = x1; then
>  echo "Preparing kernel $linux_version in $linux_tree..."
> +fi
>  
>  if test -r $linux_tree/include/linux/ipipe.h; then
> +    if test x$verbose = x1; then
>      echo "Adeos found - bypassing patch."
> +    fi
>  elif test -r $linux_tree/include/linux/adeos.h; then
> -   echo "$me: Deprecated Adeos (oldgen) support found in $linux_tree;"
> -   echo "Upgrade required to Adeos/I-pipe (newgen)."
> +   echo "$me: Deprecated Adeos (oldgen) support found in $linux_tree;" >&2
> +   echo "Upgrade required to Adeos/I-pipe (newgen)." >&2
>     exit 2
>  else
>     if test x$adeos_patch = x; then
> @@ -191,7 +295,7 @@
>     curdir=$PWD
>     cd $linux_tree && patch --dry-run -p1 -f < $adeos_patch || { 
>          cd $curdir;
> -        echo "$me: Unable to patch kernel $linux_version with `basename $adeos_patch`."
> +        echo "$me: Unable to patch kernel $linux_version with `basename $adeos_patch`." >&2
>          exit 2;
>     }
>     patch -p1 -f -s < $adeos_patch
> @@ -201,9 +305,11 @@
>  adeos_version=`grep '^#define.*IPIPE_ARCH_STRING.*"' $linux_tree/include/asm-$linux_arch/ipipe.h|sed -e 's,.*"\(.*\)"$,\1,'`
>  
>  if test \! x$adeos_version = x; then
> +   if test x$verbose = x1; then
>     echo "Adeos/$linux_arch $adeos_version installed."
> +   fi
>  else
> -   echo "$me: $linux_tree has no Adeos support for $linux_arch"
> +   echo "$me: $linux_tree has no Adeos support for $linux_arch" >&2
>     exit 2
>  fi
>  
> @@ -218,22 +324,23 @@
>      config_file=Kconfig
>  
>      if ! grep -q XENOMAI $linux_tree/init/Kconfig; then
> -	sed -e "s,@LINUX_ARCH@,$linux_arch,g" $xenomai_root/scripts/Kconfig.frag >> $linux_tree/init/Kconfig
> +	sed -e "s,@LINUX_ARCH@,$linux_arch,g" $xenomai_root/scripts/Kconfig.frag |
> +            patch_append init/Kconfig
>      fi
>  
>      if ! grep -q CONFIG_XENOMAI $linux_tree/arch/$linux_arch/Makefile; then
>  	p="drivers-\$(CONFIG_XENOMAI)		+= arch/$linux_arch/xenomai/"
> -	( echo ; echo $p ) >> $linux_tree/arch/$linux_arch/Makefile
> +	( echo ; echo $p ) | patch_append arch/$linux_arch/Makefile
>      fi
>  
>      if ! grep -q CONFIG_XENOMAI $linux_tree/drivers/Makefile; then
>  	p="obj-\$(CONFIG_XENOMAI)		+= xenomai/"
> -	( echo ; echo $p ) >> $linux_tree/drivers/Makefile
> +	( echo ; echo $p ) | patch_append drivers/Makefile
>      fi
>  
>      if ! grep -q CONFIG_XENOMAI $linux_tree/kernel/Makefile; then
>  	p="obj-\$(CONFIG_XENOMAI)		+= xenomai/"
> -	( echo ; echo $p ) >> $linux_tree/kernel/Makefile
> +	( echo ; echo $p ) | patch_append kernel/Makefile
>      fi
>      ;;
>  
> @@ -247,7 +354,7 @@
>      config_file=Config.in
>  
>      if ! grep -q CONFIG_XENO $linux_tree/Makefile; then
> -	ed -s $linux_tree/Makefile > /dev/null <<EOF
> +	patch_ed Makefile <<EOF
>  /DRIVERS := \$(DRIVERS-y)
>  ^r $xenomai_root/scripts/Modules.frag
>  
> @@ -255,10 +362,10 @@
>  wq
>  EOF
>      fi
> -    for defconfig_file in .config $linux_tree/arch/$linux_arch/defconfig; do
> -       if test -w $defconfig_file; then
> -          if ! grep -q CONFIG_XENO $defconfig_file; then
> -	      ed -s $defconfig_file > /dev/null <<EOF
> +    for defconfig_file in .config arch/$linux_arch/defconfig; do
> +       if test -w $linux_tree/$defconfig_file; then
> +          if ! grep -q CONFIG_XENO $linux_tree/$defconfig_file; then
> +	      patch_ed $defconfig_file <<EOF
>  $
>  r $xenomai_root/scripts/defconfig.frag
>  .
> @@ -268,7 +375,7 @@
>         fi
>      done
>      if ! grep -q CONFIG_XENO $linux_tree/arch/$linux_arch/Makefile; then
> -	ed -s $linux_tree/arch/$linux_arch/Makefile > /dev/null <<EOF
> +	patch_ed arch/$linux_arch/Makefile <<EOF
>  $
>  a
>  
> @@ -281,7 +388,7 @@
>  EOF
>      fi
>      if ! grep -q CONFIG_XENO $linux_tree/drivers/Makefile; then
> -	ed -s $linux_tree/drivers/Makefile > /dev/null <<EOF
> +	patch_ed drivers/Makefile <<EOF
>  /include \$(TOPDIR)\/Rules.make
>  i
>  mod-subdirs := xenomai
> @@ -292,7 +399,7 @@
>  EOF
>      fi
>      if ! grep -q CONFIG_XENO $linux_tree/kernel/Makefile; then
> -	ed -s $linux_tree/kernel/Makefile > /dev/null <<EOF
> +	patch_ed kernel/Makefile <<EOF
>  /include \$(TOPDIR)\/Rules.make
>  i
>  mod-subdirs := xenomai
> @@ -304,7 +411,7 @@
>  EOF
>      fi
>      if ! grep -iq xenomai $linux_tree/arch/$linux_arch/config.in; then
> -	ed -s $linux_tree/arch/$linux_arch/config.in > /dev/null <<EOF
> +	patch_ed arch/$linux_arch/config.in <<EOF
>  $
>  a
>  
> @@ -321,7 +428,7 @@
>  
>      *)
>  
> -    echo "$me: Unsupported kernel version $linux_VERSION.$linux_PATCHLEVEL.x"
> +    echo "$me: Unsupported kernel version $linux_VERSION.$linux_PATCHLEVEL.x" >&2
>      exit 2
>      ;;
>  
> @@ -331,15 +438,34 @@
>  # there, so that we don't pollute the Xenomai source tree with
>  # compilation files.
>  
> -do_links $xenomai_root/ksrc/arch/$xenomai_arch $linux_tree/arch/$linux_arch/xenomai
> -do_links $xenomai_root/ksrc $linux_tree/kernel/xenomai
> -do_links $xenomai_root/ksrc/drivers $linux_tree/drivers/xenomai
> -do_links $xenomai_root/include/asm-$xenomai_arch $linux_tree/include/asm-$linux_arch/xenomai
> -do_links $xenomai_root/include/asm-generic $linux_tree/include/asm-generic/xenomai
> -do_links $xenomai_root/include $linux_tree/include/xenomai
> +patch_link r m ksrc/arch/$xenomai_arch arch/$linux_arch/xenomai
> +patch_link n m ksrc/ kernel/xenomai
> +patch_link n m ksrc/arch kernel/xenomai/arch
> +patch_link r m ksrc/arch/generic kernel/xenomai/arch/generic
> +patch_link r m ksrc/nucleus kernel/xenomai/nucleus
> +patch_link r m ksrc/skins kernel/xenomai/skins
> +patch_link r m ksrc/drivers drivers/xenomai
> +patch_link r n include/asm-$xenomai_arch include/asm-$linux_arch/xenomai
> +patch_link r n include/asm-generic include/asm-generic/xenomai
> +patch_link n n include include/xenomai
> +for d in include/* ; do
> +    if test -d $d -a -z "`echo $d | grep '^include/asm-'`"; then
> +        destdir=`echo $d | sed -e 's,^\(include\)\(/.*\)$,\1/xenomai\2,'`
> +        patch_link r n $d $destdir
> +    fi
> +done
>  
> -echo 'Links installed.'
> +if test "x$output_patch" != "x"; then
> +    if test x$verbose = x1; then
> +    echo 'Generating patch.'
> +    fi
> +    generate_patch > "$output_patch"
> +fi
>  
> +if test x$verbose = x1; then
> +echo 'Links installed.'
>  echo 'Build system ready.'
> +fi
>  
>  exit 0
> +
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core


-- 

Philippe.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Xenomai-core] Xenomai patch packaging concerns
  2006-02-27  9:10         ` Philippe Gerum
@ 2006-02-27 13:55           ` Philippe Gerum
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Gerum @ 2006-02-27 13:55 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

Philippe Gerum wrote:
> Romain Lenglet wrote:
> 
>> Gilles Chanteperdrix wrote:
>>
>>> Romain Lenglet wrote:
>>> > +        while read f; do
>>> > +            f=`echo $f | cut -d/ -f2-`
>>> > +            d=`dirname $f`
>>> > +            if test "x$output_patch" = "x"; then
>>> > +                mkdir -p $linux_tree/$link_dir/$d && \
>>> > +                    rm -f $linux_tree/$link_dir/$f && \
>>>
>>> Could you remove this rm ? It causes Xenomai to be rebuilt
>>> everytime the prepare-kernel is run. And when using configure
>>> option --enable-linux-build, prepare-kernel is run for every
>>> build.
>>
>>
>>
>> OK, here is a corrected patch.
>>
> 
> Applied, thanks.
>

This patch temporarily reverted; it currently breaks.

>>
>>
>> ------------------------------------------------------------------------
>>
>> --- xenomai/ChangeLog    2006-02-25 13:43:31.193371768 +0900
>> +++ xenomai-new2/ChangeLog    2006-02-25 14:08:09.657611040 +0900
>> @@ -1,3 +1,12 @@
>> +2006-02-25  Romain Lenglet <rlenglet@domain.hid>
>> +
>> +    * scripts/prepare-kernel.sh: Added option to generate a diff file
>> +    instead of actually modifying the Linux source tree. Cleanup to not
>> +    link / copy files for other architectures than the built 
>> architecture,
>> +    and to not link / copy some files twice. Links to Xenomai files 
>> in the
>> +    Linux tree are no more created by default if they already exists. 
>> Added
>> +    --forcelink option to force the creation of links.
>> +
>>  2006-02-24  Philippe Gerum  <rpm@xenomai.org>
>>  
>>      * ksrc/nucleus/pod.c: Make sure that
>> --- xenomai/CREDITS    2006-02-22 10:28:53.229253976 +0900
>> +++ xenomai-new2/CREDITS    2006-02-25 13:34:54.115979480 +0900
>> @@ -80,7 +80,7 @@
>>  
>>  N: Romain Lenglet
>>  E: <rlenglet@domain.hid>
>> -D: Man pages.
>> +D: Man pages, and patch generation script changes.
>>  
>>  N: Heikki Lindholm
>>  E: holindho@domain.hid
>> --- xenomai/scripts/prepare-kernel.sh    2006-02-24 19:48:17.038186464 
>> +0900
>> +++ xenomai-new2/scripts/prepare-kernel.sh    2006-02-25 
>> 14:07:30.838512440 +0900
>> @@ -1,38 +1,122 @@
>>  #! /bin/bash
>>  set -e
>>  
>> -do_links() {
>> -    ( if test -x $2; then
>> -      cd $2 &&
>> -      find . \( -name Makefile -o -name $config_file -o -name 
>> '*.[chS]' \) |
>> -      while read f; do
>> -        if test ! -e $1/$f; then rm -f $f; fi
>> -      done; else true; fi &&
>> -      cd $1 &&
>> -      find . \( -name Makefile -o -name $config_file -o -name 
>> '*.[chS]' \) |
>> -      while read f; do
>> -        f=`echo $f | cut -d/ -f2-`
>> -        d=`dirname $f`
>> -    mkdir -p $2/$d && ln -sf $1/$f $2/$f
>> -      done )
>> +patch_copytempfile() {
>> +    file="$1"
>> +    if ! test -f "$temp_tree/$file"; then
>> +        subdir=`dirname "$file"`
>> +        mkdir -p "$temp_tree/$subdir"
>> +        cp "$linux_tree/$file" "$temp_tree/$file"
>> +    fi
>>  }
>>  
>> -usage='usage: prepare-kernel --linux=<linux-tree> 
>> --adeos=<adeos-patch> [--arch=<arch>]'
>> +patch_append() {
>> +    file="$1"
>> +    if test "x$output_patch" = "x"; then
>> +        realfile="$linux_tree/$file"
>> +    else
>> +        patch_copytempfile "$file"
>> +        realfile="$temp_tree/$file"
>> +    fi
>> +    cat >> "$realfile"
>> +}
>> +
>> +patch_ed() {
>> +    file="$1"
>> +    if test "x$output_patch" = "x"; then
>> +        realfile="$linux_tree/$file"
>> +    else
>> +        patch_copytempfile "$file"
>> +        realfile="$temp_tree/$file"
>> +    fi
>> +    ed -s "$realfile" > /dev/null
>> +}
>> +
>> +patch_link() {
>> +    recursive="$1"              # "r" or "n"
>> +    link_makefiles="$2"         # "m" or "n"
>> +    target_dir="$3"
>> +    link_dir="$4"
>> +
>> +    (
>> +        recursive_opt=""
>> +        directorytype_opt=""
>> +        if test x$recursive = xr; then
>> +            directorytype_opt="\( -type d -mindepth 1 \) -o"
>> +        else
>> +            recursive_opt="-maxdepth 1"
>> +        fi
>> +        link_makefiles_opt=""
>> +        if test x$link_makefiles = xm; then
>> +            link_makefiles_opt="-name Makefile -o"
>> +        fi
>> +
>> +        if test "x$output_patch" = "x"; then
>> +            cd $linux_tree/$link_dir &&
>> +        find . $recursive_opt \( $directorytype_opt \
>> +                $link_makefiles_opt -name $config_file -o -name 
>> '*.[chS]' \) |
>> +            while read f; do
>> +                if test ! -e $xenomai_root/$target_dir/$f; then rm 
>> -Rf $f; fi
>> +            done; else true; fi &&
>> +        fi
>> +
>> +        cd $xenomai_root/$target_dir &&
>> +        find . $recursive_opt \
>> +            \( $link_makefiles_opt -name $config_file -o -name 
>> '*.[chS]' \) |
>> +        while read f; do
>> +            f=`echo $f | cut -d/ -f2-`
>> +            d=`dirname $f`
>> +            if test "x$output_patch" = "x"; then
>> +                mkdir -p $linux_tree/$link_dir/$d
>> +                if test x$forcelink = x1 -o ! -h 
>> $linux_tree/$link_dir/$f; then
>> +                    ln -sf $xenomai_root/$target_dir/$f 
>> $linux_tree/$link_dir/$f
>> +                fi
>> +            else
>> +                mkdir -p $temp_tree/$link_dir/$d
>> +                cp $xenomai_root/$target_dir/$f $temp_tree/$link_dir/$f
>> +            fi
>> +        done
>> +    )
>> +
>> +}
>> +
>> +generate_patch() {
>> +    (
>> +    cd "$temp_tree"
>> +    find . -type f |
>> +    while read f; do
>> +        diff -Naurd "$linux_tree/$f" "$f" |
>> +        sed -e "s,^--- ${linux_tree}/\.\(/.*\)$,--- linux\1," \
>> +            -e "s,^+++ \.\(/.*\)$,+++ linux-patched\1,"
>> +    done
>> +    )
>> +}
>> +
>> +
>> +usage='usage: prepare-kernel --linux=<linux-tree> 
>> --adeos=<adeos-patch> [--arch=<arch>] [--outpatch=<file> <tempdir>] 
>> [--forcelink]'
>>  me=`basename $0`
>>  
>>  while test $# -gt 0; do
>>      case "$1" in
>>      --linux=*)
>> -    linux_tree=`echo $1|sed -e 's,--linux=\\(.*\\)$,\\1,g'`;
>> +    linux_tree=`echo $1|sed -e 's,^--linux=\\(.*\\)$,\\1,g'`
>>      linux_tree=`eval "echo $linux_tree"`
>>      ;;
>>      --adeos=*)
>> -    adeos_patch=`echo $1|sed -e 's,--adeos=\\(.*\\)$,\\1,g'`;
>> +    adeos_patch=`echo $1|sed -e 's,^--adeos=\\(.*\\)$,\\1,g'`
>>      adeos_patch=`eval "echo $adeos_patch"`
>>      ;;
>>      --arch=*)
>> -    linux_arch=`echo $1|sed -e 's,--arch=\\(.*\\)$,\\1,g'`;
>> +    linux_arch=`echo $1|sed -e 's,^--arch=\\(.*\\)$,\\1,g'`
>> +    ;;
>> +    --outpatch=*)
>> +    output_patch=`echo $1|sed -e 's,^--outpatch=\\(.*\\)$,\\1,g'`
>> +    shift
>> +    temp_tree=`echo $1|sed -e 's,^--tempdir=\\(.*\\)$,\\1,g'`
>>      ;;
>> +    --forcelink)
>> +        forcelink=1
>> +        ;;
>>      --verbose)
>>      verbose=1
>>      ;;
>> @@ -41,8 +125,8 @@
>>      exit 0
>>      ;;
>>      *)
>> -    echo "$me: unknown flag: $1"
>> -    echo "$usage"
>> +    echo "$me: unknown flag: $1" >&2
>> +    echo "$usage" >&2
>>      exit 1
>>      ;;
>>      esac
>> @@ -82,6 +166,22 @@
>>     exit 2
>>  fi
>>  
>> +# Create an empty output patch file, and initialize the temporary tree.
>> +if test "x$output_patch" != "x"; then
>> +
>> +    if test ! -d $temp_tree; then
>> +        echo "$me: $temp_tree (temporary tree) is not an existing 
>> directory"
>> +        exit 2
>> +    fi
>> +    temp_tree=`cd $temp_tree && pwd`
>> +
>> +    patchdir=`dirname $output_patch`
>> +    patchdir=`cd $patchdir && pwd`
>> +    output_patch=$patchdir/`basename $output_patch`
>> +    echo > "$output_patch"
>> +
>> +fi
>> +
>>  # Infer the default architecture if unspecified.
>>  
>>  if test x$linux_arch = x; then
>> @@ -159,13 +259,17 @@
>>  
>>  linux_version="$linux_VERSION.$linux_PATCHLEVEL.$linux_SUBLEVEL$linux_EXTRAVERSION" 
>>
>>  
>> +if test x$verbose = x1; then
>>  echo "Preparing kernel $linux_version in $linux_tree..."
>> +fi
>>  
>>  if test -r $linux_tree/include/linux/ipipe.h; then
>> +    if test x$verbose = x1; then
>>      echo "Adeos found - bypassing patch."
>> +    fi
>>  elif test -r $linux_tree/include/linux/adeos.h; then
>> -   echo "$me: Deprecated Adeos (oldgen) support found in $linux_tree;"
>> -   echo "Upgrade required to Adeos/I-pipe (newgen)."
>> +   echo "$me: Deprecated Adeos (oldgen) support found in 
>> $linux_tree;" >&2
>> +   echo "Upgrade required to Adeos/I-pipe (newgen)." >&2
>>     exit 2
>>  else
>>     if test x$adeos_patch = x; then
>> @@ -191,7 +295,7 @@
>>     curdir=$PWD
>>     cd $linux_tree && patch --dry-run -p1 -f < $adeos_patch || { 
>>          cd $curdir;
>> -        echo "$me: Unable to patch kernel $linux_version with 
>> `basename $adeos_patch`."
>> +        echo "$me: Unable to patch kernel $linux_version with 
>> `basename $adeos_patch`." >&2
>>          exit 2;
>>     }
>>     patch -p1 -f -s < $adeos_patch
>> @@ -201,9 +305,11 @@
>>  adeos_version=`grep '^#define.*IPIPE_ARCH_STRING.*"' 
>> $linux_tree/include/asm-$linux_arch/ipipe.h|sed -e 's,.*"\(.*\)"$,\1,'`
>>  
>>  if test \! x$adeos_version = x; then
>> +   if test x$verbose = x1; then
>>     echo "Adeos/$linux_arch $adeos_version installed."
>> +   fi
>>  else
>> -   echo "$me: $linux_tree has no Adeos support for $linux_arch"
>> +   echo "$me: $linux_tree has no Adeos support for $linux_arch" >&2
>>     exit 2
>>  fi
>>  
>> @@ -218,22 +324,23 @@
>>      config_file=Kconfig
>>  
>>      if ! grep -q XENOMAI $linux_tree/init/Kconfig; then
>> -    sed -e "s,@LINUX_ARCH@,$linux_arch,g" 
>> $xenomai_root/scripts/Kconfig.frag >> $linux_tree/init/Kconfig
>> +    sed -e "s,@LINUX_ARCH@,$linux_arch,g" 
>> $xenomai_root/scripts/Kconfig.frag |
>> +            patch_append init/Kconfig
>>      fi
>>  
>>      if ! grep -q CONFIG_XENOMAI 
>> $linux_tree/arch/$linux_arch/Makefile; then
>>      p="drivers-\$(CONFIG_XENOMAI)        += arch/$linux_arch/xenomai/"
>> -    ( echo ; echo $p ) >> $linux_tree/arch/$linux_arch/Makefile
>> +    ( echo ; echo $p ) | patch_append arch/$linux_arch/Makefile
>>      fi
>>  
>>      if ! grep -q CONFIG_XENOMAI $linux_tree/drivers/Makefile; then
>>      p="obj-\$(CONFIG_XENOMAI)        += xenomai/"
>> -    ( echo ; echo $p ) >> $linux_tree/drivers/Makefile
>> +    ( echo ; echo $p ) | patch_append drivers/Makefile
>>      fi
>>  
>>      if ! grep -q CONFIG_XENOMAI $linux_tree/kernel/Makefile; then
>>      p="obj-\$(CONFIG_XENOMAI)        += xenomai/"
>> -    ( echo ; echo $p ) >> $linux_tree/kernel/Makefile
>> +    ( echo ; echo $p ) | patch_append kernel/Makefile
>>      fi
>>      ;;
>>  
>> @@ -247,7 +354,7 @@
>>      config_file=Config.in
>>  
>>      if ! grep -q CONFIG_XENO $linux_tree/Makefile; then
>> -    ed -s $linux_tree/Makefile > /dev/null <<EOF
>> +    patch_ed Makefile <<EOF
>>  /DRIVERS := \$(DRIVERS-y)
>>  ^r $xenomai_root/scripts/Modules.frag
>>  
>> @@ -255,10 +362,10 @@
>>  wq
>>  EOF
>>      fi
>> -    for defconfig_file in .config 
>> $linux_tree/arch/$linux_arch/defconfig; do
>> -       if test -w $defconfig_file; then
>> -          if ! grep -q CONFIG_XENO $defconfig_file; then
>> -          ed -s $defconfig_file > /dev/null <<EOF
>> +    for defconfig_file in .config arch/$linux_arch/defconfig; do
>> +       if test -w $linux_tree/$defconfig_file; then
>> +          if ! grep -q CONFIG_XENO $linux_tree/$defconfig_file; then
>> +          patch_ed $defconfig_file <<EOF
>>  $
>>  r $xenomai_root/scripts/defconfig.frag
>>  .
>> @@ -268,7 +375,7 @@
>>         fi
>>      done
>>      if ! grep -q CONFIG_XENO $linux_tree/arch/$linux_arch/Makefile; then
>> -    ed -s $linux_tree/arch/$linux_arch/Makefile > /dev/null <<EOF
>> +    patch_ed arch/$linux_arch/Makefile <<EOF
>>  $
>>  a
>>  
>> @@ -281,7 +388,7 @@
>>  EOF
>>      fi
>>      if ! grep -q CONFIG_XENO $linux_tree/drivers/Makefile; then
>> -    ed -s $linux_tree/drivers/Makefile > /dev/null <<EOF
>> +    patch_ed drivers/Makefile <<EOF
>>  /include \$(TOPDIR)\/Rules.make
>>  i
>>  mod-subdirs := xenomai
>> @@ -292,7 +399,7 @@
>>  EOF
>>      fi
>>      if ! grep -q CONFIG_XENO $linux_tree/kernel/Makefile; then
>> -    ed -s $linux_tree/kernel/Makefile > /dev/null <<EOF
>> +    patch_ed kernel/Makefile <<EOF
>>  /include \$(TOPDIR)\/Rules.make
>>  i
>>  mod-subdirs := xenomai
>> @@ -304,7 +411,7 @@
>>  EOF
>>      fi
>>      if ! grep -iq xenomai $linux_tree/arch/$linux_arch/config.in; then
>> -    ed -s $linux_tree/arch/$linux_arch/config.in > /dev/null <<EOF
>> +    patch_ed arch/$linux_arch/config.in <<EOF
>>  $
>>  a
>>  
>> @@ -321,7 +428,7 @@
>>  
>>      *)
>>  
>> -    echo "$me: Unsupported kernel version 
>> $linux_VERSION.$linux_PATCHLEVEL.x"
>> +    echo "$me: Unsupported kernel version 
>> $linux_VERSION.$linux_PATCHLEVEL.x" >&2
>>      exit 2
>>      ;;
>>  
>> @@ -331,15 +438,34 @@
>>  # there, so that we don't pollute the Xenomai source tree with
>>  # compilation files.
>>  
>> -do_links $xenomai_root/ksrc/arch/$xenomai_arch 
>> $linux_tree/arch/$linux_arch/xenomai
>> -do_links $xenomai_root/ksrc $linux_tree/kernel/xenomai
>> -do_links $xenomai_root/ksrc/drivers $linux_tree/drivers/xenomai
>> -do_links $xenomai_root/include/asm-$xenomai_arch 
>> $linux_tree/include/asm-$linux_arch/xenomai
>> -do_links $xenomai_root/include/asm-generic 
>> $linux_tree/include/asm-generic/xenomai
>> -do_links $xenomai_root/include $linux_tree/include/xenomai
>> +patch_link r m ksrc/arch/$xenomai_arch arch/$linux_arch/xenomai
>> +patch_link n m ksrc/ kernel/xenomai
>> +patch_link n m ksrc/arch kernel/xenomai/arch
>> +patch_link r m ksrc/arch/generic kernel/xenomai/arch/generic
>> +patch_link r m ksrc/nucleus kernel/xenomai/nucleus
>> +patch_link r m ksrc/skins kernel/xenomai/skins
>> +patch_link r m ksrc/drivers drivers/xenomai
>> +patch_link r n include/asm-$xenomai_arch include/asm-$linux_arch/xenomai
>> +patch_link r n include/asm-generic include/asm-generic/xenomai
>> +patch_link n n include include/xenomai
>> +for d in include/* ; do
>> +    if test -d $d -a -z "`echo $d | grep '^include/asm-'`"; then
>> +        destdir=`echo $d | sed -e 
>> 's,^\(include\)\(/.*\)$,\1/xenomai\2,'`
>> +        patch_link r n $d $destdir
>> +    fi
>> +done
>>  
>> -echo 'Links installed.'
>> +if test "x$output_patch" != "x"; then
>> +    if test x$verbose = x1; then
>> +    echo 'Generating patch.'
>> +    fi
>> +    generate_patch > "$output_patch"
>> +fi
>>  
>> +if test x$verbose = x1; then
>> +echo 'Links installed.'
>>  echo 'Build system ready.'
>> +fi
>>  
>>  exit 0
>> +
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Xenomai-core mailing list
>> Xenomai-core@domain.hid
>> https://mail.gna.org/listinfo/xenomai-core
> 
> 
> 


-- 

Philippe.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-27 13:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-23  3:24 [Xenomai-core] Xenomai patch packaging concerns Romain Lenglet
2006-02-23 15:21 ` Philippe Gerum
2006-02-24 11:56   ` Romain Lenglet
     [not found]     ` <17407.3428.428108.146818@domain.hid>
2006-02-25  5:13       ` Romain Lenglet
2006-02-27  9:10         ` Philippe Gerum
2006-02-27 13:55           ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.