mkpatch documentation, both as a separate /doc file and in the

script itself. And a minor typo fix in Config.in


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@549 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard committed 1999-09-10 14:55:08 +00:00
1 parent 93f2bda300
commit a6af016090
4 files changed
+98 -2

No files matched your search

+1
View File
@@ -56,3 +56,4 @@ OTHERS
* Examine watchdog-4.3 or later of meskes@debian.org (Michael Meskes)
tsx-11.mit.edu /pub/linux/sources/sbin or
sunsite.unc.edu /pub/linux/system/daemons/watchdog
* Add experimental drivers
+60
View File
@@ -0,0 +1,60 @@
This file tries to document how the `mkpatch' program works.
The file in copyright (c) 1999 by Frodo Looijaard
mkpatch compares the newest lm_sensors sources with what is found in a kernel,
and generates a set of diffs. These diffs can be amplied to that kernel,
after which the kernel is synchronised with the current lm_sensors sources.
You should always run mkpatch against a kernel tree that has been patched
for the newest I2C sources.
mkpatch needs two arguments. The first is the root of the lm_sensors package,
the second is the root of Linux kernel tree. For example:
cd /tmp/lm_sensors-2.4.0
mkpatch/mkpatch . /usr/src/linux
The patch file is written to stdout; any errors are written to stderr.
So you will want to capture the output:
mkpatch/mkpatch . /usr/src/linux > /tmp/lm_sensors-diffs
Later on, you will want to apply the diffs:
cd /usr/src/linuc
patch -p1 -E < /tmp/lm_sensors-diffs
Of course, this can be combined:
mkpatch/mkpatch . /usr/src/linux | patch -d /usr/src/linux -p1 -E
mkpatch uses several files in the mkpatch subdirectory. The location of
these files is hardcoded in the program, but all other files used are
specified in these files, and can easily be changed. Used files are:
FILES
a list of files that will be considered by mkpatch. Each line contains
two filenames, separated by whitespace. The first is the name and
location (relative to the lm_sensors package root) of the lm_sensors
file, the second is the name and location (relative to the kernel root) of
the kernel file. A diff will be created between these two files.
INCLUDES
A list of include file changes. Each line contains two strings that
can be found after a `#include' statement. All occurences of the
first string will be changed to the second, for all lm_sensors files in
FILES, before the normal diff is generated. This allow us to use
`#include "sensors.h"' when compiling in the package tree, and
`#include <linux/sensors.h>' in the kernel tree.
Makefile, Config.in
These files are new and will be copied to the appropriate place as
specified in FILES.
mkpatch does several things:
* For each file pair as specified in FILES, it creates a diff between
them, but before that is done, it changes `#include' lines in the
lm_sensors file as specified in INCLUDES
* It handles several special files, that have to be scanned explicitely
to generate diffs to for them
The generated diffs have specific headers. It will seem as if the old
kernel was contained in the `linux-old' directory, and the new patched
kernel in the `linux' directory, regardless of where the kernel was
actually located.
Most intricate are the special files that are handled. These special
files were already present in the kernel, but had to be patched. Because
they can change between kernel versions, I had to scan them by hand to
find where the new code should be inserted. Each file has documented
what actually happens.
+1 -1
View File
@@ -16,7 +16,7 @@ if [ "$CONFIG_I2C" != "n" ] ; then
dep_tristate ' National Semiconductors LM78' CONFIG_SENSORS_LM78 $CONFIG_SENSORS
dep_tristate ' National Semiconductors LM80' CONFIG_SENSORS_LM80 $CONFIG_SENSORS
dep_tristate ' Silicon Integrated Systems Corp. SiS5595' CONFIG_SENSORS_SIS5595 $CONFIG_SENSORS
dep_tristate ' Western Digital W83781D, W83782D and W83783S' CONFIG_SENSORS_W83781D $CONFIG_SENSORS
dep_tristate ' Winbond W83781D, W83782D and W83783S' CONFIG_SENSORS_W83781D $CONFIG_SENSORS
bool ' Other I2C devices' CONFIG_SENSORS_OTHER
if [ "$CONFIG_SENSORS_OTHER" = "y" ] ; then
dep_tristate ' EEprom (DIMM) reader ' CONFIG_SENSORS_EEPROM $CONFIG_SENSORS
+36 -1
View File
@@ -22,6 +22,9 @@ use strict;
use vars qw($temp);
$temp = "mkpatch/.temp";
# Generate a diff between the old kernel file and the new I2C file. We
# arrange the headers to tell us the old tree was under directory
# `linux-old', and the new tree under `linux'.
# $_[0]: sensors package root (like /tmp/sensors)
# $_[1]: Linux kernel tree (like /usr/src/linux)
# $_[2]: Name of the kernel file
@@ -55,6 +58,10 @@ sub print_diff
}
# This generates diffs for the main Linux Makefile.
# Three lines which add drivers/sensors/sensors.a to the DRIVERS list are
# put just before the place where the architecture Makefile is included.
# Of course, care is taken old lines are removed.
# $_[0]: sensors package root (like /tmp/sensors)
# $_[1]: Linux kernel tree (like /usr/src/linux)
sub gen_Makefile
@@ -88,6 +95,11 @@ EOF
print_diff $package_root,$kernel_root,$kernel_file,$package_file;
}
# This generates diffs for drivers/Makefile
# First, `sensors' is added to the ALL_SUB_DIRS list. Next, a couple of lines
# to add sensors to the SUB_DIRS and/or MOD_SUB_DIRS lists is put right before
# Rules.make is included.
# Of course, care is taken old lines are removed.
# $_[0]: sensors package root (like /tmp/sensors)
# $_[1]: Linux kernel tree (like /usr/src/linux)
sub gen_drivers_Makefile
@@ -137,6 +149,10 @@ EOF
print_diff $package_root,$kernel_root,$kernel_file,$package_file;
}
# This generates diffs for drivers/char/Config.in
# It adds a line just before CONFIG_APM or main_menu_option lines to include
# the sensors Config.in.
# Of course, care is taken old lines are removed.
# $_[0]: sensors package root (like /tmp/sensors)
# $_[1]: Linux kernel tree (like /usr/src/linux)
sub gen_drivers_char_Config_in
@@ -169,6 +185,11 @@ sub gen_drivers_char_Config_in
}
# This generates diffs for drivers/char/mem.c They are a bit intricate.
# Lines are generated at the beginning to declare sensors_init_all
# At the bottom, a call to sensors_init_all is added when the
# new lm_sensors stuff is configured in.
# Of course, care is taken old lines are removed.
# $_[0]: sensors package root (like /tmp/sensors)
# $_[1]: Linux kernel tree (like /usr/src/linux)
sub gen_drivers_char_mem_c
@@ -221,6 +242,10 @@ EOF
}
# This generates diffs for drivers/i2c/Config.in
# Several adapter drivers that are included in the lm_sensors package are
# added at the bottom.
# Of course, care is taken old lines are removed.
# $_[0]: sensors package root (like /tmp/sensors)
# $_[1]: Linux kernel tree (like /usr/src/linux)
sub gen_drivers_i2c_Config_in
@@ -259,6 +284,10 @@ EOF
print_diff $package_root,$kernel_root,$kernel_file,$package_file;
}
# This generates diffs for drivers/i2c/Makefile.
# Lines to add correct files to M_OBJS and/or L_OBJS are added just before
# Rules.make is included
# Of course, care is taken old lines are removed.
# $_[0]: sensors package root (like /tmp/sensors)
# $_[1]: Linux kernel tree (like /usr/src/linux)
sub gen_drivers_i2c_Makefile
@@ -329,6 +358,12 @@ EOF
print_diff $package_root,$kernel_root,$kernel_file,$package_file;
}
# This generates diffs for drivers/i2c/i2c-core.c
# Lines are generated at the beginning to declare several *_init functions.
# At the bottom, calls to them are added when the sensors stuff is configured
# in.
# $_[0]: sensors package root (like /tmp/sensors)
# $_[1]: Linux kernel tree (like /usr/src/linux)
sub gen_drivers_i2c_i2c_core_c
{
my ($package_root,$kernel_root) = @_;
@@ -392,7 +427,7 @@ EOF
print_diff $package_root,$kernel_root,$kernel_file,$package_file;
}
# Main function
sub main
{
my ($package_root,$kernel_root,%files,%includes,$package_file,$kernel_file);