+Some Linux kernel sources handling utilities.
authorshort <>
Thu, 21 Apr 2005 09:01:45 +0000 (09:01 +0000)
committershort <>
Thu, 21 Apr 2005 09:01:45 +0000 (09:01 +0000)
bin/kernel/My-KernelIgnoreList.pm [new file with mode: 0644]
bin/kernel/ctagskernel [new file with mode: 0755]
bin/kernel/ctagskernelh [new file with mode: 0755]
bin/kernel/diffkernel [new file with mode: 0755]
bin/kernel/kernelLogfix [new file with mode: 0755]
bin/kernel/kernelcvsignore [new file with mode: 0755]
bin/kernel/kernelsrc [new file with mode: 0755]

diff --git a/bin/kernel/My-KernelIgnoreList.pm b/bin/kernel/My-KernelIgnoreList.pm
new file mode 100644 (file)
index 0000000..53dca5e
--- /dev/null
@@ -0,0 +1,83 @@
+# $Id$
+#
+# List of files to ignore; all the compile-time generated files listed here.
+# Used by: diffkernel(1), kernelcvsignore(1)
+
+
+package My::KernelIgnoreList;
+use strict;
+use warnings;
+our @list=qw(
+
+.cvsignore
+.tmp_System.map
+.tmp_kallsyms1.S
+.tmp_kallsyms2.S
+System.map
+.config
+.config.old
+.version
+Module.symvers
+*.cmd
+asm-offsets.s
+vmlinux.lds
+*.mod.c
+autoconf.h
+compile.h
+config_data.h
+vsyscall.lds
+*.o
+*.mod
+consolemap_deftbl.c
+defkeymap.c
+classlist.h
+devlist.h
+asm
+asm_offsets.h
+config
+version.h
+crc32table.h
+keywords.c
+lex.c
+parse.c
+parse.h
+lex.zconf.c
+zconf.tab.c
+zconf.tab.h
+elfconfig.h
+tags
+initramfs_list
+*.orig
+vmlinux
+.tmp_versions
+.tmp_vmlinux1
+.tmp_vmlinux2
+bootsect
+bzImage
+setup
+vmlinux.bin
+vmlinux.bin.gz
+build
+*.so
+*.a
+gen-devlist
+*.ko
+config_data.gz
+gen_crc32table
+bin2c
+conmakehash
+kallsyms
+docproc
+fixdep
+split-include
+genksyms
+mconf
+lxdialog
+mk_elfconfig
+modpost
+gen_init_cpio
+initramfs_data.cpio
+initramfs_data.cpio.gz
+
+);
+1;
diff --git a/bin/kernel/ctagskernel b/bin/kernel/ctagskernel
new file mode 100755 (executable)
index 0000000..c589d76
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/bash
+#
+# $Id$
+#
+# Create 'tags' file in the current directory from its subdirectories.
+# Use for .c & .h mix: Prototype declarations are NOT included.
+
+
+kernelsrc|ctags --file-tags -L - "$@"
diff --git a/bin/kernel/ctagskernelh b/bin/kernel/ctagskernelh
new file mode 100755 (executable)
index 0000000..adc0b35
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/bash
+#
+# $Id$
+#
+# Create 'tags' file in the current directory from its subdirectories.
+# Use for .h without .c: Prototype declarations ARE included.
+
+
+kernelsrc|ctags --c-types=+px --file-tags -L - "$@"
diff --git a/bin/kernel/diffkernel b/bin/kernel/diffkernel
new file mode 100755 (executable)
index 0000000..c1fa61b
--- /dev/null
@@ -0,0 +1,27 @@
+#! /usr/bin/perl
+#
+# $Id$
+#
+# Similiar to the diff(1) command.
+# This one automatically ignores any autogenerated files.
+
+
+use strict;
+use warnings;
+use File::Basename;    # &dirname
+require "".dirname($0)."/My-KernelIgnoreList.pm";
+
+# Do not use the shell here as it tries to expand the argument wildcards.
+local *DIFF;
+# Prevent: Name ... used only once: possible typo
+1 if @My::KernelIgnoreList::list;
+open DIFF,"-|","diff","-ru",
+                               map(("-x",$_),@My::KernelIgnoreList::list),
+                               @ARGV
+               or die "Cannot open the 'diff' output: $!";
+while (<DIFF>) {
+       next if /^Binary files /;
+       next if /^Only in /;
+       print;
+       }
+close DIFF or die "Cannot close the 'diff' output: $!";
diff --git a/bin/kernel/kernelLogfix b/bin/kernel/kernelLogfix
new file mode 100755 (executable)
index 0000000..3fe26df
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/bash
+#
+# $Id$
+#
+# Subst $Log...$ -> %Log...% in all the subdirectories.
+# Required for proper diffing of CVSed Linux kernel sourcetrees.
+
+
+grep -rl '[$]Log\>' .|xargs perl -i -p -e 's/\$(Log\b[^\$]*)\$/%$1%/g'
diff --git a/bin/kernel/kernelcvsignore b/bin/kernel/kernelcvsignore
new file mode 100755 (executable)
index 0000000..71e5fd9
--- /dev/null
@@ -0,0 +1,35 @@
+#! /usr/bin/perl
+#
+# $Id$
+#
+# Generate .cvsignore files in the specified (or current) Linux kernel directory tree.
+
+
+use strict;
+use warnings;
+
+BEGIN {
+       my $macros_env="LACE_MACROS_DIR";
+       my $macros_dir_default=$ENV{"HOME"}."/src/macros";
+       unshift @INC,$_ for $ENV{$macros_env}||$macros_dir_default;
+       eval "use AutoGen;1;" or die <<"HERE";
+Missing "Autogen.pm". Please download the directory 'macros':
+       cvs -d :pserver:pserver:@{[ '@' ]}cvs.jankratochvil.net:/cvs checkout macros
+and place it to '$macros_dir_default' or point ENV{$macros_env} variable there.
+HERE
+}
+
+use File::Basename;    # &basename,&dirname
+
+
+require "".dirname($0)."/My-KernelIgnoreList.pm";
+# Prevent: Name ... used only once: possible typo
+1 if @My::KernelIgnoreList::list;
+my @cleanfiles=@My::KernelIgnoreList::list;
+
+for my $cvsdir (@ARGV||".") {
+       for my $dir (AutoGen::_cvsdirs($cvsdir)) {
+               my @cleanfilesfordir=AutoGen::_cleanfilesfordir $dir,@cleanfiles;
+               AutoGen::_writefile $dir."/.cvsignore",map("$_\n",@cleanfilesfordir);
+       }
+}
diff --git a/bin/kernel/kernelsrc b/bin/kernel/kernelsrc
new file mode 100755 (executable)
index 0000000..016cc9c
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/bash
+#
+# $Id$
+#
+# List all the .c/.h source files in the current directory Linux kernel sourcetree.
+# Omits any non-X86 architectures, currently INCLUDING x86_64 and ia64!
+
+
+exec find -type d '(' -false \
+               -o -name alpha \
+               -o -name arm \
+               -o -name arm26 \
+               -o -name cris \
+               -o -name frv \
+               -o -name h8300 \
+               -o -name ia64 \
+               -o -name m32r \
+               -o -name m68k \
+               -o -name m68knommu \
+               -o -name mips \
+               -o -name parisc \
+               -o -name ppc \
+               -o -name ppc64 \
+               -o -name s390 \
+               -o -name sh \
+               -o -name sh64 \
+               -o -name sparc \
+               -o -name sparc64 \
+               -o -name um \
+               -o -name v850 \
+               -o -name x86_64 \
+               -o -name asm \
+               -o -name asm-alpha \
+               -o -name asm-arm \
+               -o -name asm-arm26 \
+               -o -name asm-cris \
+               -o -name asm-frv \
+               -o -name asm-h8300 \
+               -o -name asm-ia64 \
+               -o -name asm-m32r \
+               -o -name asm-m68k \
+               -o -name asm-m68knommu \
+               -o -name asm-mips \
+               -o -name asm-parisc \
+               -o -name asm-ppc \
+               -o -name asm-ppc64 \
+               -o -name asm-s390 \
+               -o -name asm-s390x \
+               -o -name asm-sh \
+               -o -name asm-sh64 \
+               -o -name asm-sparc \
+               -o -name asm-sparc64 \
+               -o -name asm-um \
+               -o -name asm-v850 \
+               -o -name asm-x86_64 \
+               -o -name config \
+                               ')' \
+               -prune \
+               -o -type f -name "*.[ch]" -print