-
Notifications
You must be signed in to change notification settings - Fork 0
/
Configure
executable file
·1088 lines (990 loc) · 32.1 KB
/
Configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
#
# Configure 1.239 2004/07/13 07:33:31
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and
# limitations under the License.
#
# The initial developer of the original code is David A. Hinds
# <[email protected]>. Portions created by David A. Hinds
# are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
#
# Alternatively, the contents of this file may be used under the terms
# of the GNU General Public License version 2 (the "GPL"), in which case
# the provisions of the GPL are applicable instead of the above. If you
# wish to allow the use of your version of this file only under the
# terms of the GPL and not to allow others to use your version of this
# file under the MPL, indicate your decision by deleting the provisions
# above and replace them with the notice and other provisions required
# by the GPL. If you do not delete the provisions above, a recipient
# may use your version of this file under either the MPL or the GPL.
#
#=======================================================================
fail ()
{
echo ""
echo "Configuration failed."
echo ""
exit 1
}
qgrep ()
{
grep $* >/dev/null 2>&1
}
# Minimal requirements for sanity
if [ ! -L include/linux/config.h ] ; then
echo "Ack! The PCMCIA distribution is incomplete/damaged!"
echo " Unpack again -- and try using a Linux filesystem this time."
fail
fi
if ! make -v >/dev/null ; then
echo "Ack! This system does not have a 'make' command!"
echo " Install a normal set of Linux development tools and try again."
fail
fi
if [ -r config.out ] ; then
. ./config.out 2>/dev/null
else
if [ ! -r config.in ] ; then
echo "config.in does not exist!"
fail
fi
. ./config.in
fi
#=======================================================================
PROMPT=y
arg () {
VALUE="`echo X"$2" | sed -e 's/^X--[a-zA-Z_]*=//'`"
eval $1=\"$VALUE\"
}
usage () {
echo "usage: $0 [-n|--noprompt] [--kernel=src-dir] [--target=dir]"
echo " [--moddir=dir] [--arch={i386|alpha|arm|ppc] [--ucc=path]"
echo " [--kcc=path] [--ld=path] [--uflags=flags] [--kflags=flags]"
echo " [--debug=flags] [--{no}trust] [--{no}cardbus] [--{no}pnp]"
echo " [--{no}apm] [--{no}x11] [--force] [--current] [--srctree]"
echo " [--sysv|--bsd] [--rcdir=dir] [--extraver=ver]"
echo ""
echo " -n, --noprompt non-interactive mode: no prompting"
echo " --kernel=DIR use kernel source tree at DIR"
echo " --target=DIR install all files using DIR as root"
echo " --moddir=DIR install modules under DIR"
echo " --arch=ARCH select target architecture for build"
echo " --ucc=PATH specify C compiler for user code"
echo " --kcc=PATH specify C compiler for kernel code"
echo " --ld=PATH use another linker"
echo " --uflags=FLAGS set compiler flags for user-mode tools"
echo " --kflags=FLAGS set compiler flags for kernel modules"
echo " --debug=FLAGS set compiler flags for debugging"
echo " --{no}trust disable or enable trusted user tools"
echo " --{no}cardbus disable or enable CardBus card support"
echo " --{no}pnp disable or enable PnP BIOS support"
echo " --{no}apm disable or enable power management support"
echo " --{no}x11 disable or enable building X11 based tools"
echo " --force ignore presence of 2.4 kernel drivers"
echo " --current read configuration of current kernel"
echo " --srctree read kernel configuration from source tree"
echo " --sysv target has SysV init script layout"
echo " --bsd target uses BSD init scripts"
echo " --rcdir=DIR SysV init scripts are under DIR"
echo " --extraver=VER overrides EXTRAVERSION in kernel Makefile"
exit 1
}
while [ $# -gt 0 ] ; do
case "$1" in
-n|--noprompt) PROMPT=n ;;
--kernel=*) arg LINUX $1 ;;
--target=*) arg PREFIX $1 ;;
--moddir=*) arg MODDIR $1 ;;
--cc=*) arg UCC "$1" ;;
--ucc=*) arg UCC "$1" ;;
--kcc=*) arg KCC "$1" ;;
--ld=*) arg LD "$1" ;;
--debug=*) arg PCDEBUG "$1" ;;
--kflags=*) arg KFLAGS "$1" ;;
--uflags=*) arg UFLAGS "$1" ;;
--arch=*) arg ARCH "$1" ;;
--trust) UNSAFE_TOOLS=y ;;
--notrust) UNSAFE_TOOLS=n ;;
--cardbus) CONFIG_CARDBUS=y ;;
--nocardbus) CONFIG_CARDBUS=n ;;
--pnp) CONFIG_PNP_BIOS=y ;;
--nopnp) CONFIG_PNP_BIOS=n ;;
--apm) USE_PM=y ;;
--noapm) USE_PM=n ;;
--x11) USE_X11=y ;;
--nox11) USE_X11=n ;;
--force) FORCE=y ;;
--current) CONF_SRC=1 ;;
--srctree) CONF_SRC=2 ;;
--sysv) SYSV_INIT=y ;;
--bsd) SYSV_INIT=n ;;
--rcdir=*) arg RC_DIR "$1" ;;
--extraver=*) arg EXTRAVER "$1" ;;
*) usage ;;
esac
shift
done
#=======================================================================
if [ ! "$UCC" ] ; then UCC=cc ; fi
if [ ! "$KCC" ] ; then
if which kgcc >/dev/null 2>&1 ; then KCC=kgcc ; else KCC="$UCC" ; fi
fi
if ! $UCC -v >/dev/null 2>&1 ; then
echo "Ack! Your system does not have '$UCC' installed!"
echo " Install a normal set of Linux development tools and try again."
fail
fi
if ! $KCC -v >/dev/null 2>&1 ; then
echo "Ack! Your system does not have '$KCC' installed!"
echo " Install a normal set of Linux development tools and try again."
fail
fi
#=======================================================================
CONFIG=config.new
CONFIG_H=include/pcmcia/autoconf.h
CONFIG_MK=config.mk
MODVER=include/linux/modversions.h
rm -f .prereq.ok $CONFIG $CONFIG_H $CONFIG_MK $MODVER
cat << 'EOF' > $CONFIG
#
# Automatically generated by 'make config' -- don't edit!
#
EOF
cat << 'EOF' > $CONFIG_H
/*
Automatically generated by 'make config' -- don't edit!
*/
EOF
write_bool() {
value=`eval echo '$'$1`
if [ "$value" = "y" ] ; then
echo "$1=y" >> $CONFIG
echo "$1=y" >> $CONFIG_MK
echo "#define $1 1" >> $CONFIG_H
else
echo "# $1 is not defined" >> $CONFIG
echo "# $1 is not defined" >> $CONFIG_MK
echo "#undef $1" >> $CONFIG_H
fi
}
write_int () {
value=`eval echo '$'$1`
echo "$1"=$value >> $CONFIG
echo "$1=$value" >> $CONFIG_MK
echo "#define $1 $value" >> $CONFIG_H
}
write_str () {
value=`eval echo '$'$1`
echo "$1"=\"$value\" >> $CONFIG
echo "$1=$value" >> $CONFIG_MK
echo "#define $1 \"$value\"" >> $CONFIG_H
}
prompt () {
eval $3=\"$2\"
if [ "$PROMPT" = "y" ] ; then
/bin/echo -e "$1 [$2]: \c"
read tmp
if [ ! -t 1 ] ; then echo $tmp ; fi
if [ -n "$tmp" ] ; then eval $3=\"$tmp\" ; fi
else
/bin/echo "$1 [$2]"
fi
}
ask_bool () {
default=`eval echo '$'$2`
if [ ! "$default" ] ; then default=n ; fi
answer=""
while [ "$answer" != "n" -a "$answer" != "y" ] ; do
prompt "$1 (y/n)" "$default" answer
done
eval "$2=$answer"
write_bool $2
}
ask_str () {
default=`eval echo '$'$2`
prompt "$1" "`echo $default`" answer
eval $2=\"$answer\"
write_str $2
}
#=======================================================================
echo ""
echo " -------- Linux PCMCIA Configuration Script --------"
echo ""
echo "The default responses for each question are correct for most users."
echo "Consult the PCMCIA-HOWTO for additional info about each option."
echo ""
if [ ! "$LINUX" ] ; then
if [ -d /lib/modules/`uname -r`/build ] ; then
LINUX=/lib/modules/`uname -r`/build
else
LINUX=/usr/src/linux
fi
fi
ask_str "Linux kernel source directory" LINUX
match () { case "$1" in $2) return 0; ;; *) return 1;; esac ; }
if ! match "$LINUX" "/*" ; then
echo "$LINUX is not an absolute path!"
fail
fi
if [ ! -f $LINUX/kernel/Makefile ] ; then
echo "Linux source tree '$LINUX' is incomplete or missing!"
if [ -d $LINUX/include/linux ] ; then
echo " The kernel header files are present, but not " \
"the full source code."
fi
echo " See the HOWTO for a list of FTP sites for current" \
"kernel sources."
fail
fi
# What kernel are we compiling for?
version () {
expr $1 \* 65536 + $2 \* 256 + $3
}
echo ""
for TAG in VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION ; do
eval `sed -ne "/^$TAG/s/[ ]//gp" $LINUX/Makefile`
done
if [ "$EXTRAVER" != "" ] ; then
EXTRAVERSION=$EXTRAVER
write_str EXTRAVER
fi
SRC_RELEASE=$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION
SRC_BASE=$VERSION.$PATCHLEVEL.$SUBLEVEL
VERSION_CODE=`version $VERSION $PATCHLEVEL $SUBLEVEL`
echo "The kernel source tree is version $SRC_RELEASE."
if [ $VERSION_CODE -lt `version 2 0 0` ] ; then
echo "This package requires at least a 2.0 series kernel."
fail
elif [ $VERSION_CODE -ge `version 2 1 0` -a \
$VERSION_CODE -lt `version 2 2 0` ] ; then
echo "2.1 kernels are not supported. Upgrade to 2.2."
fail
elif [ $VERSION_CODE -ge `version 2 3 0` -a \
$VERSION_CODE -lt `version 2 4 0` ] ; then
echo "2.3 kernels are not supported. Upgrade to 2.4."
fail
fi
HOST_ARCH=`uname -m | sed -e 's/i.86/i386/'`
if [ ! "$ARCH" ] ; then ARCH=$HOST_ARCH ; fi
CUR_RELEASE=`uname -r`
CUR_VERSION=`uname -v`
CUR_BASE=`uname -r | sed -e "s/^\([0-9]\.[0-9]\.[0-9]*\).*/\1/"`
MATCH=0 # default: different releases and/or architectures
if [ $ARCH = $HOST_ARCH ] ; then
if [ $CUR_RELEASE = $SRC_RELEASE ] ; then
MATCH=1 # same release, perfect match
elif [ $CUR_BASE = $SRC_BASE ] ; then
MATCH=1 # well, maybe same source tree
echo " WARNING: the current kernel is sublevel $CUR_RELEASE."
else
echo " WARNING: the current kernel is version $CUR_RELEASE."
fi
fi
# Check for consistent kernel build dates
CUR_D=`uname -v | sed -e 's/^#[0-9]* //;s/SMP //'`
CUR_D=`echo $CUR_D | sed -e 's/\(:[0-9][0-9]\) .* \([12][90]\)/\1 \2/'`
echo "The current kernel build date is $CUR_D."
SRC_VERSION="unknown";
if [ -f $LINUX/include/linux/compile.h ] ; then
SRC_VERSION=`grep UTS_VERSION $LINUX/include/linux/compile.h |
sed -e 's/.*"\(.*\)"/\1/'`
SRC_D=`echo $SRC_VERSION | sed -e 's/^#[0-9]* //;s/SMP //'`
SRC_D=`echo $SRC_D | sed -e 's/\(:[0-9][0-9]\) .* \([12][90]\)/\1 \2/'`
if [ $MATCH = 1 -a "$SRC_D" != "$CUR_D" ] ; then
echo " WARNING: the source tree has a build date of $SRC_D."
if [ `date -d "$SRC_D" +%s` -gt `date -d "$CUR_D" +%s` ] ; then
echo " Did you forget to install your new kernel?"
fi
elif [ $MATCH = 1 ] ; then
MATCH=2 # same release & date
fi
fi
echo ""
for x in PREFIX KCC UCC LD KFLAGS UFLAGS PCDEBUG ; do
write_str $x
done
write_bool USE_PM
ask_bool "Build 'trusting' versions of card utilities" UNSAFE_TOOLS
ask_bool "Include 32-bit (CardBus) card support" CONFIG_CARDBUS
if [ $ARCH = "i386" -a $VERSION_CODE -gt `version 2 2 0` ] ; then
ask_bool "Include PnP BIOS resource checking" CONFIG_PNP_BIOS
else
CONFIG_PNP_BIOS=n
write_bool CONFIG_PNP_BIOS
fi
if [ $MATCH = 0 ] ; then
CONF_SRC=2 # Use source tree when required to do so
elif [ $MATCH = 2 ] ; then
CONF_SRC=3 # Use source tree when safe to do so
elif [ $MATCH = 1 -a ! -r $LINUX/.config ] ; then
CONF_SRC=1 # Use running kernel if tree is not configured
elif [ "$PROMPT" = "y" ] ; then
echo ""
echo "The PCMCIA drivers need to be compiled to match the kernel they"
echo "will be used with, or some or all of the modules may fail to load."
echo "If you are not sure what to do, please consult the PCMCIA-HOWTO."
echo ""
echo "How would you like to set kernel-specific options?"
echo " 1 - Read from the currently running kernel"
echo " 2 - Read from the Linux source tree"
ans=""
while [ "$ans" != 1 -a "$ans" != 2 ] ; do
prompt "Enter option (1-2)" "$CONF_SRC" ans
done
CONF_SRC=$ans
echo ""
fi
echo "CONF_SRC=$CONF_SRC" >> $CONFIG
if [ $CONF_SRC = 1 ] ; then
UTS_VERSION=$CUR_VERSION ; UTS_RELEASE=$CUR_RELEASE
else
UTS_VERSION=$SRC_VERSION ; UTS_RELEASE=$SRC_RELEASE
fi
write_str UTS_RELEASE
write_str UTS_VERSION
echo "LINUX_VERSION_CODE=$VERSION_CODE" >> $CONFIG
echo "LINUX_VERSION_CODE=$VERSION_CODE" >> $CONFIG_MK
echo "#define LINUX_VERSION_CODE $VERSION_CODE" >> $CONFIG_H
echo "#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))" \
>> $CONFIG_H
echo "" >> $CONFIG
echo "" >> $CONFIG_MK
echo "" >> $CONFIG_H
if [ ! "$MODDIR" ] ; then
if [ -d /lib/modules/preferred ] ; then
MODDIR=/lib/modules/preferred
else
MODDIR=/lib/modules/$UTS_RELEASE
fi
else
MODDIR=`echo $MODDIR | \
sed -e "s/[0-9]\.[0-9]\.[0-9]*.*/$UTS_RELEASE/"`
fi
ask_str "Module install directory" MODDIR
if ! match "$MODDIR" "/lib/modules/*" ; then
if match "$MODDIR" "[yY]" ; then
echo "Selected directory '$MODDIR' is bogus!"
fail
fi
echo "WARNING: '$MODDIR' is an unusual target. Be careful!"
fi
echo ""
#=======================================================================
symcheck () {
eval "CONFIG_$1=n"
if $KSYMS | qgrep "$2" ; then eval "CONFIG_$1=y" ; fi
if [ "$3" ] ; then
/sbin/insmod $3 > /dev/null 2>&1
if $KSYMS | qgrep "$2" ; then eval "CONFIG_$1=y" ; fi
fi
}
configcheck () {
eval "CONFIG_$1=n"
if qgrep "^CONFIG_$1=y" $AUTOCONF ; then
eval "CONFIG_$1=y"
elif qgrep "^CONFIG_$1=m" $AUTOCONF ; then
eval "CONFIG_$1=y"
fi
}
printflag() {
value=`eval echo '$'$2`
/bin/echo -e " $1 is \c"
if [ "$value" = "y" ] ; then
echo "enabled."
else
echo "disabled."
fi
write_bool $2
}
x86_config_tweak () {
CONFIG_X86_L1_CACHE_BYTES=32
write_int CONFIG_X86_L1_CACHE_BYTES
CONFIG_X86_L1_CACHE_SHIFT=5
write_int CONFIG_X86_L1_CACHE_SHIFT
if [ $VERSION_CODE -ge `version 2 2 0` ] ; then
if [ $CONFIG_SMP = "y" ] ; then
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
write_bool CONFIG_X86_LOCAL_APIC
write_bool CONFIG_X86_IO_APIC
fi
if [ $CONFIG_PCI = "y" ] ; then
CONFIG_PCI_QUIRKS=y
write_bool CONFIG_PCI_QUIRKS
fi
fi
if [ $VERSION_CODE -ge `version 2 4 0` ] ; then
write_bool CONFIG_EISA
CONFIG_X86_CMPXCHG=y
if [ "$CONFIG_RWSEM_GENERIC_SPINLOCK" = "y" ] ; then
CONFIG_X86_CMPXCHG=n
fi
write_bool CONFIG_X86_CMPXCHG
fi
if [ "$BIGMEM" ] ; then
if [ "$CONFIG_3GB" = "y" ] ; then MEMMAX=3GB
elif [ "$CONFIG_2GB" = "y" ] ; then MEMMAX=2GB
else MEMMAX=1GB ; fi
echo " Maximum physical memory: $MEMMAX"
echo "MEMMAX=$MEMMAX" >> $CONFIG
write_bool CONFIG_1GB
write_bool CONFIG_2GB
write_bool CONFIG_3GB
fi
printflag "PAE support" CONFIG_X86_PAE
}
alpha_config_tweak () {
if [ $VERSION_CODE -lt `version 2 2 0` ] ; then
CONFIG_ALPHA_LCA=y
write_bool CONFIG_ALPHA_LCA
else
CONFIG_ALPHA_GENERIC=y
write_bool CONFIG_ALPHA_GENERIC
fi
}
ppc_config_tweak () {
printflag "MPC8xx architecture" CONFIG_8xx
printflag "IBM 4xx processor" CONFIG_4xx
printflag "Embedded Planet LITE platform" CONFIG_RPXLITE
printflag "Embedded Planet CLASSIC platfom" CONFIG_RPXCLASSIC
printflag "MPC823 processor" CONFIG_MPC823
printflag "MPC850 processor" CONFIG_MPC850
printflag "MPC860 processor" CONFIG_MPC860
printflag "MPC860T processor" CONFIG_MPC860T
if [ $VERSION_CODE -gt `version 2 4 0` ] ; then
CONFIG_ALL_PPC=y
write_bool CONFIG_ALL_PPC
fi
}
arm_config_tweak () {
printflag "Brutus architecture" CONFIG_ARCH_BRUTUS
printflag "Itsy target platform" CONFIG_ITSY
}
printconfig () {
echo "Kernel configuration options:"
if [ $VERSION_CODE -ge `version 2 3 18` ] ; then
printflag "Kernel-tree PCMCIA support" CONFIG_PCMCIA
fi
printflag "Symmetric multiprocessing support" CONFIG_SMP
if [ "$CONFIG_SMP" = "y" ] ; then
echo "#define __SMP__ 1" >> $CONFIG_H
if [ -n "$CONFIG_NR_CPUS" ] ; then
write_int CONFIG_NR_CPUS
fi
fi
printflag "Preemptive kernel support" CONFIG_PREEMPT
printflag "Realtime Hardware Abstraction Layer" CONFIG_RTHAL
printflag "High memory support" CONFIG_HIGHMEM
if [ "$NEED_HZ" = "y" ] ; then
echo " Timer frequency (HZ) for the kernel is $CONFIG_HZ."
write_int CONFIG_HZ
fi
printflag "PCI BIOS support" CONFIG_PCI
printflag "Power management (APM) support" CONFIG_PM
printflag "SCSI support" CONFIG_SCSI
printflag "IEEE 1394 (FireWire) support" CONFIG_IEEE1394
printflag "Networking support" CONFIG_INET
printflag " Radio network interface support" CONFIG_NET_PCMCIA_RADIO
printflag " Token Ring device support" CONFIG_TR
printflag " Fast switching" CONFIG_NET_FASTROUTE
printflag " Frame Diverter" CONFIG_NET_DIVERT
printflag "Module version checking" CONFIG_MODVERSIONS
printflag "Kernel debugging support" CONFIG_DEBUG_KERNEL
if [ "$CONFIG_DEBUG_KERNEL" = "y" ] ; then
printflag " Memory leak detection support" CONFIG_MEMLEAK
printflag " Spinlock debugging" CONFIG_DEBUG_SPINLOCK
fi
if [ $VERSION_CODE -lt `version 2 1 7` ] ; then
printflag "PCMCIA IDE device support" CONFIG_BLK_DEV_IDE_PCMCIA
fi
printflag "/proc filesystem support" CONFIG_PROC_FS
case $ARCH in
i386) x86_config_tweak ; ;;
alpha) alpha_config_tweak ; ;;
ppc) ppc_config_tweak ; ;;
esac
if [ $VERSION_CODE -ge `version 2 4 0` ] ; then
write_bool CONFIG_RWSEM_GENERIC_SPINLOCK
write_bool CONFIG_RWSEM_XCHGADD_ALGORITHM
fi
}
echo "" >> $CONFIG
echo "" >> $CONFIG_MK
echo "" >> $CONFIG_H
if [ $ARCH = "i386" ] ; then
qgrep CONFIG_1GB $LINUX/include/asm-i386/page_offset.h && BIGMEM=y
qgrep CONFIG_HZ $LINUX/include/asm-i386/param.h && NEED_HZ=y
fi
CONFIG_PCMCIA=n
case $CONF_SRC in
1)
if [ -x /sbin/ksyms ] ; then
KSYMS="/sbin/ksyms -a"
else
echo "Hmmm... /sbin/ksyms is broken. Using /proc/ksyms..."
KSYMS="cat /proc/ksyms"
fi
echo "# Options from current kernel" >> $CONFIG
echo "# Options from current kernel" >> $CONFIG_MK
echo "/* Options from current kernel */" >> $CONFIG_H
echo "CHECK=\"/proc/version\"" >> $CONFIG
echo "CKSUM=\"`cksum < /proc/version`\"" >> $CONFIG
echo "#define CONFIG_MODULES 1" >> $CONFIG_H
if [ $VERSION_CODE -lt `version 2 3 37` ] ; then
if $KSYMS | grep CardServices | qgrep -v pcmcia ; then
CONFIG_PCMCIA=y
fi
else
symcheck PCMCIA dead_socket pcmcia_core
fi
if [ $VERSION_CODE -lt `version 2 2 0` ] ; then
symcheck SMP smp_invalidate_needed
else
symcheck SMP smp_num_cpus
fi
symcheck PREEMPT preempt_schedule
symcheck RTHAL rthal
symcheck PCI pcibios
if [ $VERSION_CODE -lt `version 2 3 43` ] ; then
symcheck PM apm_register_callback
else
symcheck PM pm_register
fi
symcheck SCSI scsi_register scsi_mod
symcheck IEEE1394 hpsb_register_lowlevel ieee1394
symcheck SERIAL register_serial serial
symcheck PARPORT parport_register parport
symcheck PARPORT_PC parport_pc_ops parport_pc
symcheck PARPORT_PC_PCMCIA parport_pc_probe_port parport_pc
symcheck INET register_netdev
symcheck NET_FASTROUTE dev_fastroute_stat
symcheck NET_DIVERT divert_ioctl
if [ -r /proc/net/wireless ] ; then
CONFIG_NET_PCMCIA_RADIO=y
else
CONFIG_NET_PCMCIA_RADIO=n
fi
symcheck MODVERSIONS printk_R
if [ $VERSION_CODE -lt `version 2 1 7` ] ; then
symcheck BLK_DEV_IDE_PCMCIA ide_register
fi
symcheck TR tr_setup
symcheck HIGHMEM kmap_high
if [ "$BIGMEM" ] ; then
symcheck 1GB ^c01
symcheck 2GB ^801
symcheck 3GB ^401
fi
symcheck PROC_FS proc_root
symcheck KDB kdb_
symcheck DEBUG_MCOUNT mcount
symcheck MEMLEAK kmalloc_wrap
if [ $CONFIG_KDB = "y" -o $CONFIG_DEBUG_MCOUNT = "y" -o \
$CONFIG_MEMLEAK = "y" ] ; then
CONFIG_DEBUG_KERNEL=y
fi
if [ $ARCH = "i386" ] ; then
CONFIG_X86_PAE=n
if qgrep pae_pgd /proc/slabinfo ; then
CONFIG_X86_PAE=y
fi
symcheck EISA_bus EISA
elif [ $ARCH = "ppc" ] ; then
symcheck _prep_type ALL_PPC
fi
if [ $VERSION_CODE -ge `version 2 4 0` ] ; then
symcheck RWSEM_GENERIC_SPINLOCK __down_read
symcheck RWSEM_XCHGADD_ALGORITHM rwsem_wake
fi
echo "#ifndef __LINUX_MODVERSIONS_H" > $MODVER
echo "#define __LINUX_MODVERSIONS_H" >> $MODVER
H='[0-9a-f][0-9a-f]'
$KSYMS | sed -ne 's/.* \(.*\)_R\(.*'$H$H$H$H'\)/\1 \2/p' | \
awk '{ printf "#define %s\t%s_R%s\n", $1, $1, $2 }' \
>> $MODVER
echo "#endif" >> $MODVER
if [ "$NEED_HZ" = "y" ] ; then
cat <<-EOF > tmp.c
#include <linux/module.h>
#include <linux/sched.h>
int init_module(void)
{printk("<7>jif=%lu\n",jiffies); return -1;}
EOF
$KCC -DMODULE -D__KERNEL__ -Iinclude -I$LINUX/include -c tmp.c
/sbin/insmod tmp.o >/dev/null 2>&1
TICKS=`dmesg | sed -ne 's/^jif=//p' | tail -1`
CONFIG_HZ=`awk '{printf "%.0f",'$TICKS'/$1}' /proc/uptime`
fi
if [ $VERSION_CODE -gt `version 2 4 21` -a \
"$CONFIG_SMP" = "y" ] ; then
cat <<-EOF > tmp.c
#include <linux/module.h>
#include <linux/sched.h>
static u32 n; MODULE_PARM(n, "i");
#define E(x,n) x[2*n*sizeof(long)/sizeof(u32)]
int init_module(void)
{ u32 i, *x = ¤t->cap_effective;
for (i = 1; i <= 32; i++)
if (E(x,i)==n) {printk("<7>cpus=%d\n", i);break;}
return -1;}
EOF
$KCC -DMODULE -D__KERNEL__ -Iinclude -I$LINUX/include -c tmp.c
EFF=`sed -ne 's/^CapEff:.0*//p' /proc/$$/status`
/sbin/insmod tmp.o n=0x$EFF >/dev/null 2>&1
CONFIG_NR_CPUS=`dmesg | sed -ne 's/^cpus=//p' | tail -1`
fi
;;
2|3)
AUTOCONF=$LINUX/.config
if [ ! -r $AUTOCONF ] ; then
echo "Config file $AUTOCONF not present!"
echo " To fix, run 'make config' in $LINUX."
fail
fi
echo "# Options from $AUTOCONF" >> $CONFIG
echo "# Options from $AUTOCONF" >> $CONFIG_MK
echo "/* Options from $AUTOCONF */" >> $CONFIG_H
echo "CHECK=\"$AUTOCONF\"" >> $CONFIG
echo "CKSUM=\"`cksum < $AUTOCONF`\"" >> $CONFIG
echo "#define CONFIG_MODULES 1" >> $CONFIG_H
configcheck PCMCIA
if qgrep "^ *SMP *= *1" $LINUX/Makefile ; then
CONFIG_SMP=y
else
configcheck SMP
eval `grep "^CONFIG_NR_CPUS=" $AUTOCONF`
fi
if [ $VERSION_CODE -lt `version 2 1 7` ] ; then
configcheck BLK_DEV_IDE_PCMCIA
fi
if [ $VERSION_CODE -lt `version 2 3 43` ] ; then
configcheck APM ; CONFIG_PM=$CONFIG_APM
else
configcheck PM
fi
if [ $VERSION_CODE -ge `version 2 4 0` ] ; then
configcheck RWSEM_GENERIC_SPINLOCK
configcheck RWSEM_XCHGADD_ALGORITHM
fi
for C in PCI SCSI SERIAL INET NET_FASTROUTE NET_RADIO NET_DIVERT \
TR MODVERSIONS PROC_FS PARPORT PARPORT_PC PARPORT_PC_PCMCIA \
IEEE1394 NET_PCMCIA_RADIO KERNEL_DEBUGGING MEMLEAK PREEMPT \
DEBUG_KERNEL DEBUG_SPINLOCK RTHAL HIGHMEM X86_PAE ; do
configcheck $C
done
if [ "$NEED_HZ" = "y" ] ; then
eval `grep "^CONFIG_HZ=" $AUTOCONF`
fi
if qgrep "^CONFIG_PARPORT_PC=y" $AUTOCONF ; then
CONFIG_PARPORT_PC=n
fi
if [ $CONFIG_KERNEL_DEBUGGING = "y" ] ; then
CONFIG_DEBUG_KERNEL=y
fi
if [ $CONFIG_NET_RADIO = "y" ] ; then
CONFIG_NET_PCMCIA_RADIO=y
fi
if [ $ARCH = "i386" ] ; then
configcheck EISA
elif [ $ARCH = "arm" ] ; then
configcheck ARCH_BRUTUS
configcheck ITSY
elif [ $ARCH = "ppc" ] ; then
for C in 8xx 4xx RPXLITE RPXCLASSIC MPC823 MPC850 MPC860 \
MPC860T ALL_PPC ; do
configcheck $C
done
fi
if [ "$BIGMEM" ] ; then
configcheck 1GB
configcheck 2GB
configcheck 3GB
fi
;;
esac
if [ "$FORCE" = "y" -a "$CONFIG_PCMCIA" = "y" ] ; then
CONFIG_PCMCIA=n
fi
if [ "$USE_PM" != "y" ] ; then CONFIG_PM=n ; fi
if [ ! -r $LINUX/include/linux/wireless.h ] ; then
CONFIG_NET_PCMCIA_RADIO=n
fi
if ! qgrep get_lynx_template $LINUX/drivers/ieee1394/pcilynx.c ; then
CONFIG_IEEE1394=n
fi
printconfig
echo ""
#=======================================================================
if [ "$CONFIG_PCI" != "y" -a "$CONFIG_CARDBUS" = "y" ] ; then
echo "Cardbus support requires kernel PCI bus support!"
echo " To fix, re-run 'make config' and disable Cardbus support."
fail
fi
if [ $VERSION_CODE -ge `version 2 5 0` -a "$CONFIG_PCMCIA" != "y" ] ; then
echo "2.5.0 and later kernels require that PCMCIA be configured in the"
echo " kernel source tree. To fix, reconfigure and rebuild your"
echo " kernel with PCMCIA enabled."
fail
fi
if [ ! -r $LINUX/include/asm ] ; then
cd $LINUX/include ; ln -s asm-$ARCH asm 2>/dev/null
fi
if [ ! -r $LINUX/include/asm ] ; then
echo "$LINUX/include/asm does not exist!"
echo " To fix, do 'ln -s asm-$ARCH asm' in $LINUX/include."
fail
fi
AFLAGS=
CONFIG_ISA=n
CONFIG_UID16=y
if [ $ARCH = "i386" ] ; then
CONFIG_ISA=y
elif [ $ARCH = "ppc" ] ; then
AFLAGS="-fno-builtin -msoft-float"
if [ $VERSION_CODE -ge `version 2 1 26` ] ; then
AFLAGS="$AFLAGS -ffixed-r2"
fi
elif [ $ARCH = "alpha" ] ; then
CONFIG_ISA=y
CONFIG_UID16=n
AFLAGS="-mno-fp-regs"
if [ $VERSION_CODE -ge `version 2 1 26` ] ; then
AFLAGS="$AFLAGS -ffixed-8"
fi
fi
write_str ARCH
write_str HOST_ARCH
write_str AFLAGS
write_bool CONFIG_ISA
if [ $VERSION_CODE -ge `version 2 3 40` ] ; then
write_bool CONFIG_UID16
fi
if [ $CONF_SRC != 1 -a "$CONFIG_MODVERSIONS" = "y" -a \
$VERSION_CODE -lt `version 2 6 0` ] ; then
MODVER="$LINUX/$MODVER"
if [ ! -r $MODVER ] ; then
echo "$MODVER does not exist!"
echo " To fix, run 'make dep' in $LINUX."
fail
fi
else
# We may need at least an empty modversions.h file
touch $MODVER
fi
echo "" >> $CONFIG
echo "" >> $CONFIG_MK
echo "" >> $CONFIG_H
#=======================================================================
if [ "$CONFIG_PCMCIA" = "y" ] ; then
# Use our kernel config, then kernel headers, then our headers
CPPFLAGS="-I../include/static -I\$(LINUX)/include -I../include"
else
# Use our kernel config and headers, then kernel headers
CPPFLAGS="-I../include -I\$(LINUX)/include"
fi
echo "CPPFLAGS=$CPPFLAGS" >> $CONFIG_MK
echo "" > tmp.c
WFLAG=-Wa,--no-warn ; $KCC $WFLAG -c tmp.c 2>/dev/null || WFLAG=
echo "WFLAG=$WFLAG" >> $CONFIG_MK
HAS_PROC_BUS=n
if [ $VERSION_CODE -ge `version 2 2 0` ] ; then
HAS_PROC_BUS=y
fi
write_bool HAS_PROC_BUS
if [ $VERSION_CODE -ge `version 2 1 7` -o \
"$CONFIG_BLK_DEV_IDE_PCMCIA" = "y" ] ; then
echo "DO_IDE=y" >> $CONFIG_MK
fi
if [ $VERSION_CODE -ge `version 2 3 6` ] ; then
CONFIG_PARPORT_PC=$CONFIG_PARPORT_PC_PCMCIA
fi
if [ $CONFIG_PARPORT_PC = "y" -a $VERSION_CODE -ge `version 2 2 0` ] ; then
echo "DO_PARPORT=y" >> $CONFIG_MK
fi
if [ $CONFIG_NET_PCMCIA_RADIO = "y" ] ; then
VER=`$KCC -E -dM ${LINUX}/include/linux/wireless.h | \
sed -ne 's/#define WIRELESS_EXT //p'`
if [ $VER -ge 10 ] ; then
echo "DO_ORINOCO=y" >> $CONFIG_MK
fi
fi
SCSI=$LINUX/drivers/scsi
if [ "$CONFIG_SCSI" = "y" -a "$CONFIG_CARDBUS" = "y" ] ; then
if qgrep ADAPTEC_1480A $SCSI/aic7xxx.c ; then
echo "DO_APA1480=y" >> $CONFIG_MK
NEW_AIC7XXX=n
elif [ -r $SCSI/aic7xxx/aic7xxx.c ] ; then
echo "DO_APA1480=y" >> $CONFIG_MK
NEW_AIC7XXX=y
elif [ "$CONFIG_PCMCIA" = "n" ] ; then
echo "The standalone Adaptec APA1480 CardBus driver is not" \
"supported with"
echo " this kernel. If you need it, use the kernel" \
"PCMCIA subsystem."
echo ""
fi
write_bool NEW_AIC7XXX
for f in aic7xxx.h aic7xxx/aic7xxx{,_linux,_osm}.h ; do
if [ -r $SCSI/$f ] ; then AIC7XXX_H=$f ; fi
done
echo "#define AIC7XXX_H <../drivers/scsi/$AIC7XXX_H>" >> $CONFIG_H
fi
if ! qgrep get_lynx_template $LINUX/drivers/ieee1394/pcilynx.c \
&& [ "$CONFIG_PCMCIA" = "n" ] ; then
echo "The standalone IEEE 1394 CardBus drivers are not" \
"supported with this"
echo " kernel. If you need them, use the kernel" \
"PCMCIA subsystem."
echo ""
fi
#=======================================================================
# Is the boot setup OK?
if [ -z "$PREFIX" ] ; then
if [ -f /etc/lilo.conf -a -f /boot/map ] ; then
if [ /vmlinuz -nt /boot/map ] ; then
echo "Your boot map file is older than /vmlinuz. "\
"If you installed /vmlinuz"
echo "by hand, please run 'lilo' to update your boot"\
"data, and then reboot."
# else
# echo "Your 'lilo' installation appears to be OK."
fi
# else
# echo "It doesn't look like you are using 'lilo'."
fi
fi
#=======================================================================
# How should the startup scripts be configured?
if [ -z "$PREFIX" -a -z "$RC_DIR" ] ; then
if [ -d /sbin/init.d -o -d /etc/rc.d/init.d -o -d /etc/init.d ] ; then
echo "It looks like you have a System V init file setup."
SYSV_INIT=y
if [ -d /sbin/init.d ] ; then
RC_DIR=/sbin/init.d
elif [ -d /etc/rc.d/init.d ] ; then
RC_DIR=/etc/rc.d
else
RC_DIR=/etc
fi
else
echo "It looks like you have a BSD-ish init file setup."
if ! qgrep rc.pcmcia /etc/rc.d/rc.S ; then
echo " You'll need to edit /etc/rc.d/rc.S to invoke" \
"/etc/rc.d/rc.pcmcia"
echo " so that PCMCIA services will start at boot time."
fi
SYSV_INIT=
fi
write_bool SYSV_INIT
if [ "$SYSV_INIT" = "y" ] ; then write_str RC_DIR ; fi
elif [ -z "$PREFIX" ] ; then
write_bool SYSV_INIT
if [ "$SYSV_INIT" = "y" ] ; then write_str RC_DIR ; fi
else
ask_bool "System V init script layout" SYSV_INIT
if [ "$SYSV_INIT" = "y" ] ; then
ask_str "Top-level directory for RC scripts" RC_DIR
fi
fi
#=======================================================================
# Optional stuff
if [ "$USE_X11" = "y" ] ; then
HAS_FORMS=n
echo "#include <forms.h>" > tmp.c
echo "int main(void) { void *x = &fl_initialize; return 0; }" >> tmp.c
XINCS="-I/usr/X11R6/include -I/usr/X11/include -I/usr/X11R6/include/X11"
FLIBS="-L/usr/X11R6/lib -L/usr/X11/lib -lforms -lX11 -lm"
if $UCC $UFLAGS $XINCS tmp.c $FLIBS 2>/dev/null ; then
HAS_FORMS=y
elif $UCC $UFLAGS $XINCS tmp.c $FLIBS -lXpm 2>/dev/null ; then
FLIBS="$FLIBS -lXpm"
HAS_FORMS=y
fi
write_bool HAS_FORMS
if [ "$HAS_FORMS" = "y" ] ; then write_str FLIBS ; fi
if [ "$HAS_FORMS" != "y" ] ; then
echo "The Forms library is not available."
fi