1 | #!/bin/sh |
---|
2 | # |
---|
3 | # $Id: redhat-fix,v 1.2 2002-05-16 19:17:43 zacheiss Exp $ |
---|
4 | |
---|
5 | function PrintDefine() { |
---|
6 | case $3 in |
---|
7 | *ifn*) |
---|
8 | echo "#ifndef $1" >> $4 |
---|
9 | ;; |
---|
10 | esac |
---|
11 | case $3 in |
---|
12 | *und*) |
---|
13 | echo "#undef $1" >> $4 |
---|
14 | ;; |
---|
15 | esac |
---|
16 | case $3 in |
---|
17 | *def*) |
---|
18 | echo "#define $1 $2" >> $4 |
---|
19 | ;; |
---|
20 | esac |
---|
21 | case $3 in |
---|
22 | *end*) |
---|
23 | echo "#endif" >> $4 |
---|
24 | ;; |
---|
25 | esac |
---|
26 | case $3 in |
---|
27 | *inc*) |
---|
28 | echo "#include $1" >> $4 |
---|
29 | ;; |
---|
30 | esac |
---|
31 | |
---|
32 | |
---|
33 | case $3 in |
---|
34 | *nl*) |
---|
35 | echo "" >> $4 |
---|
36 | ;; |
---|
37 | esac |
---|
38 | } |
---|
39 | |
---|
40 | # PrintRedhatKernelFix arch mp file |
---|
41 | function PrintRedhatKernelFix() { |
---|
42 | archlist="i386 i586 i686" |
---|
43 | arch="$1" |
---|
44 | up=0 |
---|
45 | smp=0 |
---|
46 | ent=0 |
---|
47 | bm=0 |
---|
48 | if [ "$2" = "MP" ]; then |
---|
49 | smp=1 |
---|
50 | elif [ "$2" = "EP" ]; then |
---|
51 | ent=1 |
---|
52 | elif [ "$2" = "BM" ]; then |
---|
53 | bm=1 |
---|
54 | else |
---|
55 | up=1 |
---|
56 | fi |
---|
57 | file="$3" |
---|
58 | |
---|
59 | # deal with the various boot kernels |
---|
60 | boot=0 |
---|
61 | bootsmp=0 |
---|
62 | |
---|
63 | # arch of 'BOOT' == 386 |
---|
64 | if [ "$arch" = "BOOT" ]; then |
---|
65 | if [ "$up" = 1 ]; then |
---|
66 | boot=1 |
---|
67 | up=0 |
---|
68 | elif [ "$smp" = 1 ]; then |
---|
69 | bootsmp=1 |
---|
70 | smp=0 |
---|
71 | fi |
---|
72 | arch=i386 |
---|
73 | fi |
---|
74 | |
---|
75 | rm -f $file |
---|
76 | touch $file |
---|
77 | |
---|
78 | PrintDefine "REDHAT_FIX_H" "" ifn,def,nl $file |
---|
79 | |
---|
80 | PrintDefine "__BOOT_KERNEL_ENTERPRISE" $ent und,def,nl $file |
---|
81 | PrintDefine "__BOOT_KERNEL_BIGMEM" $bm und,def,nl $file |
---|
82 | PrintDefine "__BOOT_KERNEL_SMP" $smp und,def,nl $file |
---|
83 | PrintDefine "__BOOT_KERNEL_UP" $up und,def,nl $file |
---|
84 | PrintDefine "__BOOT_KERNEL_BOOT" $boot und,def,nl $file |
---|
85 | PrintDefine "__BOOT_KERNEL_BOOTSMP" $bootsmp und,def,nl $file |
---|
86 | |
---|
87 | PrintDefine \"/boot/kernel.h\" "" inc,nl $file # include file |
---|
88 | |
---|
89 | for ar in $archlist ; do |
---|
90 | if [ "$ar" = "$arch" ]; then |
---|
91 | PrintDefine "__MODULE_KERNEL_$ar" "1" ifn,def,end $file |
---|
92 | else |
---|
93 | PrintDefine "__MODULE_KERNEL_$ar" "" und $file # undef |
---|
94 | fi |
---|
95 | done |
---|
96 | echo "" >> $file |
---|
97 | |
---|
98 | PrintDefine "" "" end $file |
---|
99 | } |
---|
100 | |
---|
101 | PrintRedhatKernelFix $1 $2 $3 |
---|
102 | exit 0 |
---|