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