blob: 7c0caf6c0b5e57a815574c602f44548793dbeb7f (
plain)
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
|
#!/bin/ksh
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2019 Nexenta by DDN, Inc. All rights reserved.
#
# Use normal make (not dmake) by default.
make=${MAKE:-make}
# Set this if you want to use dbx or gdb:
# export SOURCEDEBUG=yes
[ -n "$SRC" ] || {
echo "SRC not set. Run 'ws' or 'bldenv' first."
exit 1
}
cpu=`uname -p`
case $cpu in
i386)
x=intel
kmdb_arch="amd64"
mdb_arch="ia32 amd64"
arch64=amd64
;;
sparc)
x=sparc
kmdb_arch=v9
mdb_arch="v7 v9"
arch64=sparcv9
;;
*) echo "Unknown architecture" ; exit 1;;
esac
################################################################
build_tools() {
test -f $SRC/tools/proto/root_i386-nd/opt/onbld/bin/genoffsets ||
(cd $SRC/tools && $make install)
(cd $SRC/common/mapfiles; $make install)
}
clobber_tools() {
(cd $SRC/tools && $make clobber)
(cd $SRC/common/mapfiles; $make clobber)
}
# end build_tools()
################################################################
do_hdrs() {
targ=$1
if [ "$targ" = clobber ]
then
(cd $SRC/uts && $make -k clobber_h)
(cd $SRC/head && $make clobber)
fi
if [ "$targ" = install ]
then
targ=install_h
# Just the parts of "make sgs" we need, and
# skip them if they appear to be done.
# ... stuff under $SRC
test -f $SRC/uts/common/sys/priv_names.h ||
(cd $SRC/uts && $make -k all_h)
test -f $SRC/head/rpcsvc/nispasswd.h ||
(cd $SRC/head && $make -k $targ)
# ... stuff under $ROOT (proto area)
test -d $ROOT/usr/include/sys ||
(cd $SRC && $make rootdirs)
test -f $ROOT/usr/include/sys/types.h ||
(cd $SRC/uts && $make -k $targ)
test -f $ROOT/usr/include/rpcsvc/daemon_utils.h ||
(cd $SRC/head && $make $targ)
# always update the NFS (kernel) headers to be safe
(cd $SRC/uts/common/gssapi && $make -k $targ)
(cd $SRC/uts/common/sys && $make -k $targ)
(cd $SRC/uts/common/nfs && $make -k $targ)
fi
# Need some library headers too...
for lib in \
libcmdutils \
libcryptoutil \
libidmap \
libpam \
libsec \
libzfs_core \
libzfs \
libshare \
libuutil \
librpcsvc \
libmapid
do
(cd $SRC/lib/$lib && $make $targ)
done
}
# end do_hdrs()
################################################################
do_kern() {
case $1 in
*) targ=$1 ;;
esac
( unset SOURCEDEBUG ;
(cd $SRC/uts/$x/nfs && $make $targ) ;
(cd $SRC/uts/$x/nfs_dlboot && $make $targ) ;
(cd $SRC/uts/$x/nfssrv && $make $targ) ;
(cd $SRC/uts/$x/klmmod && $make $targ) ;
(cd $SRC/uts/$x/klmops && $make $targ) )
}
# end do_kern()
################################################################
# Note lib1 builds prerequisite libraries not delivered by the
# tar file we create below. To accelerate clean/install, we
# skip these on clean (but still nuke them for clobber)
do_lib1() {
for lib in \
libavl \
libuutil \
libcmdutils \
libidmap \
libzfs_core \
libzfs
do
(cd $SRC/lib/$lib && $make $1)
done
}
# lib2 builds stuff we include in the tar file,
# or that we don't mind rebuilding after clean.
do_lib2() {
for lib in \
librpcsvc \
libmapid
do
(cd $SRC/lib/$lib && $make $1)
done
(cd $SRC/lib/libshare && $make $1 PLUGINS=nfs)
}
# end do_lib1() and do_lib2()
################################################################
do_cmds() {
case $1 in
install)
# mount programs need fslib.o
(cd $SRC/cmd/fs.d && $make fslib.o)
(cd $SRC/cmd/fs.d/nfs && $make $1 catalog)
;;
clean|clobber)
(cd $SRC/cmd/fs.d/nfs && $make $1)
(cd $SRC/cmd/fs.d && $make ${1}_local)
;;
esac
}
# Build the MDB modules, WITH the linktest
# Not yet. See https://www.illumos.org/issues/3409
# end do_cmds()
################################################################
# This builds $SRC/TAGS (and cscope.files) in a helpful order.
do_tags() {
(cd $SRC ;
find uts/common/sys -name '*.[ch]' -print |sort
find uts/common/net -name '*.[ch]' -print |sort
find uts/common/netinet -name '*.[ch]' -print |sort
find uts/common/nfs -name '*.[ch]' -print |sort
find uts/common/rpc -name '*.[ch]' -print |sort
find uts/common/klm -name '*.[ch]' -print |sort
find uts/common/fs/nfs -name '*.[ch]' -print |sort
find uts/common/gssapi -name '*.[ch]' -print |sort
find head -name '*.h' -print |sort
find cmd/fs.d/nfs -name '*.[ch]' -print |sort
) > $SRC/cscope.files
(cd $SRC ;
exctags -e --langmap=c:+.ndl -h ndl -L - < cscope.files
cscope -b )
}
#end do_tags()
################################################################
# This creates tarfiles one can use to update a test machine.
do_tar() {
git_rev=`git rev-parse --short=8 HEAD`
# NFS (everything)
files="
kernel/misc/$arch64/klmmod
kernel/misc/$arch64/klmops
kernel/misc/$arch64/nfs_dlboot
kernel/misc/$arch64/nfssrv
kernel/fs/$arch64/nfs
kernel/sys/$arch64/nfs
lib/svc/manifest/network/nfs/cbd.xml
lib/svc/manifest/network/nfs/client.xml
lib/svc/manifest/network/nfs/mapid.xml
lib/svc/manifest/network/nfs/nfslogd.xml
lib/svc/manifest/network/nfs/nlockmgr.xml
lib/svc/manifest/network/nfs/rquota.xml
lib/svc/manifest/network/nfs/server.xml
lib/svc/manifest/network/nfs/status.xml
lib/svc/method/nfs-client
lib/svc/method/nfs-server
lib/svc/method/nlockmgr
usr/bin/nfsstat
usr/lib/fs/nfs/$arch64/libshare_nfs.so.1
usr/lib/fs/nfs/libshare_nfs.so.1
usr/lib/fs/nfs/dfmounts
usr/lib/fs/nfs/dfshares
usr/lib/fs/nfs/nfsfind
usr/lib/fs/nfs/showmount
usr/lib/fs/nfs/umount
usr/lib/nfs/libmapid.so.1
usr/lib/nfs/lockd
usr/lib/nfs/mountd
usr/lib/nfs/nfs4cbd
usr/lib/nfs/nfsd
usr/lib/nfs/nfslogd
usr/lib/nfs/nfsmapid
usr/lib/nfs/rquotad
usr/lib/nfs/statd
usr/lib/reparse/$arch64/libnfs_basic.so.1
usr/lib/reparse/libnfs_basic.so.1
usr/sbin/clear_locks
usr/sbin/exportfs
usr/sbin/nfsref
"
(cd $ROOT && tar cfj ../../nfs-${git_rev}.tar.bz2 $files)
# KLM kmod
files="
kernel/misc/$arch64/klmmod
kernel/misc/$arch64/klmops
"
(cd $ROOT && tar cfj ../../klm-${git_rev}.tar.bz2 $files)
}
# end do_tar()
################################################################
if [ "$1" = "" ]; then
set '?' # force usage
fi
set -x
for arg
do
case "$arg" in
install)
build_tools
set -e
do_hdrs $arg
do_kern $arg
do_lib1 $arg
do_lib2 $arg
do_cmds $arg
;;
clean)
# intentionally skip: lib1, hdrs, tools
do_cmds $arg
do_lib2 $arg
do_kern $arg
;;
clobber)
do_cmds $arg
do_lib2 $arg
do_lib1 $arg
do_kern $arg
do_hdrs $arg
clobber_tools
;;
tags)
do_tags
;;
tar)
do_tar
;;
*)
echo "Usage: $0 {install|clean|clobber|tags|tar}";
exit 1;
;;
esac
done
|