root/lm-sensors/trunk/mkpatch/mkpatch.pl @ 2232

Revision 2232, 38.8 KB (checked in by khali, 9 years ago)

Drop old-style (2.2) Makefiles support.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/perl
2
3#    mkpatch - Create patches against the Linux kernel
4#    Copyright (c) 1999  Frodo Looijaard <frodol@dds.nl>
5#
6#    This program is free software; you can redistribute it and/or modify
7#    it under the terms of the GNU General Public License as published by
8#    the Free Software Foundation; either version 2 of the License, or
9#    (at your option) any later version.
10#
11#    This program is distributed in the hope that it will be useful,
12#    but WITHOUT ANY WARRANTY; without even the implied warranty of
13#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#    GNU General Public License for more details.
15#
16#    You should have received a copy of the GNU General Public License
17#    along with this program; if not, write to the Free Software
18#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20use strict;
21
22use vars qw($temp);
23$temp = "mkpatch/.temp";
24
25# Generate a diff between the old kernel file and the new lm_sensors file. We
26# arrange the headers to tell us the old tree was under directory
27# `linux-old', and the new tree under `linux'.
28# $_[0]: sensors package root (like /tmp/sensors)
29# $_[1]: Linux kernel tree (like /usr/src/linux)
30# $_[2]: Name of the kernel file
31# $_[3]: Name of the patched file
32sub print_diff
33{
34  my ($package_root,$kernel_root,$kernel_file,$package_file) = @_;
35  my ($diff_command,$package_mtime,$kernel_mtime);
36
37  $diff_command = "diff -u";
38  if ( -e "$kernel_root/$kernel_file") {
39    $diff_command .= " $kernel_root/$kernel_file";
40    $kernel_mtime = (stat("$kernel_root/$kernel_file"))[9];
41  } else {
42    $diff_command .= " /dev/null";
43    $kernel_mtime = 0;
44  }
45  if ( -e "$package_root/$package_file") {
46    $diff_command .= " $package_root/$package_file";
47    $package_mtime = (stat("$package_root/$package_file"))[9];
48  } else {
49    $diff_command .= " /dev/null";
50    $package_mtime = 0;
51  }
52  open INPUT, "$diff_command|" or die "Can't execute `$diff_command'";
53  if (<INPUT>) {
54    <INPUT>;
55    print "--- linux-old/$kernel_file\t".gmtime($kernel_mtime)."\n".
56          "+++ linux/$kernel_file\t".gmtime($package_mtime)."\n";
57
58    print while <INPUT>;
59  }
60  close INPUT;
61}
62
63# This generates diffs for kernel file Documentation/Configure.help. This
64# file contains the help texts that can be displayed during `make *config'
65# for the kernel.
66# The new texts are put at the end of the file, or just before the
67# lm_sensors texts.
68# Of course, care is taken old lines are removed.
69# $_[0]: i2c package root (like /tmp/i2c)
70# $_[1]: Linux kernel tree (like /usr/src/linux)
71sub gen_Documentation_Configure_help
72{
73  my ($package_root,$kernel_root) = @_;
74  my $kernel_file = "Documentation/Configure.help";
75  my $package_file = $temp;
76
77  open INPUT,"$kernel_root/$kernel_file"
78        or die "Can't open `$kernel_root/$kernel_file'";
79  open OUTPUT,">$package_root/$package_file"
80        or die "Can't open $package_root/$package_file";
81  MAIN: while(<INPUT>) {
82    if (m@I2C mainboard interfaces@ or
83           m@Acer Labs ALI 1535@ or
84           m@Acer Labs ALI 1533 and 1543C@ or
85           m@AMD 756/766/768/8111@ or
86           m@AMD 8111 SMBus 2.0@ or
87           m@Apple Hydra Mac I/O@ or
88           m@Intel I801@ or
89           m@Intel I810/I815 based Mainboard@ or
90           m@Intel 82371AB PIIX4\(E\)@ or
91           m@Silicon Integrated Systems Corp. SiS5595 based Mainboard@ or
92           m@VIA Technologies, Inc. VT82C586B@ or
93           m@VIA Technologies, Inc. VT82C596, 596B, 686A/B, 8233@ or
94           m@3DFX Banshee / Voodoo3@ or
95           m@DEC Tsunami 21272@ or
96           m@Pseudo ISA adapter \(for hardware sensors modules\)@ or
97           m@Analog Devices ADM1021 and compatibles@ or
98           m@Analog Devices ADM1024@ or
99           m@Analog Devices ADM1025@ or
100           m@Analog Devices ADM1026@ or
101           m@Analog Devices ADM9240 and compatibles@ or
102           m@Asus ASB100@ or
103           m@Dallas DS1621 and DS1625@ or
104           m@Fujitsu-Siemens Poseidon@ or
105           m@Fujitsu-Siemens Scylla@ or
106           m@Genesys Logic GL518SM@ or
107           m@Genesys Logic GL520SM@ or
108           m@HP Maxilife@ or
109           m@ITE 8705, 8712, Sis950@ or
110           m@Maxim MAX6650, MAX6651@ or
111           m@Myson MTP008@ or
112           m@National Semiconductors LM75 and compatibles@ or
113           m@National Semiconductors LM78@ or
114           m@National Semiconductors LM80@ or
115           m@National Semiconductors LM83@ or
116           m@National Semiconductors LM85@ or
117           m@National Semiconductors LM87@ or
118           m@National Semiconductors LM90@ or
119           m@National Semiconductors LM92@ or
120           m@Silicon Integrated Systems Corp. SiS5595 Sensor@ or
121           m@Texas Instruments THMC50 / Analog Devices ADM1022@ or
122           m@Via VT82C686A/B@ or
123           m@Winbond W83781D, W83782D, W83783S, W83627HF, AS99127F@ or
124           m@Winbond W83L785TS-S@ or
125           m@EEprom \(DIMM\) reader@) {
126      $_ = <INPUT>;
127      $_ = <INPUT>;
128      $_ = <INPUT> while not m@^\S@ and not eof(INPUT);
129      redo MAIN;
130    }
131    if (eof(INPUT)) {
132      print OUTPUT <<'EOF'
133I2C mainboard interfaces
134CONFIG_I2C_MAINBOARD
135  Many modern mainboards have some kind of I2C interface integrated. This
136  is often in the form of a SMBus, or System Management Bus, which is
137  basically the same as I2C but which uses only a subset of the I2C
138  protocol.
139
140  You will also want the latest user-space utilties: you can find them
141  in the lm_sensors package, which you can download at
142  http://www.lm-sensors.nu
143
144Acer Labs ALI 1535
145CONFIG_I2C_ALI1535
146  If you say yes to this option, support will be included for the Acer
147  Labs ALI 1535 mainboard I2C interface. This can also be
148  built as a module.
149
150Acer Labs ALI 1533 and 1543C
151CONFIG_I2C_ALI15X3
152  If you say yes to this option, support will be included for the Acer
153  Labs ALI 1533 and 1543C mainboard I2C interfaces. This can also be
154  built as a module which can be inserted and removed while the kernel
155  is running.
156
157AMD 756/766/768/8111
158CONFIG_I2C_AMD756
159  If you say yes to this option, support will be included for the AMD
160  756/766/768/8111 mainboard I2C interfaces. This can also be
161  built as a module which can be inserted and removed while the kernel
162  is running.
163
164AMD 8111 SMBus 2.0
165CONFIG_I2C_AMD8111
166  If you say yes to this option, support will be included for the AMD
167  8111 mainboard SMBus 2.0 interface. This can also be
168  built as a module which can be inserted and removed while the kernel
169  is running.
170
171Apple Hydra Mac I/O
172CONFIG_I2C_HYDRA
173  If you say yes to this option, support will be included for the
174  Hydra mainboard I2C interface. This can also be built as a module
175  which can be inserted and removed while the kernel is running.
176
177Intel I801
178CONFIG_I2C_I801
179  If you say yes to this option, support will be included for the
180  Intel I801 mainboard I2C interfaces. "I810" mainboard sensor chips are
181  generally located on the I801's I2C bus. This can also be
182  built as a module which can be inserted and removed while the kernel
183  is running.
184
185Intel I810/I815 based Mainboard
186CONFIG_I2C_I810
187  If you say yes to this option, support will be included for the
188  Intel I810/I815 mainboard I2C interfaces. The I2C busses these chips
189  are generally used only for video devices. For "810" mainboard sensor
190  chips, use the I801 I2C driver instead. This can also be
191  built as a module which can be inserted and removed while the kernel
192  is running.
193
194Intel 82371AB PIIX4(E) / ServerWorks OSB4 and CSB5
195CONFIG_I2C_PIIX4
196  If you say yes to this option, support will be included for the
197  Intel PIIX4, PIIX4E, and 443MX, Serverworks OSB4/CSB5,
198  and SMSC Victory66 mainboard
199  I2C interfaces. This can also be
200  built as a module which can be inserted and removed while the kernel
201  is running.
202
203Silicon Integrated Systems Corp. SiS5595 based Mainboard
204CONFIG_I2C_SIS5595
205  If you say yes to this option, support will be included for the
206  SiS5595 mainboard I2C interfaces. For integrated sensors on the
207  Sis5595, use CONFIG_SENSORS_SIS5595. This can also be
208  built as a module which can be inserted and removed while the kernel
209  is running.
210
211Silicon Integrated Systems Corp. SiS630/730 based Mainboard
212CONFIG_I2C_SIS630
213  If you say yes to this option, support will be included for the SiS 630
214  and 730 mainboard I2C interfaces. This can also be built as a module
215  which can be inserted and removed while the kernel is running.
216
217Silicon Integrated Systems Corp. SiS645/961,645DX/961,735 based Mainboard
218CONFIG_I2C_SIS645
219  If you say yes to this option, support will be included for the SiS 645/961,
220  645DX/961 and 735 mainboard I2C interfaces. This can also be built as a module
221  which can be inserted and removed while the kernel is running.
222
223VIA Technologies, Inc. VT82C586B
224CONFIG_I2C_VIA
225  If you say yes to this option, support will be included for the VIA
226  Technologies I2C adapter found on some motherboards. This can also
227  be built as a module which can be inserted and removed while the
228  kernel is running.
229
230VIA Technologies, Inc. VT82C596, 596B, 686A/B, 8233, 8235
231CONFIG_I2C_VIAPRO
232  If you say yes to this option, support will be included for the VIA
233  Technologies I2C adapter on these chips. For integrated sensors on the
234  Via 686A/B, use CONFIG_SENSORS_VIA686A. This can also be
235  be built as a module which can be inserted and removed while the
236  kernel is running.
237
2383DFX Banshee / Voodoo3
239CONFIG_I2C_VOODOO3
240  If you say yes to this option, support will be included for the
241  3DFX Banshee and Voodoo3 I2C interfaces. The I2C busses on the these
242  chips are generally used only for video devices.
243  This can also be
244  built as a module which can be inserted and removed while the kernel
245  is running.
246
247DEC Tsunami 21272
248CONFIG_I2C_TSUNAMI
249  If you say yes to this option, support will be included for the DEC
250  Tsunami chipset I2C adapter. Requires the Alpha architecture;
251  do not enable otherwise. This can also be built as a module which
252  can be inserted and removed while the kernel is running.
253
254Pseudo ISA adapter (for hardware sensors modules)
255CONFIG_I2C_ISA
256  This provides support for accessing some hardware sensor chips over
257  the ISA bus rather than the I2C or SMBus. If you want to do this,
258  say yes here. This feature can also be built as a module which can
259  be inserted and removed while the kernel is running.
260
261  You will also need the latest user-space utilties: you can find them
262  in the lm_sensors package, which you can download at
263  http://www.lm-sensors.nu
264
265Analog Devices ADM1021 and compatibles
266CONFIG_SENSORS_ADM1021
267  If you say yes here you get support for Analog Devices ADM1021
268  and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A,
269  Genesys Logic GL523SM, National Semi LM84, TI THMC10, Onsemi MC1066
270  and the XEON processor built-in sensor. This can also
271  be built as a module which can be inserted and removed while the
272  kernel is running.
273
274  You will also need the latest user-space utilties: you can find them
275  in the lm_sensors package, which you can download at
276  http://www.lm-sensors.nu
277
278Analog Devices ADM1024
279CONFIG_SENSORS_ADM1024
280  If you say yes here you get support for Analog Devices ADM1024 sensor
281  chips.  This can also be built as a module.
282
283  You will also need the latest user-space utilties: you can find them
284  in the lm_sensors package, which you can download at
285  http://www.lm-sensors.nu
286
287Analog Devices ADM1025
288CONFIG_SENSORS_ADM1025
289  If you say yes here you get support for Analog Devices ADM1025 sensor
290  chips.  This can also be built as a module which can be inserted and
291  removed while the kernel is running.
292
293  You will also need the latest user-space utilties: you can find them
294  in the lm_sensors package, which you can download at
295  http://www.lm-sensors.nu
296
297Analog Devices ADM1026
298CONFIG_SENSORS_ADM1026
299  If you say yes here you get support for Analog Devices ADM1026 sensor
300  chips.  This can also be built as a module which can be inserted and
301  removed while the kernel is running.
302
303  You will also need the latest user-space utilties: you can find them
304  in the lm_sensors package, which you can download at
305  http://www.lm-sensors.nu
306
307Analog Devices ADM9240 and compatibles
308CONFIG_SENSORS_ADM9240
309  If you say yes here you get support for Analog Devices ADM9240
310  sensor chips and clones: the Dallas Semiconductor DS1780 and
311  the National Semiconductor LM81. This can also be built as a
312  module which can be inserted and removed while the kernel is
313  running.
314
315  You will also need the latest user-space utilties: you can find them
316  in the lm_sensors package, which you can download at
317  http://www.lm-sensors.nu
318
319Asus ASB100
320CONFIG_SENSORS_ASB100
321  If you say yes here you get support for the Asus ASB100 (aka
322  "Bach") sensor chip.  This can also be built as a module.
323
324  You will also need the latest user-space utilities: you can find
325  them in the lm_sensors package, which you can download at
326  http://www.lm-sensors.nu/
327
328Dallas DS1621 and DS1625
329CONFIG_SENSORS_DS1621
330  If you say yes here you get support for the Dallas DS1621 and DS1625x
331  sensor chips.  This can also be built as a module.
332
333  You will also need the latest user-space utilties: you can find them
334  in the lm_sensors package, which you can download at
335  http://www.lm-sensors.nu
336
337Fujitsu-Siemens Poseidon
338CONFIG_SENSORS_FSCPOS
339  If you say yes here you get support for the Fujitsu-Siemens Poseidon
340  sensor chip.  This can also be built as a module.
341
342  You will also need the latest user-space utilties: you can find them
343  in the lm_sensors package, which you can download at
344  http://www.lm-sensors.nu
345
346Fujitsu-Siemens Scylla
347CONFIG_SENSORS_FSCSCY
348  If you say yes here you get support for the Fujitsu-Siemens Scylla
349  sensor chip.  This can also be built as a module. This driver may/should
350  also work with the following Fujitsu-Siemens chips: "Poseidon",
351  "Poseidon II" and "Hydra". You may have to force loading of the module
352  for motherboards in these cases. Be careful - those motherboards have
353  not been tested with this driver.
354
355  You will also need the latest user-space utilties: you can find them
356  in the lm_sensors package, which you can download at
357  http://www.lm-sensors.nu
358
359Genesys Logic GL518SM
360CONFIG_SENSORS_GL518SM
361  If you say yes here you get support for Genesys Logic GL518SM sensor
362  chips.  This can also be built as a module which can be inserted and
363  removed while the kernel is running.
364
365  You will also need the latest user-space utilties: you can find them
366  in the lm_sensors package, which you can download at
367  http://www.lm-sensors.nu
368
369Genesys Logic GL520SM
370CONFIG_SENSORS_GL520SM
371  If you say yes here you get support for Genesys Logic GL518SM sensor
372  chips.  This can also be built as a module which can be inserted and
373  removed while the kernel is running.
374
375  You will also need the latest user-space utilties: you can find them
376  in the lm_sensors package, which you can download at
377  http://www.lm-sensors.nu
378
379HP Maxilife
380CONFIG_SENSORS_MAXILIFE
381  If you say yes here you get support for the HP Maxilife
382  sensor chip.  This can also be built as a module.
383
384  You will also need the latest user-space utilties: you can find them
385  in the lm_sensors package, which you can download at
386  http://www.lm-sensors.nu
387
388ITE 8705, 8712, Sis950
389CONFIG_SENSORS_IT87
390  If you say yes here you get support for the ITE 8705 and 8712 and
391  SiS950 sensor chips.  This can also be built as a module.
392
393  You will also need the latest user-space utilties: you can find them
394  in the lm_sensors package, which you can download at
395  http://www.lm-sensors.nu
396
397Maxim MAX6650, MAX6651
398CONFIG_SENSORS_MAX6650
399  If you say yes here you get support for the Maxim MAX6650 and
400  MAX6651 sensor chips.  This can also be built as a module.
401
402  You will also need the latest user-space utilties: you can find them
403  in the lm_sensors package, which you can download at
404  http://www.lm-sensors.nu
405
406Myson MTP008
407CONFIG_SENSORS_MTP008
408  If you say yes here you get support for the Myson MTP008
409  sensor chip.  This can also be built as a module.
410
411  You will also need the latest user-space utilties: you can find them
412  in the lm_sensors package, which you can download at
413  http://www.lm-sensors.nu
414
415National Semiconductor LM75 and compatibles
416CONFIG_SENSORS_LM75
417  If you say yes here you get support for National Semiconductor LM75
418  sensor chips and clones: Dallas Semi DS75 and DS1775, TelCon
419  TCN75, and National Semi LM77. This can also be built as a module which
420  can be inserted and removed while the kernel is running.
421
422  You will also need the latest user-space utilties: you can find them
423  in the lm_sensors package, which you can download at
424  http://www.lm-sensors.nu
425
426National Semiconductor LM78
427CONFIG_SENSORS_LM78
428  If you say yes here you get support for National Semiconductor LM78
429  sensor chips family: the LM78-J and LM79. Many clone chips will
430  also work at least somewhat with this driver. This can also be built
431  as a module which can be inserted and removed while the kernel is
432  running.
433
434  You will also need the latest user-space utilties: you can find them
435  in the lm_sensors package, which you can download at
436  http://www.lm-sensors.nu
437
438National Semiconductor LM80
439CONFIG_SENSORS_LM80
440  If you say yes here you get support for National Semiconductor LM80
441  sensor chips. This can also be built as a module which can be
442  inserted and removed while the kernel is running.
443
444  You will also need the latest user-space utilties: you can find them
445  in the lm_sensors package, which you can download at
446  http://www.lm-sensors.nu
447
448National Semiconductor LM83
449CONFIG_SENSORS_LM83
450  If you say yes here you get support for the National Semiconductor
451  LM83 sensor chip.  This can also be built as a module.
452
453  You will also need the latest user-space utilities: you can find
454  them in the lm_sensors package, which you can download at
455  http://www.lm-sensors.nu/
456
457National Semiconductor LM85
458CONFIG_SENSORS_LM85
459  If you say yes here you get support for National Semiconductor LM85
460  sensor chips and compatibles.  Compatible chips include the Analog
461  Devices ADM1027 and ADT7463 and SMSC EMC6D100 and EMC6D101.  This
462  can also be built as a module which can be inserted and removed
463  while the kernel is running.
464
465  You will also need the latest user-space utilties: you can find them
466  in the lm_sensors package, which you can download at
467  http://www.lm-sensors.nu
468
469National Semiconductor LM87
470CONFIG_SENSORS_LM87
471  If you say yes here you get support for National Semiconductor LM87
472  sensor chips. This can also be built as a module which can be
473  inserted and removed while the kernel is running.
474
475  You will also need the latest user-space utilties: you can find them
476  in the lm_sensors package, which you can download at
477  http://www.lm-sensors.nu
478
479National Semiconductor LM90
480CONFIG_SENSORS_LM90
481  If you say yes here you get support for the National Semiconductor
482  LM90 and Analog Devices ADM1032 sensor chips.  This can also be
483  built as a module.
484
485  You will also need the latest user-space utilities: you can find
486  them in the lm_sensors package, which you can download at
487  http://www.lm-sensors.nu/
488
489National Semiconductor LM92
490CONFIG_SENSORS_LM92
491  If you say yes here you get support for National Semiconductor LM92
492  sensor chips. This can also be built as a module which can be
493  inserted and removed while the kernel is running.
494
495  You will also need the latest user-space utilties: you can find them
496  in the lm_sensors package, which you can download at
497  http://www.lm-sensors.nu
498
499Philips PCF8574
500CONFIG_SENSORS_PCF8574
501  If you say yes here you get support for the Philips PCF8574
502  I2C 8-bit Parallel I/O device.
503  This can also be built as a module which can be
504  inserted and removed while the kernel is running.
505
506  You will also need the latest user-space utilties: you can find them
507  in the lm_sensors package, which you can download at
508  http://www.lm-sensors.nu
509
510Philips PCF8591
511CONFIG_SENSORS_PCF8591
512  If you say yes here you get support for the Philips PCF8591
513  I2C Quad D/A + Single A/D I/O device.
514  This can also be built as a module which can be
515  inserted and removed while the kernel is running.
516
517  You will also need the latest user-space utilties: you can find them
518  in the lm_sensors package, which you can download at
519  http://www.lm-sensors.nu
520
521Silicon Integrated Systems Corp. SiS5595 Sensor
522CONFIG_SENSORS_SIS5595
523  If you say yes here you get support for the integrated sensors in
524  SiS5595 South Bridges. This can also be built as a module
525  which can be inserted and removed while the kernel is running.
526
527  You will also need the latest user-space utilties: you can find them
528  in the lm_sensors package, which you can download at
529  http://www.lm-sensors.nu
530
531SMSC47M1xx Super I/O Fan Support
532CONFIG_SENSORS_SMSC47M1
533  If you say yes here you get support for the integrated fan
534  monitoring and control in the SMSC 47M1xx Super I/O chips.
535  This can also be built as a module
536  which can be inserted and removed while the kernel is running.
537
538  You will also need the latest user-space utilties: you can find them
539  in the lm_sensors package, which you can download at
540  http://www.lm-sensors.nu
541
542Texas Instruments THMC50 / Analog Devices ADM1022
543CONFIG_SENSORS_THMC50
544  If you say yes here you get support for Texas Instruments THMC50
545  sensor chips and clones: the Analog Devices ADM1022.
546  This can also be built as a module which
547  can be inserted and removed while the kernel is running.
548
549  You will also need the latest user-space utilties: you can find them
550  in the lm_sensors package, which you can download at
551  http://www.lm-sensors.nu
552
553Via VT82C686A/B
554CONFIG_SENSORS_VIA686A
555  If you say yes here you get support for the integrated sensors in
556  Via 686A/B South Bridges. This can also be built as a module
557  which can be inserted and removed while the kernel is running.
558
559  You will also need the latest user-space utilties: you can find them
560  in the lm_sensors package, which you can download at
561  http://www.lm-sensors.nu
562
563Via VT1211 Sensors
564CONFIG_SENSORS_VT1211
565  If you say yes here you get support for the integrated sensors in
566  the Via VT1211 Super I/O device. This can also be built as a module
567  which can be inserted and removed while the kernel is running.
568
569  You will also need the latest user-space utilties: you can find them
570  in the lm_sensors package, which you can download at
571  http://www.lm-sensors.nu
572
573Via VT8231 Sensors
574CONFIG_SENSORS_VT8231
575  If you say yes here you get support for the integrated sensors in
576  the Via VT8231 device. This can also be built as a module
577  which can be inserted and removed while the kernel is running.
578
579  You will also need the latest user-space utilties: you can find them
580  in the lm_sensors package, which you can download at
581  http://www.lm-sensors.nu
582
583Winbond W83781D, W83782D, W83783S, W83627HF, AS99127F
584CONFIG_SENSORS_W83781D
585  If you say yes here you get support for the Winbond W8378x series
586  of sensor chips: the W83781D, W83782D, W83783S and W83682HF,
587  and the similar Asus AS99127F. This
588  can also be built as a module which can be inserted and removed
589  while the kernel is running.
590
591  You will also need the latest user-space utilties: you can find them
592  in the lm_sensors package, which you can download at
593  http://www.lm-sensors.nu
594
595Winbond W83L785TS-S
596CONFIG_SENSORS_W83L785TS
597  If you say yes here you get support for the Winbond W83L785TS-S
598  sensor chip.  This can also be built as a module.
599
600  You will also need the latest user-space utilities: you can find
601  them in the lm_sensors package, which you can download at
602  http://www.lm-sensors.nu/
603
604EEprom (DIMM) reader
605CONFIG_SENSORS_EEPROM
606  If you say yes here you get read-only access to the EEPROM data
607  available on modern memory DIMMs, and which could theoretically
608  also be available on other devices. This can also be built as a
609  module which can be inserted and removed while the kernel is
610  running.
611
612  You will also need the latest user-space utilties: you can find them
613  in the lm_sensors package, which you can download at
614  http://www.lm-sensors.nu
615
616EOF
617    }
618    print OUTPUT;
619  }
620  close INPUT;
621  close OUTPUT;
622  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
623}
624
625
626# This generates diffs for the main Linux Makefile.
627# Three lines which add drivers/sensors/sensors.a to the DRIVERS list are
628# put just before the place where the architecture Makefile is included.
629# Of course, care is taken old lines are removed.
630# $_[0]: sensors package root (like /tmp/sensors)
631# $_[1]: Linux kernel tree (like /usr/src/linux)
632sub gen_Makefile
633{
634  my ($package_root,$kernel_root) = @_;
635  my $kernel_file = "Makefile";
636  my $package_file = $temp;
637  my $type = 0;
638  my $pr1 = 0;
639
640  open INPUT,"$kernel_root/$kernel_file"
641        or die "Can't open `$kernel_root/$kernel_file'";
642  open OUTPUT,">$package_root/$package_file"
643        or die "Can't open $package_root/$package_file";
644  `grep -q -s 'i2c\.o' "$kernel_root/$kernel_file"`;
645  $type = 2 if ! $?;
646  MAIN: while(<INPUT>) {
647    $type = 1 if !$type and (m@^DRIVERS-\$@);
648    if (m@DRIVERS-\$\(CONFIG_SENSORS\)@) {
649      $_ = <INPUT>;
650      redo MAIN;
651    } elsif (m@CONFIG_SENSORS@) {
652      $_ = <INPUT> while not m@endif@;
653      $_ = <INPUT>;
654      $_ = <INPUT> if m@^$@;
655      redo MAIN;
656    }
657    if ($type == 1 and m@^DRIVERS \+= \$\(DRIVERS-y\)@) {
658      print OUTPUT <<'EOF';
659DRIVERS-$(CONFIG_SENSORS) += drivers/sensors/sensors.a
660EOF
661      $pr1 = 1;
662    }
663    if ($type == 2 and m@^DRIVERS .*= \$\(DRIVERS-y\)@) {
664      print OUTPUT <<'EOF';
665DRIVERS-$(CONFIG_SENSORS) += drivers/sensors/sensor.o
666EOF
667      $pr1 = 1;
668    }
669    if ($type == 0 and m@include arch/\$\(ARCH\)/Makefile@) {
670      print OUTPUT <<'EOF';
671ifeq ($(CONFIG_SENSORS),y)
672DRIVERS := $(DRIVERS) drivers/sensors/sensors.a
673endif
674
675EOF
676      $pr1 = 1;
677    }
678    print OUTPUT;
679  }
680  close INPUT;
681  close OUTPUT;
682  die "Automatic patch generation for main `Makefile' failed.\n".
683      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 == 0;
684  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
685}
686
687# This generates diffs for drivers/Makefile
688# First, `sensors' is added to the ALL_SUB_DIRS list. Next, a couple of lines
689# to add sensors to the SUB_DIRS and/or MOD_SUB_DIRS lists is put right before
690# Rules.make is included.
691# Of course, care is taken old lines are removed.
692# $_[0]: sensors package root (like /tmp/sensors)
693# $_[1]: Linux kernel tree (like /usr/src/linux)
694sub gen_drivers_Makefile
695{
696  my ($package_root,$kernel_root) = @_;
697  my $kernel_file = "drivers/Makefile";
698  my $package_file = $temp;
699  my $sensors_present;
700  my $pr1 = 0;
701  my $pr2 = 0;
702  my $new_style = 0;
703
704  open INPUT,"$kernel_root/$kernel_file"
705        or die "Can't open `$kernel_root/$kernel_file'";
706  open OUTPUT,">$package_root/$package_file"
707        or die "Can't open $package_root/$package_file";
708  MAIN: while(<INPUT>) {
709    if (m@^mod-subdirs\s*:=@) {
710      $new_style = 1;
711    }
712    if ((! $new_style and m@^ALL_SUB_DIRS\s*:=@) or m@^mod-subdirs\s*:=@) {
713      $pr1 = 1;
714      $sensors_present = 0;
715      while (m@\\$@) {
716        $sensors_present = 1 if m@sensors@;
717        print OUTPUT;
718        $_ = <INPUT>;
719      }
720      $sensors_present = 1 if m@sensors@;
721      s@$@ sensors@ if (not $sensors_present);
722      print OUTPUT;
723      $_ = <INPUT>;
724      redo MAIN;
725    } 
726    if (m@^ifeq.*CONFIG_SENSORS@) {
727      $_ = <INPUT> while not m@^endif@;
728      $_ = <INPUT>;
729      $_ = <INPUT> if m@^$@;
730      redo MAIN;
731    } 
732    if (m@^subdir.*CONFIG_SENSORS@) {
733      $_ = <INPUT>;
734      redo MAIN;
735    }
736    if (!$pr2 and (m@^include \$\(TOPDIR\)/Rules.make$@ or m@^subdir-\$\(CONFIG_ACPI@)) {
737      $pr2 = 1;
738      if ($new_style) {
739      print OUTPUT <<'EOF';
740subdir-$(CONFIG_SENSORS)        += sensors
741EOF
742      } else {
743      print OUTPUT <<'EOF';
744ifeq ($(CONFIG_SENSORS),y)
745SUB_DIRS += sensors
746MOD_SUB_DIRS += sensors
747else
748  ifeq ($(CONFIG_SENSORS),m)
749  MOD_SUB_DIRS += sensors
750  endif
751endif
752
753EOF
754      }
755    }
756    print OUTPUT;
757  }
758  close INPUT;
759  close OUTPUT;
760  die "Automatic patch generation for `drivers/Makefile' failed.\n".
761      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 == 0 or $pr2 == 0;
762  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
763}
764
765# This generates diffs for drivers/char/Config.in
766# It adds a line just before CONFIG_APM or main_menu_option lines to include
767# the sensors Config.in.
768# Of course, care is taken old lines are removed.
769# $_[0]: sensors package root (like /tmp/sensors)
770# $_[1]: Linux kernel tree (like /usr/src/linux)
771sub gen_drivers_char_Config_in
772{
773  my ($package_root,$kernel_root) = @_;
774  my $kernel_file = "drivers/char/Config.in";
775  my $package_file = $temp;
776  my $pr1 = 0;
777
778  open INPUT,"$kernel_root/$kernel_file"
779        or die "Can't open `$kernel_root/$kernel_file'";
780  open OUTPUT,">$package_root/$package_file"
781        or die "Can't open $package_root/$package_file";
782  MAIN: while(<INPUT>) {
783    if (m@source drivers/i2c/Config.in@) {
784      $pr1 = 1;
785      print OUTPUT;
786      print OUTPUT "\nsource drivers/sensors/Config.in\n";
787      $_ = <INPUT>;
788      redo MAIN;
789    }
790    if (m@sensors@) {
791      $_ = <INPUT>;
792      $_ = <INPUT> if m@^$@;
793      redo MAIN;
794    }
795    print OUTPUT;
796  }
797  close INPUT;
798  close OUTPUT;
799  die "Automatic patch generation for `drivers/char/Config.in' failed.\n".
800      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 == 0;
801  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
802}
803 
804# This generates diffs for drivers/i2c/Config.in
805# Several adapter drivers that are included in the lm_sensors package are
806# added at the first and onlu sensors marker.
807# Of course, care is taken old lines are removed.
808# $_[0]: sensors package root (like /tmp/sensors)
809# $_[1]: Linux kernel tree (like /usr/src/linux)
810sub gen_drivers_i2c_Config_in
811{
812  my ($package_root,$kernel_root) = @_;
813  my $kernel_file = "drivers/i2c/Config.in";
814  my $package_file = "$temp";
815  my $pr1 = 0;
816
817  open INPUT,"$kernel_root/$kernel_file"
818        or die "Can't open `$kernel_root/$kernel_file'";
819  open OUTPUT,">$package_root/$package_file"
820        or die "Can't open $package_root/$package_file";
821  while(<INPUT>) {
822    if (m@sensors code starts here@) {
823      $pr1++;
824      print OUTPUT;
825      while (<INPUT>) {
826        last if m@sensors code ends here@;
827      }
828      print OUTPUT << 'EOF';
829  bool 'I2C mainboard interfaces' CONFIG_I2C_MAINBOARD
830  if [ "$CONFIG_I2C_MAINBOARD" = "y" ]; then
831    dep_tristate '  Acer Labs ALI 1535' CONFIG_I2C_ALI1535 $CONFIG_I2C
832    dep_tristate '  Acer Labs ALI 1533 and 1543C' CONFIG_I2C_ALI15X3 $CONFIG_I2C
833    dep_tristate '  Apple Hydra Mac I/O' CONFIG_I2C_HYDRA $CONFIG_I2C_ALGOBIT
834    dep_tristate '  AMD 756/766/768/8111' CONFIG_I2C_AMD756 $CONFIG_I2C
835    dep_tristate '  AMD 8111 SMBus 2.0' CONFIG_I2C_AMD8111 $CONFIG_I2C
836    if [ "$CONFIG_ALPHA" = "y" ]; then
837      dep_tristate '  DEC Tsunami I2C interface' CONFIG_I2C_TSUNAMI $CONFIG_I2C_ALGOBIT
838    fi
839    dep_tristate '  Intel 82801AA, AB, BA, DB' CONFIG_I2C_I801 $CONFIG_I2C
840    dep_tristate '  Intel i810AA/AB/E and i815' CONFIG_I2C_I810 $CONFIG_I2C_ALGOBIT
841    dep_tristate '  Intel 82371AB PIIX4(E), 443MX, ServerWorks OSB4/CSB5, SMSC Victory66' CONFIG_I2C_PIIX4 $CONFIG_I2C
842    dep_tristate '  SiS 5595' CONFIG_I2C_SIS5595 $CONFIG_I2C
843    dep_tristate '  SiS 630/730' CONFIG_I2C_SIS630 $CONFIG_I2C
844    dep_tristate '  SiS 645/961,645DX/961,735' CONFIG_I2C_SIS645 $CONFIG_I2C $CONFIG_HOTPLUG
845    dep_tristate '  Savage 4' CONFIG_I2C_SAVAGE4 $CONFIG_I2C_ALGOBIT
846    dep_tristate '  VIA Technologies, Inc. VT82C586B' CONFIG_I2C_VIA $CONFIG_I2C_ALGOBIT
847    dep_tristate '  VIA Technologies, Inc. VT596A/B, 686A/B, 8231, 8233, 8233A, 8235' CONFIG_I2C_VIAPRO $CONFIG_I2C
848    dep_tristate '  Voodoo3 I2C interface' CONFIG_I2C_VOODOO3 $CONFIG_I2C_ALGOBIT
849    dep_tristate '  Pseudo ISA adapter (for some hardware sensors)' CONFIG_I2C_ISA $CONFIG_I2C
850  fi
851
852EOF
853    }
854    print OUTPUT;
855  }
856  close INPUT;
857  close OUTPUT;
858  die "Automatic patch generation for `drivers/i2c/Config.in' failed.\n".
859      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 != 1;
860  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
861}
862
863sub gen_drivers_sensors_Makefile
864{
865  my ($package_root,$kernel_root) = @_;
866  my $kernel_file = "drivers/sensors/Makefile";
867  my $package_file = $temp;
868
869  open OUTPUT,">$package_root/$package_file"
870        or die "Can't open $package_root/$package_file";
871  print OUTPUT <<'EOF';
872#
873# Makefile for the kernel hardware sensors drivers.
874#
875
876MOD_LIST_NAME := SENSORS_MODULES
877O_TARGET := sensor.o
878
879obj-$(CONFIG_SENSORS_ADM1021)   += adm1021.o
880obj-$(CONFIG_SENSORS_ADM1024)   += adm1024.o
881obj-$(CONFIG_SENSORS_ADM1025)   += adm1025.o
882obj-$(CONFIG_SENSORS_ADM1026)   += adm1026.o
883obj-$(CONFIG_SENSORS_ADM9240)   += adm9240.o
884obj-$(CONFIG_SENSORS_ASB100)    += asb100.o
885obj-$(CONFIG_SENSORS_BT869)     += bt869.o
886obj-$(CONFIG_SENSORS_DDCMON)    += ddcmon.o
887obj-$(CONFIG_SENSORS_DS1621)    += ds1621.o
888obj-$(CONFIG_SENSORS_EEPROM)    += eeprom.o
889obj-$(CONFIG_SENSORS_FSCPOS)    += fscpos.o
890obj-$(CONFIG_SENSORS_FSCSCY)    += fscscy.o
891obj-$(CONFIG_SENSORS_GL518SM)   += gl518sm.o
892obj-$(CONFIG_SENSORS_GL520SM)   += gl520sm.o
893obj-$(CONFIG_SENSORS_IT87)      += it87.o
894obj-$(CONFIG_SENSORS_LM75)      += lm75.o
895obj-$(CONFIG_SENSORS_LM78)      += lm78.o
896obj-$(CONFIG_SENSORS_LM80)      += lm80.o
897obj-$(CONFIG_SENSORS_LM83)      += lm83.o
898obj-$(CONFIG_SENSORS_LM85)      += lm85.o
899obj-$(CONFIG_SENSORS_LM87)      += lm87.o
900obj-$(CONFIG_SENSORS_LM90)      += lm90.o
901obj-$(CONFIG_SENSORS_LM92)      += lm92.o
902obj-$(CONFIG_SENSORS_MAX6650)   += max6650.o
903obj-$(CONFIG_SENSORS_MAXILIFE)  += maxilife.o
904obj-$(CONFIG_SENSORS_MTP008)    += mtp008.o
905obj-$(CONFIG_SENSORS_PCF8574)   += pcf8574.o
906obj-$(CONFIG_SENSORS_PCF8591)   += pcf8591.o
907obj-$(CONFIG_SENSORS_SIS5595)   += sis5595.o
908obj-$(CONFIG_SENSORS_SMSC47M1)  += smsc47m1.o
909obj-$(CONFIG_SENSORS_THMC50)    += thmc50.o
910obj-$(CONFIG_SENSORS_VIA686A)   += via686a.o
911obj-$(CONFIG_SENSORS_VT1211)    += vt1211.o
912obj-$(CONFIG_SENSORS_VT8231)    += vt8231.o
913obj-$(CONFIG_SENSORS_W83781D)   += w83781d.o
914obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
915
916include $(TOPDIR)/Rules.make
917
918EOF
919  close OUTPUT;
920  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
921}
922
923# This generates diffs for drivers/i2c/Makefile.
924# Lines to add correct files to M_OBJS and/or L_OBJS are added just before
925# Rules.make is included
926# Of course, care is taken old lines are removed.
927# $_[0]: sensors package root (like /tmp/sensors)
928# $_[1]: Linux kernel tree (like /usr/src/linux)
929sub gen_drivers_i2c_Makefile
930{
931  my ($package_root,$kernel_root) = @_;
932  my $kernel_file = "drivers/i2c/Makefile";
933  my $package_file = $temp;
934  my $pr1 = 0;
935
936  open INPUT,"$kernel_root/$kernel_file"
937        or die "Can't open `$kernel_root/$kernel_file'";
938  open OUTPUT,">$package_root/$package_file"
939        or die "Can't open $package_root/$package_file";
940  while(<INPUT>) {
941    if (m@sensors code starts here@) {
942      $pr1 ++;
943      print OUTPUT;
944      while (<INPUT>) {
945        last if m@sensors code ends here@;
946      }
947      print OUTPUT <<'EOF';
948obj-$(CONFIG_I2C_ALI1535)               += i2c-ali1535.o
949obj-$(CONFIG_I2C_ALI15X3)               += i2c-ali15x3.o
950obj-$(CONFIG_I2C_AMD756)                += i2c-amd756.o
951obj-$(CONFIG_I2C_AMD8111)               += i2c-amd8111.o
952obj-$(CONFIG_I2C_HYDRA)                 += i2c-hydra.o
953obj-$(CONFIG_I2C_I801)                  += i2c-i801.o
954obj-$(CONFIG_I2C_I810)                  += i2c-i810.o
955obj-$(CONFIG_I2C_ISA)                   += i2c-isa.o
956obj-$(CONFIG_I2C_PIIX4)                 += i2c-piix4.o dmi_scan.o
957obj-$(CONFIG_I2C_SIS5595)               += i2c-sis5595.o
958obj-$(CONFIG_I2C_SIS630)                += i2c-sis630.o
959obj-$(CONFIG_I2C_SIS645)                += i2c-sis645.o
960obj-$(CONFIG_I2C_SAVAGE4)               += i2c-savage4.o
961obj-$(CONFIG_I2C_TSUNAMI)               += i2c-tsunami.o
962obj-$(CONFIG_I2C_VIA)                   += i2c-via.o
963obj-$(CONFIG_I2C_VIAPRO)                += i2c-viapro.o
964obj-$(CONFIG_I2C_VOODOO3)               += i2c-voodoo3.o
965export-objs                             += dmi_scan.o
966EOF
967    }
968    print OUTPUT;
969  }
970  close INPUT;
971  close OUTPUT;
972  die "Automatic patch generation for `drivers/i2c/Makefile' failed.\n".
973      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 != 1;
974  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
975}
976
977# Generate the diffs for the list of MAINTAINERS
978# $_[0]: i2c package root (like /tmp/i2c)
979# $_[1]: Linux kernel tree (like /usr/src/linux)
980sub gen_MAINTAINERS
981{
982  my ($package_root,$kernel_root) = @_;
983  my $kernel_file = "MAINTAINERS";
984  my $package_file = $temp;
985  my $done = 0;
986
987  open INPUT,"$kernel_root/$kernel_file"
988        or die "Can't open `$kernel_root/$kernel_file'";
989  open OUTPUT,">$package_root/$package_file"
990        or die "Can't open $package_root/$package_file";
991  MAIN: while(<INPUT>) {
992    if (m@SENSORS DRIVERS@) {
993       $_=<INPUT> while not m@^$@;
994       $_=<INPUT>;
995       redo MAIN;
996    }
997    if (not $done and (m@SGI VISUAL WORKSTATION 320 AND 540@)) {
998      print OUTPUT <<'EOF';
999SENSORS DRIVERS
1000P:      Frodo Looijaard
1001M:      frodol@dds.nl
1002P:      Philip Edelbrock
1003M:      phil@netroedge.com
1004L:      sensors@stimpy.netroedge.com
1005W:      http://www.lm-sensors.nu/
1006S:      Maintained
1007
1008EOF
1009      $done = 1;
1010    }
1011    print OUTPUT;
1012  }
1013  close INPUT;
1014  close OUTPUT;
1015  die "Automatic patch generation for `MAINTAINERS' failed.\n".
1016      "See our home page http://www.lm-sensors.nu for assistance!" if $done == 0;
1017  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
1018}
1019
1020
1021# Main function
1022sub main
1023{
1024  my ($package_root,$kernel_root,%files,%includes,$package_file,$kernel_file);
1025  my ($diff_command,$dummy,$data0,$data1,$sedscript,$version_string);
1026
1027  # --> Read the command-lineo
1028  $package_root = $ARGV[0];
1029  die "Package root `$package_root' is not found\n" 
1030        unless -d "$package_root/mkpatch";
1031  $kernel_root = $ARGV[1];
1032  die "Kernel root `$kernel_root' is not found\n" 
1033        unless -f "$kernel_root/Rules.make";
1034
1035  # --> Read FILES
1036  open INPUT, "$package_root/mkpatch/FILES" 
1037        or die "Can't open `$package_root/mkpatch/FILES'";
1038  while (<INPUT>) {
1039    ($data0,$data1) = /(\S+)\s+(\S+)/;
1040    $files{$data0} = $data1;
1041  } 
1042  close INPUT;
1043
1044  # --> Read INCLUDES
1045  open INPUT, "$package_root/mkpatch/INCLUDES" 
1046        or die "Can't open `$package_root/mkpatch/INCLUDES'";
1047  while (<INPUT>) {
1048    ($data0,$data1) = /(\S+)\s+(\S+)/;
1049    $includes{$data0} = $data1;
1050    $sedscript .= 's,(#\s*include\s*)'.$data0.'(\s*),\1'."$data1".'\2, ; ';
1051  } 
1052  close INPUT;
1053
1054  die "First apply the i2c patches to `$kernel_root'!" 
1055       if ! -d "$kernel_root/drivers/i2c";
1056
1057  # --> Read "version.h"
1058  open INPUT, "$package_root/version.h"
1059        or die "Can't open `$package_root/version.h'";
1060  $version_string .= $_ while <INPUT>;
1061  close INPUT;
1062 
1063  # --> Start generating
1064  foreach $package_file (sort keys %files) {
1065    open INPUT,"$package_root/$package_file" 
1066          or die "Can't open `$package_root/$package_file'";
1067    open OUTPUT,">$package_root/$temp"
1068          or die "Can't open `$package_root/$temp'";
1069    while (<INPUT>) {
1070      eval $sedscript;
1071      if (m@#\s*include\s*"version.h"@) {
1072        print OUTPUT $version_string;
1073      } else {
1074        print OUTPUT;
1075      }
1076    }
1077    close INPUT;
1078    close OUTPUT;
1079
1080    $kernel_file = $files{$package_file};
1081    print_diff $package_root,$kernel_root,$kernel_file,$temp;
1082  }
1083
1084  gen_Makefile $package_root, $kernel_root;
1085  gen_drivers_Makefile $package_root, $kernel_root;
1086  gen_drivers_sensors_Makefile $package_root, $kernel_root;
1087  gen_drivers_char_Config_in $package_root, $kernel_root;
1088  gen_drivers_i2c_Config_in $package_root, $kernel_root;
1089  gen_drivers_i2c_Makefile $package_root, $kernel_root;
1090  gen_Documentation_Configure_help $package_root, $kernel_root;
1091  gen_MAINTAINERS $package_root, $kernel_root;
1092}
1093
1094main;
1095
Note: See TracBrowser for help on using the browser.