182 lines
5.2 KiB
Diff
182 lines
5.2 KiB
Diff
|
|
||
|
3rdparty/mkbuild.pl | 92 +++++++++++++++++++++++++++++++++++++++++++++
|
||
|
Documentation/3rdparty.txt | 76 +++++++++++++++++++++++++++++++++++++
|
||
|
2 files changed, 168 insertions(+)
|
||
|
|
||
|
diff -Nurp linux-2.6.37/3rdparty/mkbuild.pl 3rdparty/mkbuild.pl
|
||
|
--- linux-2.6.37/3rdparty/mkbuild.pl 1970-01-01 02:00:00.000000000 +0200
|
||
|
+++ 3rdparty/mkbuild.pl 2004-04-23 14:59:03.000000000 +0300
|
||
|
@@ -0,0 +1,92 @@
|
||
|
+#!/usr/bin/perl -w
|
||
|
+#
|
||
|
+# Version 1.0
|
||
|
+#
|
||
|
+# Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
|
||
|
+# Copyright 2002 Juan Quintela <quintela@mandrakesoft.com>
|
||
|
+# Copyright 2003 Nicolas Planel <nplanel@mandrakesoft.com>
|
||
|
+#
|
||
|
+# This software may be used and distributed according to the terms
|
||
|
+# of the GNU General Public License, incorporated herein by reference.
|
||
|
+#
|
||
|
+#
|
||
|
+# Run "mkbuild.pl"
|
||
|
+#
|
||
|
+# This program generates the following files
|
||
|
+# Makefile
|
||
|
+# Makefile.drivers
|
||
|
+# Config.in
|
||
|
+# using the information in the subdirs of this directory.
|
||
|
+#
|
||
|
+# subdirs need to have:
|
||
|
+# a Config.in file
|
||
|
+# a Makefile with a O_TARGET/L_TARGET targets
|
||
|
+# The config.in should set a CONFIG_<module_dir_name> to m/y.
|
||
|
+
|
||
|
+use strict;
|
||
|
+
|
||
|
+opendir(THISDIR, ".");
|
||
|
+# get dirs without . and .. garbage
|
||
|
+my (@modules) = grep(!/\.\.?$/,grep(-d, readdir(THISDIR)));
|
||
|
+closedir(THISDIR);
|
||
|
+
|
||
|
+generate_kconfig(@modules);
|
||
|
+generate_makefile(@modules);
|
||
|
+exit(0);
|
||
|
+
|
||
|
+##########################################################################
|
||
|
+
|
||
|
+sub generate_makefile {
|
||
|
+ my (@modules) = @_;
|
||
|
+
|
||
|
+ local *F;
|
||
|
+ open F, "> Makefile" or die "Cannot create new Makefile: $!\n";
|
||
|
+ print F <<'EOM';
|
||
|
+#
|
||
|
+# THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT EDIT.
|
||
|
+#
|
||
|
+
|
||
|
+EOM
|
||
|
+ printf F "obj- := 3rdparty.o # Dummy rule to force built-in.o to be made\n";
|
||
|
+ printf F "obj-\$(%s) += %s\n", to_CONFIG($_), $_ . '/' foreach @modules;
|
||
|
+}
|
||
|
+
|
||
|
+sub generate_kconfig {
|
||
|
+ my (@modules) = @_;
|
||
|
+
|
||
|
+ local *F;
|
||
|
+ open F, "> Kconfig" or die "Cannot create Kconfig: $!\n";
|
||
|
+ print F <<"EOM";
|
||
|
+#
|
||
|
+# THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT EDIT.
|
||
|
+#
|
||
|
+
|
||
|
+menu "Unofficial 3rd party kernel additions"
|
||
|
+
|
||
|
+EOM
|
||
|
+
|
||
|
+ foreach (@modules) {
|
||
|
+ die "No Kconfig in $_.\n" if ! -r "$_/Kconfig";
|
||
|
+ print F "source 3rdparty/$_/Kconfig\n";
|
||
|
+ }
|
||
|
+ print F "\n\nendmenu\n";
|
||
|
+}
|
||
|
+
|
||
|
+sub to_CONFIG {
|
||
|
+ local $_ = $_[0];
|
||
|
+ tr/a-z/A-Z/;
|
||
|
+ s/[\-\. ]/_/g;
|
||
|
+ "CONFIG_$_";
|
||
|
+}
|
||
|
+
|
||
|
+sub find_target {
|
||
|
+ my ($module_dir) = @_;
|
||
|
+
|
||
|
+ local *F;
|
||
|
+ open(F, "$module_dir/Makefile") or die "$module_dir/Makefile: $!\n";
|
||
|
+ while (<F>) {
|
||
|
+ chomp;
|
||
|
+ return $1 if (/[LO]_TARGET.*:=\s+(\S+)/);
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
diff -Nurp linux-2.6.37/Documentation/3rdparty.txt Documentation/3rdparty.txt
|
||
|
--- linux-2.6.37/Documentation/3rdparty.txt 1970-01-01 02:00:00.000000000 +0200
|
||
|
+++ Documentation/3rdparty.txt 2003-11-22 01:07:26.000000000 +0200
|
||
|
@@ -0,0 +1,76 @@
|
||
|
+
|
||
|
+Third-Party Kernel Source Module Support, or
|
||
|
+an easy way to add modules to your kernel build.
|
||
|
+
|
||
|
+
|
||
|
+
|
||
|
+Vendors quite often add additional drivers and features to the kernel
|
||
|
+which require nothing more than modifying Kconfig, Makefile, and
|
||
|
+adding one or more files to a sub-directory. As a single discrete task,
|
||
|
+this is not a problem. However, using patches to add modules to the
|
||
|
+kernel very often results in patch conflicts, resulting in needless time
|
||
|
+wastage as developers regenerate an otherwise working kernel patch.
|
||
|
+
|
||
|
+This is designed as a solution to these problems. It is NOT designed as
|
||
|
+a replacement for the kernel build system, but merely as a tool for
|
||
|
+vendors and system administrators to ease the pain of patch management.
|
||
|
+
|
||
|
+The key feature of this system is the distinct lack of patches. Drivers
|
||
|
+are installed via unpacking a tarball.
|
||
|
+
|
||
|
+
|
||
|
+
|
||
|
+Adding a directory to the build (usually from a tarball)
|
||
|
+--------------------------------------------------------
|
||
|
+If a directory exists inside the 3rdparty sub-directory that contains a
|
||
|
+proper Makefile, it can be added to the build. It also needs a
|
||
|
+Kconfig file.
|
||
|
+
|
||
|
+ cd /usr/src/linux-2.4.3/3rdparty
|
||
|
+ bzcat /tmp/my-driver2.tar.bz2 | tar xf - # creates "my2" dir
|
||
|
+
|
||
|
+
|
||
|
+Limitations
|
||
|
+-----------
|
||
|
+There are some limitations to this system. This system is only
|
||
|
+designed to support a very common case. If you find yourself running
|
||
|
+into limitations (kernel build experts can spot them right off),
|
||
|
+then you should probably be patching the kernel instead of using
|
||
|
+mkbuild.pl for that particular module.
|
||
|
+
|
||
|
+FIXME: actually list the limitations
|
||
|
+
|
||
|
+
|
||
|
+
|
||
|
+Other notes
|
||
|
+-----------
|
||
|
+Link order is controlled by the order of mkbuild.pl executions.
|
||
|
+
|
||
|
+"make mrproper" will erase Makefile.meta, and empty Kconfig, Makefile,
|
||
|
+and Makefile.drivers.
|
||
|
+
|
||
|
+IMPORTANT NOTE: Because this feature modifies the kernel's makefiles and
|
||
|
+configuration system, you MUST complete all mkbuild.pl runs before
|
||
|
+running any "make" command.
|
||
|
+
|
||
|
+Building in the 3rdparty dir
|
||
|
+----------------------------
|
||
|
+
|
||
|
+If you use modules that:
|
||
|
+ - are contained in one subdir with the name of the module
|
||
|
+ - has a Makefile
|
||
|
+ - has a Kconfig file
|
||
|
+
|
||
|
+The system calls the ./mkbuild.pl script. It will search for
|
||
|
+subdirectories, and will try to build each of them as a module.
|
||
|
+Things to note:
|
||
|
+
|
||
|
+ The dependencies will be done in a module called:
|
||
|
+
|
||
|
+ 3rdparty/<module_dir_name>/<module_name>
|
||
|
+
|
||
|
+depending of CONFIG_<module_name_in_uppercase>.
|
||
|
+
|
||
|
+<module_name> is the value of O_TARGET/L_TARGET.
|
||
|
+
|
||
|
+
|