UPDATING revision 1.73 1 $NetBSD: UPDATING,v 1.73 2002/10/11 21:55:48 provos Exp $
2
3 This file is intended to be a brief introduction to the build
4 process and a reference on what to do if something doesn't work.
5
6 For a more detailed description see Makefile.
7
8 Recent changes:
9 ^^^^^^^^^^^^^^^
10
11 20021011:
12 Systrace has been improved to support privilege elevation.
13 Updating the kernel requires the userland part of systrace
14 to be rebuild.
15
16 20021010:
17 The config(8) grammar was changed to allow options to register
18 dependencies on attributes, as well as other options. Users
19 must update and reinstall usr.sbin/config before building a new
20 kernel.
21
22 20021009:
23 A new attribute dependency syntax was introduced to config(8),
24 which is now used by the SCSI configuration description. Users
25 must update and reinstall usr.sbin/config before building a new
26 kernel.
27
28 20021003:
29 Several changes have been made to the autoconfiguration
30 framework. Users must update and reinstall usr.sbin/config
31 before building a new kernel.
32
33 20020922:
34 MKDYNAMICROOT=yes enabled by default, which means that
35 certain shared libraries are installed into /lib, the shared
36 linker is installed into /libexec, and all programs in /bin
37 and /sbin are dynamically linked.
38 If you do not use "make build", you should ensure that
39 you have the libraries and shared linker in the new locations,
40 with:
41 make do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so
42
43 20020917:
44 USE_NEW_TOOLCHAIN has been replaced with:
45 - TOOLCHAIN_MISSING -- set to "yes" on platforms for which
46 there is no working in-tree toolchain (hppa, ns32k, sh5,
47 x86_64).
48 - EXTERNAL_TOOLCHAIN -- if defined by the user, points to the
49 root ofan external toolchain (e.g. /usr/local/gnu). This
50 enables the cross-build framework even for TOOLCHAIN_MISSING
51 platforms.
52
53 20020906:
54 gehenna-devsw has been merged into the trunk. Need to update and
55 reinstall usr.sbin/config before build the kernel.
56
57 20020822:
58 Crunched rescue tools (contents of /bin and /sbin, plus others)
59 are now provided in /rescue.
60
61 To ensure that these are built statically linked (no matter
62 what the setting of LDSTATIC is), use a crunchgen(1) built
63 from sources newer than 20020820 (see the next entry).
64
65 20020820:
66 crunchgen(1) changed to ensure that the generated program
67 is statically linked.
68
69 Solution: update and reinstall usr.bin/crunch
70
71 20020515:
72 sshd user/group has been added. Need to hand add this in, or sshd
73 will not let you log in (with default, or UsePrivlegeSeparation=yes)
74
75 Add the following into /etc/group:
76
77 sshd:*:16:
78
79 and the following to /etc/master.passwd (via vipw):
80
81 sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin
82
83 also /var/chroot/sshd directory needs to be present (digged as a part of
84 build process).
85
86 20020426:
87 NBUILDJOBS obsoleted in favor of just using -j.
88
89 20020426:
90 etc/postinstall added, which performs various checks for
91 configuration file updates and changes, and can fix most of
92 the problems identified.
93 This should make it much easier to upgrade a system's
94 configuration from earlier systems (as far back as NetBSD 1.5).
95
96 20020320:
97 <bsd.lib.mk> needs a new install(1) for it's "-a cmd" support.
98 build and install at usr.bin/xinstall before the build.
99
100 20020319:
101 raw IPv6 socket now makes strict checking for sa_family and sa_len
102 on send(2) operation. be sure to have sbin/rtsol and usr.sbin/rtsold
103 newer than November 2001 when you upgrade the kernel.
104
105 20020311:
106 ssh configuration files were moved from /etc to /etc/ssh. Beware
107 if you restart your machine from remote. Note that sshd.conf needs
108 to be changed (due to the use of "/etc" inside).
109
110 20020223:
111 Users of the VAX port will need to rebuild and install gas
112 so it deal with the now present register prefix used in all
113 the VAX assembly files.
114
115 20020118:
116
117 ntpd user/group has been added. Need to hand add this in or builds
118 will break as mtree aborts early.
119
120 Add the following into /etc/group:
121
122 ntpd:*:15:
123
124 and the following to /etc/master.passwd (via vipw):
125
126 ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin
127
128 20011207:
129
130 If you're attempting to build a snapshot on sparc64 and are getting
131 reloc errors from the toolchain groff binary this means your native
132 toolchain has some broken C++ bits.
133
134 To fix:
135
136 Build a new toolchain (i.e. build.sh -t)
137 Use the new toolchain to build and install natively (i.e. /usr/lib)
138
139 gnu/lib/libgcc
140 gnu/lib/libstdc++
141
142 After this a snapshot will be able to be built.
143
144 20011201:
145 In order for a sparc64 build to work you must have a working awk. If
146 you've built and installed a system with the new toolchain up to this
147 point you do not have a working awk as its ability to do floating
148 point is broken.
149
150 To build:
151
152 remake and install gnu/lib/libgcc
153 remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links
154 against the new libgcc.a)
155
156 20011128:
157 Kernel config information was changed to use defflag in
158 the various "files" files. Bug fixes to config(8) are
159 required in order for this to work properly. Make sure
160 to build and install in usr.sbin/config before attempting
161 to build a new kernel.
162
163 20011030:
164 libc/locale/wcstod.c now needs new lint(1). Update lint(1)
165 before building libc.
166
167 20011029:
168 The new document BUILDING.mdoc (view with nroff | more, or
169 see pre-generated .txt and .html versions) describes the build
170 procedure in great detail. BUILDING, and the USE_NEW_TOOLCHAIN
171 build process, are intended in the long run to replace this
172 manual update log.
173
174 Users building a USE_NEW_TOOLCHAIN system should read the
175 BUILDING document for caveats. Generally, BUILDING supersedes
176 UPDATING for these systems, as tool updating is taken care of
177 by the new build system.
178
179 20011028:
180 src/etc/Makefile now needs install to be able to handle
181 symlinks that point to nowhere. A bug in install that
182 prevented this was corrected.
183
184 Solution: update and reinstall usr.bin/xinstall
185 Better Solution: Use the new toolchain and it will just work
186 for you.
187
188 20011006:
189 /etc/mtree/NetBSD.dist has been updated to take advantage of
190 absolute path support added to mtree(8). Older mtree(8)s don't
191 understand the format.
192
193 Solution: update and reinstall usr.sbin/mtree
194
195 20011004:
196 Crunchgen has been updated to work via reach-over makefiles. Updating
197 is suggested before running a snapshot build
198
199 20010915:
200 The new "ubcperf" code committed by Chuck Silvers removed
201 a header file, uvm/uvm_vnode.h. There may be stale .depend
202 files that still reference this file.
203
204 Solution: "make cleandir && make dependall" in affected
205 directories.
206
207 20010803:
208 grep.info is now built from grep.texi using makeinfo. Since it
209 requires makeinfo v4.0, you need to install new texinfo before
210 building gnu/usr.bin/grep. To install new texinfo, please follow
211 the instruction described in 20010726 entry.
212
213 20010803:
214 (i386 only): i386 kernel now uses new instructions like
215 `fxsave' which old gas doesn't understand. To build the
216 kernel successfully, you need to build and install a new toolchain,
217 (i.e., build.sh -t) or (temporarily) comment out "options I686_CPU"
218 from your kernel configuration until you rebuild your userland.
219 See 20011029 above and BUILDING file in this directory for more information.
220 [updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled]
221
222 20010731:
223 Bootloader update on ELF platforms. DDB in kernels from before
224 this will be unable to read symbol tables provided by newer
225 bootloaders.
226
227 20010726:
228 Texinfo was updated to 4.0. To avoid failures when trying to
229 build the included texinfo files, do:
230
231 cd src/gnu/usr.bin/texinfo
232 make MKINFO=no dependall install
233
234 20010718:
235 Enabled correct .init/.fini processing in crt0. The way this
236 was done was to change a -I directive to cc(1), which means
237 make(1) will have a stale dependency (it will be checking the
238 timestamp on the wrong "dot_init.h").
239
240 The symptom you will see is that new programs die with SIGSEGV
241 if you have a stale dependency.
242
243 Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
244 before starting your build.
245
246 20010628:
247 A construct was added to uvm_page.h that uncovered a bug
248 in lint(1). If you get a warning/error about a non-portable
249 bitfield, update your lint(1) before proceeding.
250
251 20010226:
252 Added named user/group to system. Need to hand add this in or builds
253 will break as mtree aborts early.
254
255 To work around add by hand:
256
257 named:*:14:
258
259 to /etc/group and add:
260
261 named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
262
263 to master.passwd (use vipw for instance if doing by hand).
264
265 Now a make build should progress.
266
267 20010219:
268 get/setprogname() added. Any hostprogs that may use this will need
269 to be bootstrapped manually until the host system is current.
270
271 Known problems: sys/arch/macppc/stand/fixcoff
272 usr.sbin/config (adding -DMAKE_BOOTSTRAP to
273 CFLAGS and rebuilding should work)
274 usr.sbin/mdsetimage - Build a static copy if
275 building a snapshot before fully bootstrapped.
276
277 20010204:
278 prepare the code to compile with stricter gcc flags. in
279 particular start eliminating redundant declarations. Yacc
280 needs to be installed before make build.
281
282 20010114:
283 introduce .if commands(target) in make(1). You need to
284 bring everything up-to-date first, then without installing
285 anything make and install in usr.bin/make, then proceed
286 with make build.
287
288 20010101:
289 bsd.subdir.mk committed 20001230 had a bug which caused
290 afterinstall targets to run too soon; update again.
291
292 20001230:
293 New share/mk files needed to support .WAIT in SUBDIR variables.
294 If you get make errors,
295 (cd share/mk; make install)
296 Also, PRINTOBJDIR has changed and is now used more heavily.
297
298 20001019:
299 The `ca' device driver has been replaced by `ld'; although the
300 major and minor numbers haven't changed, you should update your /dev
301 directory.
302
303 20000929:
304 The following make directives are obsoleted.
305 MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA
306 By default, RSA is built into libcrypto. IDEA and RC5 will not be
307 built into libcrypto. By using MKCRYPTO_{RC5,IDEA}, you can build
308 additional library libcrypto_{idea,rc5}.
309
310
311 Hints for a more successful build:
312 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
313 Build a new kernel first:
314 This makes sure that any new system calls or features
315 expected by the new userland will be present. This
316 helps to avoid critical errors when upgrading.
317 Use object directories:
318 This helps to keep stale object
319 files from polluting the build if a Makefile "forgets"
320 about one. It also makes it easier to clean up after
321 a build. It's also necessary if you want to use the
322 same source tree for multiple machines.
323 To use object directories:
324 a) cd /usr/src ; make cleandir
325 b) Add "OBJMACHINE=yes" to /etc/mk.conf
326 c) Add "MKOBJDIRS=yes" to /etc/mk.conf
327 d) cd /usr/src ; make build
328 Note that running "make obj" in a directory will create
329 in obj.$MACHINE directory.
330 Build to a DESTDIR:
331 This helps to keep old
332 installed files (especially libraries) from interfering
333 with the new build.
334 To build to a DESTDIR, set the DESTDIR environment
335 variable before running make build. It should be set to
336 the pathname of an initially empty directory.
337 Problems: you might need to update critical utilities
338 without using DESTDIR since nothing is executed
339 from what is installed in DESTDIR.
340 (See critical utils, below)
341 Build often:
342 This keeps critical utilities current enough to not choke
343 on any other part of the source tree that depends on up to
344 date functionality.
345
346 What to do if things don't work:
347 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
348 When things don't work there is usually a few things that commonly
349 should be done.
350 1) make includes
351 This should be done automatically by make build.
352 2) cd share/mk && make install
353 Again, automatically done by make build.
354
355 Failsafe rebuild of a small part of the tree:
356 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
357 To make sure you rebuild something correctly you want to do
358 something like the following:
359 1) Make sure the includes and .mk files are up to date.
360 2) Make sure any program used to build the particular
361 utility is up to date. (yacc, lex, etc...)
362 3) cd ...path/to/util...
363 make cleandir
364 rm ...all obj directories...
365 make cleandir # yes, again
366 make obj
367 make depend && make
368
369 Failsafe rebuild of the entire tree:
370 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
371 If you really want to make sure the source tree is clean and
372 ready for a build try the following. Note that sourcing /etc/mk.conf
373 (a make(1) Makefile) in this manner is not right, and will not work
374 for anyone who uses any make(1) features in /etc/mk.conf.
375
376 ---cut here---
377 #!/bin/sh
378 . /etc/mk.conf
379
380 if [ -z $NETBSDSRCDIR ] ; then
381 NETBSDSRCDIR=/usr/src
382 fi
383 if [ \! -d $NETBSDSRCDIR ] ; then
384 echo Unable to find sources
385 exit 1
386 fi
387 find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
388
389 if [ -z $BSDOBJDIR ] ; then
390 BSDOBJDIR=/usr/obj
391 fi
392 if [ -d $BSDOBJDIR ] ; then
393 rm -rf $BSDOBJDIR
394 fi
395
396 cd $NETBSDSRCDIR && make cleandir
397
398 ---cut here---
399
400 Critical utilities:
401 ^^^^^^^^^^^^^^^^^^^
402 gnu/usr.bin/egcs
403 usr.bin/compile_et
404 usr.bin/make
405 usr.bin/yacc
406 usr.bin/lex
407 usr.bin/xlint
408 usr.sbin/config
409
410 Other problems and possible solutions:
411 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
412 Symptom:Unreasonable compiler errors.
413 Fix: Rebuild gnu/usr.bin/egcs
414
415 Symptom:Complaints involving a Makefile.
416 Fix: Rebuild usr.bin/make:
417 cd usr.bin/make && make && make install
418 Or, a failsafe method if that doesn't work:
419 cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
420
421 Fix: Make sure .mk files are up to date.
422 cd share/mk && make install
423
424 Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
425 Fix: Rebuild usr.sbin/config
426
427 Symptom:
428 Fix: Rebuild usr.bin/yacc
429
430 Symptom:
431 Fix: Rebuild usr.bin/lex
432
433 Symptom:
434 Fix: rm /usr/lib/libbfd.a
435
436 Symptom:Obsolete intermediate files are used during compilation
437 Fix: Try the following sequence of commands in the directory in question.
438 make cleandir; rm `make print-objdir`; make cleandir; make obj
439 (If you built the tree without "make obj" in the past, obsolete files
440 may remain. The command tries to clean everything up)
441
442 Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
443 Fix: Rebuild and install usr.bin/menuc
444
445 Symptom:mklocale not found during build in share/locale/ctype
446 Fix: Build and install usr.bin/mklocale
447
448 Symptom:undefined reference to `__assert13'
449 Fix: Rebuild and install lib/libc
450
451 Symptom:usr.sbin/config fails to build.
452 Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
453
454 Symptom:undefined reference to `getprogname' or `setprogname'
455 Fix: Rebuild and install lib/libc
456
457 Symptom:lint does not understand the '-X' option
458 Fix: May need to build & install libs with NOLINT=1 before rebuilding lint
459