OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / testing / utils / make-uml.sh
1 #!/bin/sh
2 #
3
4 # $Id: make-uml.sh,v 1.14.2.1 2002/04/07 17:33:30 mcr Exp $
5 #
6
7 # show me
8 set -x
9
10 # fail if any command fails
11 set -e
12
13 case $# in
14     1) FREESWANSRCDIR=$1; shift;;
15 esac
16     
17 #
18 # configuration for this file has moved to $FREESWANSRCDIR/umlsetup.sh
19 # By default, that file does not exist. A sample is at umlsetup-sample.sh
20 # in this directory. Copy it to $FREESWANSRCDIR and edit it.
21 #
22 FREESWANSRCDIR=${FREESWANSRCDIR-../..}
23 if [ ! -f ${FREESWANSRCDIR}/umlsetup.sh ]
24 then
25     echo No umlsetup.sh. Please read instructions in umlsetup-sample.sh.
26     exit 1
27 fi
28
29 . ${FREESWANSRCDIR}/umlsetup.sh
30 . ${FREESWANSRCDIR}/testing/utils/uml-functions.sh
31
32 # set this to a freshly checked out repository/snapshot
33 FREESWANSRCDIR=${FREESWANSRCDIR-/c2/freeswan/sandbox}
34
35 # make absolute so that we can reference it from POOLSPACE
36 FREESWANSRCDIR=`cd $FREESWANSRCDIR && pwd`;export FREESWANSRCDIR
37
38 if [ -d $FREESWANSRCDIR/testing/kernelconfigs ]
39 then
40     TESTINGROOT=$FREESWANSRCDIR/testing
41 fi
42 TESTINGROOT=${TESTINGROOT-/c2/freeswan/sandbox/testing}
43
44 # okay, copy the kernel, apply the UML patches, and build a plain kernel.
45 UMLPLAIN=$POOLSPACE/plain
46 mkdir -p $UMLPLAIN
47
48 if [ ! -x $UMLPLAIN/linux ]
49 then
50     cd $UMLPLAIN
51     lndir -silent $KERNPOOL .
52     
53     if [ ! -d arch/um ] 
54     then
55         bzcat $UMLPATCH | patch -p1 
56     fi
57
58     if [ ! -f .config ] 
59     then
60         cp ${TESTINGROOT}/kernelconfigs/umlplain.config .config
61     fi
62     (make ARCH=um oldconfig && make ARCH=um dep && make ARCH=um linux ) || exit 1
63 fi
64
65 # now, setup up root dir
66 for host in $REGULARHOSTS
67 do
68     setup_host $host $UMLPLAIN/linux
69 done
70
71 # now, copy the kernel, apply the UML patches.
72 # then, make FreeSWAN patches as well.
73 #
74 UMLSWAN=$POOLSPACE/swan
75
76 # we could copy the UMLPLAIN to make this tree. This would be faster, as we
77 # already built most everything. We could also just use a FreeSWAN-enabled
78 # kernel on sunrise/sunset. We avoid this as we actually want them to always
79 # work.
80
81 # where to install FreeSWAN tools
82 DESTDIR=$POOLSPACE/root
83
84 # do not generate .depend by default
85 KERNDEP=''
86
87 mkdir -p $UMLSWAN
88
89 if [ ! -x $UMLSWAN/linux ]
90 then
91     cd $UMLSWAN
92     lndir -silent $KERNPOOL .
93     
94     if [ ! -d arch/um ] 
95     then
96         bzcat $UMLPATCH | patch -p1 
97     fi
98     
99     # copy the config file
100     rm -f .config
101     cp ${TESTINGROOT}/kernelconfigs/umlswan.config .config
102
103     # make the kernel here for good luck
104     make ARCH=um oldconfig
105     if [ ! -f .depend ]
106     then
107       make ARCH=um dep >umlswan.make.dep.out
108     fi 
109     make ARCH=um linux >umlswan.make.plain.out
110
111     # we have to copy it again, because "make oldconfig" above, blew
112     # away options that it didn't know about.
113
114     cp ${TESTINGROOT}/kernelconfigs/umlswan.config .config
115
116     # nuke final executable here since we will do FreeSWAN in a moment.
117     rm -f linux .depend
118     KERNDEP=dep
119 fi
120
121 grep CONFIG_IPSEC $UMLSWAN/.config || exit 1
122
123 #if [ ! -f $FREESWANSRCDIR/Makefile ] || [ ! -f $FREESWANSRCDIR/pluto/version.c ]
124 if [ ! -f $FREESWANSRCDIR/Makefile ]
125 then
126   if [ ! -f $FREESWANSRCDIR/top/Makefile ]
127   then
128             echo "No Makefile and no top/Makefile. You must check out 'all'!"
129             exit 10
130   fi
131   (cd $FREESWANSRCDIR/top && make devready )
132 fi
133
134 if [ ! -x $UMLSWAN/linux ]
135 then
136     cd $FREESWANSRCDIR || exit 1
137
138     make KERNMAKEOPTS='ARCH=um' KERNELSRC=$UMLSWAN KERNCLEAN='' KERNDEP=$KERNDEP KERNEL=linux DESTDIR=$DESTDIR oldgo || exit 1
139 fi
140
141 cd $FREESWANSRCDIR || exit 1
142
143 make programs
144
145 # now, setup up root dir
146 for host in $FREESWANHOSTS
147 do
148     setup_host $host $UMLSWAN/linux
149     cd $FREESWANSRCDIR && make DESTDIR=$POOLSPACE/$host/root install
150     cd $FREESWANSRCDIR/utils && make DESTDIR=$POOLSPACE/$host/root setup4
151 done
152
153
154
155
156     
157     
158     
159 #
160 # $Log: make-uml.sh,v $
161 # Revision 1.14.2.1  2002/04/07 17:33:30  mcr
162 #    fixes for make-uml desires for building static UML kernels
163 #
164 # Revision 1.15  2002/04/05 01:21:39  mcr
165 #       make-uml script was building statically linked FreeSWAN kernels
166 #       only by fluke - turns out that "make oldconfig" blows away
167 #       any options in .config that weren't defined. Thus, the initial
168 #       build of a non-SWAN kernel before building FreeSWAN would
169 #       blow away the CONFIG_IPSEC options- specifically the CONFIG_IPSEC=y
170 #       (vs =m). This worked before because "make insert" put the
171 #       options back in, but now that the default has changed to modules,
172 #       the it defaults the wrong way.
173 #       Solution: copy the .config file in again after the plain build.
174 #
175 # Revision 1.14  2002/04/03 23:42:18  mcr
176 #       force copy of swan kernel config file to get right IPSEC=y options.
177 #       redirect some build output to a local file.
178 #
179 # Revision 1.13  2002/02/16 20:56:06  rgb
180 # Force make programs so UML does not depend on top level make programs.
181 #
182 # Revision 1.12  2002/02/13 21:39:16  mcr
183 #       change to use uml*.config files instead.
184 #       uml*.config files have been updated for 2.4.7-10 UML patch.
185 #
186 # Revision 1.11  2002/01/11 05:26:03  rgb
187 # Fixed missing semicolon bug.
188 #
189 # Revision 1.10  2001/11/27 05:36:30  mcr
190 #       just look for a kernel in build directory. This
191 #       type of "optomization" is dumb - it should be a makefile.
192 #
193 # Revision 1.9  2001/11/23 00:36:01  mcr
194 #       take $FREESWANDIR as command line argument.
195 #       use HS's "devready" instead of fudging our own.
196 #
197 # Revision 1.8  2001/11/22 05:46:07  henry
198 # new version stuff makes version.c obsolete
199 #
200 # Revision 1.7  2001/11/07 20:10:20  mcr
201 #       revised setup comments after RGB consultation.
202 #       removed all non-variables from umlsetup-sample.sh.
203 #
204 # Revision 1.6  2001/11/07 19:25:17  mcr
205 #       split out some functions from make-uml.
206 #
207 # Revision 1.5  2001/10/28 23:52:22  mcr
208 #       pathnames need to be fully qualified.
209 #
210 # Revision 1.4  2001/10/23 16:32:08  mcr
211 #       make log files unique to each UML.
212 #
213 # Revision 1.3  2001/10/15 05:41:46  mcr
214 #       moved variables for UML setup to common file.
215 #       provided sample of this file.
216 #
217 # Revision 1.2  2001/09/25 01:09:53  mcr
218 #       some minor changes to whether to run "KERNDEP"
219 #
220 # Revision 1.1  2001/09/25 00:52:16  mcr
221 #       a script to build a UML+FreeSWAN testing environment.
222 #
223 #