source: trunk/third/openafs/redhat-fix @ 17031

Revision 17031, 1.3 KB checked in by zacheiss, 22 years ago (diff)
Build 3 different sets of kernel modules on Linux. To do this, we need to add a helper script to create a header file to override redhat's /kernel/boot.h.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2#
3# $Id: redhat-fix,v 1.1 2002-02-07 20:58:52 zacheiss Exp $
4
5function 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
41function PrintRedhatKernelFix() {
42    archlist="i386 i586 i686"
43    arch="$1"
44    if [ "$2" = "MP" ]; then
45        ent=0
46        smp=1
47        up=0
48    elif [ "$2" = "EP" ]; then
49        ent=1
50        smp=0
51        up=0
52    else
53        ent=0
54        smp=0
55        up=1
56    fi
57    file="$3"
58
59    rm -f $file
60    touch $file
61
62    PrintDefine "REDHAT_FIX_H" "" ifn,def,nl $file
63
64    PrintDefine "__BOOT_KERNEL_ENTERPRISE" $ent und,def,nl $file
65    PrintDefine "__BOOT_KERNEL_SMP" $smp und,def,nl $file
66    PrintDefine "__BOOT_KERNEL_UP" $up und,def,nl $file
67
68    PrintDefine \"/boot/kernel.h\" "" inc,nl $file      # include file
69
70    for ar in $archlist ; do
71        if [ "$ar" = "$arch" ]; then
72            PrintDefine "__MODULE_KERNEL_$ar" "1" ifn,def,end $file
73        else
74            PrintDefine "__MODULE_KERNEL_$ar" "" und $file      # undef
75        fi
76    done
77    echo "" >> $file
78
79    PrintDefine "" "" end $file
80}
81
82PrintRedhatKernelFix $1 $2 $3
83exit 0
Note: See TracBrowser for help on using the repository browser.