Hello everyone,

just a ping to see if anyone has any remarks about this patch.

Best regards 
Johannes Kirchmair

-----UrsprĂĽngliche Nachricht-----
Von: Johannes Kirchmair <johannes.kirchm...@sigmatek.at> 
Gesendet: Dienstag, 11. Juni 2019 13:01
An: xenomai@xenomai.org
Cc: Johannes Kirchmair <johannes.kirchm...@sigmatek.at>
Betreff: [PATCH] prepare-kernal.sh: Add --copylinks option

The prepare-kernal.sh script by default adds the xenomai kernel components to 
the kernel source using soft links.
If you move/remove the xenomai source or move the patched kernel source to 
another workstation, you must change all this links or even replace them by the 
actual files.
To simplify the deployment of the patched kernel source to our coworkers, we 
added the –copylinks option to the prepare-kernal.sh.
The option causes the prepare-kernal.sh to copy the xenomai kernel components 
instead of linking them.
This makes it easy to move the patched kernel source to different locations.
Further, having the actual files in the kernel source makes the use of tools 
like git grep that do not follow symbolic links by default more convenient.
E.g. it gets harder to miss symbols searched with git grep by accident.

Signed-off-by: Johannes Kirchmair <johannes.kirchm...@sigmatek.at>
---
 scripts/prepare-kernel.sh | 47 +++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/scripts/prepare-kernel.sh b/scripts/prepare-kernel.sh index 
e88a9a757..b8cc5f6c1 100755
--- a/scripts/prepare-kernel.sh
+++ b/scripts/prepare-kernel.sh
@@ -84,6 +84,14 @@ patch_link() {
     target_dir="$3"
     link_dir="$4"
 
+
+       if test "x$5" = "x"
+       then
+               ln_cmd="ln -sf"
+       else
+               ln_cmd="cp -f"
+       fi
+
     (
         if test \! \( x$link_file = xm -o x$link_file = xn \); then
           find_clean_opt="-name $link_file"
@@ -122,7 +130,7 @@ patch_link() {
                 if test x$forcelink = x1 -o \
                   ! $xenomai_root/$target_dir/$f -ef $linux_tree/$link_dir/$f;
                then
-                    ln -sf $xenomai_root/$target_dir/$f 
$linux_tree/$link_dir/$f
+                    $ln_cmd $xenomai_root/$target_dir/$f 
+ $linux_tree/$link_dir/$f
                 fi
             else
                 if test `check_filter $link_dir/$f` = "ok"; then @@ -150,6 
+158,8 @@ generate_patch() {
 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`
 
+copylinks=""
+
 while test $# -gt 0; do
     case "$1" in
     --linux=*)
@@ -182,6 +192,9 @@ while test $# -gt 0; do
     --default)
         usedefault=1
         ;;
+       --copylinks)
+               copylinks="1"
+               ;;
     --verbose)
        verbose=1
        ;;
@@ -416,23 +429,23 @@ esac
 
 patch_kernelversion_specific="n"
 patch_architecture_specific="y"
-patch_link r m kernel/cobalt/arch/$linux_arch arch/$linux_arch/xenomai 
-patch_link n n kernel/cobalt/include/ipipe arch/$linux_arch/include/ipipe
+patch_link r m kernel/cobalt/arch/$linux_arch arch/$linux_arch/xenomai 
+$copylinks patch_link n n kernel/cobalt/include/ipipe 
+arch/$linux_arch/include/ipipe $copylinks
 patch_architecture_specific="n"
-patch_link n m kernel/cobalt kernel/xenomai -patch_link n cobalt-core.h 
kernel/cobalt/trace include/trace/events -patch_link n cobalt-rtdm.h 
kernel/cobalt/trace include/trace/events -patch_link n cobalt-posix.h 
kernel/cobalt/trace include/trace/events -patch_link r n 
kernel/cobalt/include/asm-generic/xenomai include/asm-generic/xenomai 
-patch_link r n kernel/cobalt/include/linux/xenomai include/linux/xenomai 
-patch_link n m kernel/cobalt/posix kernel/xenomai/posix -patch_link n m 
kernel/cobalt/rtdm kernel/xenomai/rtdm -patch_link r m kernel/drivers 
drivers/xenomai -patch_link n n include/cobalt/kernel 
include/xenomai/cobalt/kernel -patch_link r n include/cobalt/kernel/rtdm 
include/xenomai/rtdm -patch_link r n include/cobalt/uapi 
include/xenomai/cobalt/uapi -patch_link r n include/rtdm/uapi 
include/xenomai/rtdm/uapi -patch_link n version.h include/xenomai 
include/xenomai
+patch_link n m kernel/cobalt kernel/xenomai $copylinks patch_link n 
+cobalt-core.h kernel/cobalt/trace include/trace/events $copylinks 
+patch_link n cobalt-rtdm.h kernel/cobalt/trace include/trace/events 
+$copylinks patch_link n cobalt-posix.h kernel/cobalt/trace 
+include/trace/events $copylinks patch_link r n 
+kernel/cobalt/include/asm-generic/xenomai include/asm-generic/xenomai 
+$copylinks patch_link r n kernel/cobalt/include/linux/xenomai 
+include/linux/xenomai $copylinks patch_link n m kernel/cobalt/posix 
+kernel/xenomai/posix $copylinks patch_link n m kernel/cobalt/rtdm 
+kernel/xenomai/rtdm $copylinks patch_link r m kernel/drivers 
+drivers/xenomai $copylinks patch_link n n include/cobalt/kernel 
+include/xenomai/cobalt/kernel $copylinks patch_link r n 
+include/cobalt/kernel/rtdm include/xenomai/rtdm $copylinks patch_link r 
+n include/cobalt/uapi include/xenomai/cobalt/uapi $copylinks patch_link 
+r n include/rtdm/uapi include/xenomai/rtdm/uapi $copylinks patch_link n 
+version.h include/xenomai include/xenomai $copylinks
 
 if test "x$output_patch" != "x"; then
     if test x$verbose = x1; then
--
2.17.1

Reply via email to