UPDATING revision 1.75
1$NetBSD: UPDATING,v 1.75 2002/11/21 18:05:59 thorpej Exp $
2
3This file is intended to be a brief introduction to the build
4process and a reference on what to do if something doesn't work.
5
6For a more detailed description see Makefile.
7
8Recent changes:
9^^^^^^^^^^^^^^^
10
1120021121:
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@netbsd.org.
40
4120021011:
42	Systrace has been improved to support privilege elevation.
43	Updating the kernel requires the userland part of systrace
44	to be rebuild.
45
4620021010:
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
5220021009:
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
5820021003:
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
6320021001:
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
7120020922:
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
8120020917:
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
9120020906:
92	gehenna-devsw has been merged into the trunk. Need to update and
93	reinstall usr.sbin/config before build the kernel.
94
9520020822:
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
10320020820:
104	crunchgen(1) changed to ensure that the generated program
105	is statically linked.
106
107	Solution: update and reinstall usr.bin/crunch
108
10920020515:
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
12420020426:
125	NBUILDJOBS obsoleted in favor of just using -j.
126
12720020426:
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
13420020320:
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
13820020319:
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
14320020311:
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
14820020223:
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
15320020118:
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
16620011207:
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
18220011201:
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
19420011128:
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
20120011030:
202	libc/locale/wcstod.c now needs new lint(1). Update lint(1)
203	before building libc.
204
20520011029:
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
21720011028:
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
22620011006:
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
23320011004:
234	Crunchgen has been updated to work via reach-over makefiles. Updating
235	is suggested before running a snapshot build
236
23720010915:
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
24520010803:
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
25120010803: 
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
26020010731:
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
26520010726:
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
27220010718:
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
28420010628:
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
28920010226:
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
30520010219:
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
31520010204:
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
32020010114:
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
32620010101:
327	bsd.subdir.mk committed 20001230 had a bug which caused
328	afterinstall targets to run too soon; update again.
329
33020001230:
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
33620001019:
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
34120000929:
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
349Hints 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 
384What to do if things don't work:
385^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
386When things don't work there is usually a few things that commonly
387should 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
393Failsafe rebuild of a small part of the tree:
394^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
395To make sure you rebuild something correctly you want to do
396something 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
407Failsafe rebuild of the entire tree:
408^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
409If you really want to make sure the source tree is clean and
410ready 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
412for anyone who uses any make(1) features in /etc/mk.conf.
413
414---cut here---
415#!/bin/sh
416. /etc/mk.conf
417
418if [ -z $NETBSDSRCDIR ] ; then
419    NETBSDSRCDIR=/usr/src
420fi
421if [ \! -d $NETBSDSRCDIR ] ; then
422    echo Unable to find sources
423    exit 1
424fi
425find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
426
427if [ -z $BSDOBJDIR ] ; then
428    BSDOBJDIR=/usr/obj
429fi
430if [ -d $BSDOBJDIR ] ; then
431    rm -rf $BSDOBJDIR
432fi
433
434cd $NETBSDSRCDIR && make cleandir
435
436---cut here---
437
438Critical 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
448Other problems and possible solutions:
449^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
450Symptom:Unreasonable compiler errors.
451Fix:	Rebuild gnu/usr.bin/egcs
452
453Symptom:Complaints involving a Makefile.
454Fix:	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
459Fix:	Make sure .mk files are up to date.
460	cd share/mk && make install
461
462Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
463Fix:	Rebuild usr.sbin/config
464
465Symptom:
466Fix:	Rebuild usr.bin/yacc
467
468Symptom:
469Fix:	Rebuild usr.bin/lex
470
471Symptom:
472Fix:	rm /usr/lib/libbfd.a
473
474Symptom:Obsolete intermediate files are used during compilation
475Fix:	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
480Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
481Fix:	Rebuild and install usr.bin/menuc
482
483Symptom:mklocale not found during build in share/locale/ctype
484Fix:	Build and install usr.bin/mklocale
485
486Symptom:undefined reference to `__assert13'
487Fix:    Rebuild and install lib/libc
488
489Symptom:usr.sbin/config fails to build.
490Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
491
492Symptom:undefined reference to `getprogname' or `setprogname'
493Fix:    Rebuild and install lib/libc
494
495Symptom:lint does not understand the '-X' option
496Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
497