UPDATING revision 1.157
1$NetBSD: UPDATING,v 1.157 2007/02/27 13:42:35 apb Exp $
2
3This file (UPDATING) is intended to be a brief reference to recent
4changes that might cause problems in the build process, and a guide for
5what to do if something doesn't work.
6
7For a more detailed description of the recommended way to build NetBSD
8using build.sh, see the BUILDING file.
9
10Note that much of the advice in this UPDATING file was written before
11build.sh existed.  Nevertheless, the advice here may be useful for
12working around specific problems with build.sh.
13
14See also: BUILDING, build.sh, Makefile.
15
16Recent changes:
17^^^^^^^^^^^^^^^
18
1920070209:
20        The threading model was changed when the newlock2 branch
21        was merged to NetBSD-current.  If you boot with a new
22        kernel (version 4.99.10), then you also need a new pthread
23        library (/usr/lib/libpthread.so.0.7).  If you boot with
24        an old kernel, then you need the old pthread library
25        (/usr/lib/libpthread.so.0.6).  Provided you keep the kernel and
26        the pthread library in sync, old threaded applications should
27        continue to work with an old or new kernel.  Note that named(8)
28	is the only threaded application in the base system.
29
3020061214:
31	Following the move of string_to_flags() and flags_to_string()
32	from the bin/ls/ sources to libutil, users doing UPDATE builds
33	will need to do a "make cleandir" in
34		tools/mtree/, tools/makefs/, tools/binstall/, tools/pax/,
35		bin/pax/, bin/ls/, usr.sbin/mtree/, usr.sbin/makefs/,
36		usr.bin/xinstall/, libexec/ftpd/, rescue/, as well
37		as the installation images in distrib/
38	in order to excise stale references to the old stat_flags.h header
39	file in the ls sources -- stat_flags.h has been removed.
40
4120061108:
42	The configure script used in the src/tools/gcc compiler has been
43	changed to indicate that our libc has ssp support built-in and
44	does not depend on -lssp and -lssp-nonshared. You'll need to
45	make clean in src/tools/gcc first to rebuild the compiler.
46
4720061009:
48	The sysctl variables net.inet{,6}.tcp{,6}.newreno are no longer
49	available. Use net.inet{,6}.tcp{,6}.congctl.selected instead.
50
5120060814:
52	The vt, vidcconsole, kbd, and rpckbd drivers on acorn32 have been
53	withdrawn.  Use vidcvideo and pckbd instead.  See the GENERIC
54	kernel configuration for an example.  X servers from the last
55	few years should cope.
56
5720060703:
58	MPACPI is no more. We always configure PCI interrupts using ACPI
59	if we have an ACPI kernel. The option MPACPI_SCANPCI has been renamed
60	to ACPI_SCANPCI. Thanks to work from fvdl.
61
6220060627:
63	socket(2) has changed, and its system call has been versioned.
64	For userlands with the old version of socket(2), make sure that
65	your kernel has 'options COMPAT_30' set, or else 'bad system call'
66	errors will result.
67
6820060526:
69	The kernel linker scripts for i386 and xen 
70	(sys/arch/i386/conf/kern.ldscript*) were changed to set the
71	load address correctly, for the benefit of MULTIBOOT boot loaders
72	(like Grub). If you use a linker (ld) older than from 2006/04/17, it
73	will be unable to link the kernel because of a bug and ld will fail
74	with an error like:
75	    ../../../../arch/i386/conf/kern.ldscript:45 \
76		non constant expression for load base
77	You need to update at least src/gnu/dist/binutils/ld and recompile
78	and install the linker. If using the build.sh script, the easiest
79	way is with a "build.sh tools" command, with any other options
80	that you use normally. When using build.sh, the linker binary is
81	installed as ${TOOLDIR}/bin/i386--netbsdelf-ld.
82
8320060131:
84	the protocol between the sparc64 bootloader (ofwboot) and
85	the kernel was changed. Before installing a new kernel,
86	you need to update ofwboot. After a full build, just copy
87	/usr/mdec/ofwboot to /, or do a rebuild of
88	src/sys/arch/sparc/stand/ofwboot and install the result to /.
89
9020050917:
91	arch/*/conf/std.* was changed to include conf/std, which
92	contains MI options previously enabled by default.
93	If you have kernel config files which doesn't include
94	arch/*/conf/std.*, you need to edit them to include conf/std
95	to get the previous configuration.
96
9720050830:
98	named.conf was moved from /etc/namedb to /etc.
99	postinstall(8) migrates this during interactive use.
100	Users of MKUPDATE=yes will need to manually rectify
101	this in their DESTDIR.
102
10320050825:
104	Some data structures in sys/device.h, related to interface
105	attributes and locator names, were changed. config(1) was
106	modified to emit the new data structures.
107	Thus usr.bin/config must be updated (and run on the kernel
108	configuration file) before a new kernel can be built.
109
11020050531:
111	genassym.sh(8) was moved to genassym(1). You need to either build
112	tools first or install the version of genassym from /usr/bin before
113	you can build a kernel again.
114
11520050520:
116	Because a kernfs bug which xentools relies on was fixed,
117	xentools up to xentools20-2.0.3nb4 won't work with new kernel.
118
11920050417:
120	postinstall(8) was moved from /etc to /usr/sbin and made part
121	of the "base" set, to make it easier to invoke after an
122	upgrade.
123
12420050325:
125	pcppi(4) was separated in two devices, adding attimer(4).  Be sure
126	to add a config line for an attimer(4) device in your kernel
127	configuration, or you won't be able to set the pitch of the beep
128	with wsconsctl.  Depending on the default value for the pitch, you
129	might even not hear any more beep.  Also, it is advised to attach both
130	devices the same way (i.e., both on isa or both on acpi) or the
131	pcppi(4) device may fail to find the attimer(4) one.
132
13320050211:
134	Fixes to tools/Makefile.gnuhost may cause UPDATE=1 builds in
135	some of the cross tools to fail if they use configure. Some configure's
136	cache the environment passed in and notice the new environment is
137	different and abort. Doing a clean in tools/ should be enough to
138	make a build continue.
139
14020050109:
141	Since su is using pam by default now, make sure that you have
142	/etc/pam.d populated (postinstall will do that automatically
143	for you). Otherwise su will fail open (i.e. will not require
144	a password).
145
14620041229:
147	Make had a path resolution bug that manifested itself as not
148	being able to install openpam.3. This bug has been fixed, but
149	you might need to rebuild make manually first to get through
150	the build.
151
15220041201:
153	Userland programs have been changed to use /dev/bpf instead of
154	/dev/bpfX. You need to create that device by installing a new
155	MAKEDEV and running it, or mv /dev/bpf0 /dev/bpf && rm /dev/bpf[0-9]*
156
15720041006:
158
159	A bug was introduced into /bin/sh (var.c rev 1.35) which causes
160	variables to not export correctly to subshells in all cases. This
161	will cause builds to break if that version of /bin/sh is installed
162	on the system. The proper version of /bin/sh can be verified with:
163
164        ident /bin/sh | grep var
165
166	Any /bin/sh w. version 1.35 will not work and needs to be updated
167	before attempting a build.
168	
16920041001:
170	The ipfilter kernel sources moved from sys/netinet to
171	dist/sys/ipf/netinet. Due to the move some Makefile
172	dependencies are now dangling requiring a make cleandir
173	before they work again (kdump, ktruss, rescue, ipf, and
174	ftp-proxy are the victims).
175
17620040715:
177	The rc.d/sendmail script now uses a heuristic to determine
178	if sendmail should be started at boot time.  It checks the
179	contents of /etc/mailer.conf, /etc/mail/submit.cf, and the
180	owner and mode of the sendmail binary to see if any changes
181	to the mail infrastructure have been made.  If no changes
182	are detected, it will start an SMTP listener.
183
184	Setting sendmail=NO in /etc/rc.conf will override this.
185
186	If you are only using sendmail by default and only for
187	local delivery, it is important that you also update your
188	sendmail.cf so that the SMTP listener only listens on the
189	loopback interface.
190
19120040715:
192	The method by which athhal-elf.o gets pulled into i386
193	kernel builds has been changed again.  The latest version
194	of bsd.files.mk is no longer required.
195
19620040621:
197	Due to the recent rototill of tools/compat it's crucial one starts
198	from a clean objdir under tools/*.
199
200	This is mostly due to generated files (yacc and lex sources) needing
201	to be generated with new rules from bsd.hostprog.mk.
202
203	The safest course is to rm -rf all objects under tools before building.
204
20520040516:
206	The end-user modifiable X11 configuration has been moved
207	from /usr/X11R6/lib/X11/<dir> to /etc/X11/<dir>.
208	Ensure that src and xsrc is up to date, and run
209	"make cleandir" in src/x11 before your next build.
210
211	postinstall currently doesn't migrate the files from
212	/usr/X11R6/lib/X11/* to /etc/X11/* although it does
213	detect that this needs to occur, so you'll have to
214	manually move these files yourself.
215
21620040426:
217	Support for the original dynamic sysctl node structure has
218	been removed in favor of the newer layout.  This affects
219	consumers of the create and delete interface, as well as
220	the dynamic discovery mechanism.  This is believed only to
221	be the sysctl(8) binary itself, at this point in time, so
222	the only effect of this should be that a sysctl binary
223	built from sources dated between 2003/12/04 and 2004/03/24
224	will not work on a kernel built from sources dated after
225	2004/04/25.  If you need a new sysctl binary but build.sh
226	does not work, make sure that your revision of
227	src/sys/sys/sysctl.h is 1.112 (or later), and then the
228	do the following:
229
230	cd /usr/src (or wherever your source tree is)
231	make USETOOLS=no includes
232	cd lib/libc
233	make USETOOLS=no dependall install
234	cd ../../sbin/sysctl
235	make USETOOLS=no dependall install
236
237	If you are using older sysctl binary, GNU autoconf would fail to
238	identify your machine architecture, and tries to build binary for
239	"unknown-unknown-netbsd20F" or something like that.  if that happens,
240	make sure to follow the above steps.
241
24220040425:
243	The ffs superblock issues listed below under 20040109 and 20030402
244	are now automatically addressed by the /etc/rc.d/fixsb script or by
245	sysinst when it checks a a filesystem. The manual fsck_ffs -b16 -c4
246	invocation mentioned below will continue to work and is now
247	automated by those scripts.  Note that under certain circumstances,
248	affected filesystems upgraded to a -current kernel first before
249	upgrading their userland with the fixsb and fsck_ffs fixes may
250	encounter a 'freeing free inode' panic when writing to the affected
251	filesystem, so it is a good idea to repair the filesystem as soon as
252	possible.  For more details on the fixsb script, see pr install/25138.
253
25420040418:
255	statfs(2) and friends have been replaced with statvfs(2). Before
256	installing a newly build userland make sure that you are running
257	a newly built kernel with COMPAT_20 set. In addition your libc
258	build might not work (undefined SYS_statfs symbol) because make
259	clean does not know how to remove files it does not know about
260	anymore. Manually remove all generated .S sources and objects
261	from the libc build directory.
262
26320040326:
264	The method by which athhal-elf.o gets pulled into i386 kernel builds
265	has been changed. The file is now stored as a uuencoded file in CVS
266	and the generated Makefile will use the new .uue rules from bsd.file.mk
267	to build it.
268
269	This means you must have the latest bsd.files.mk installed when
270	building a kernel without USETOOLS=yes.
271
27220040318:
273	A bug in the cgd(4) blowfish code was corrected, without
274	provision of backwards compatibility, after several public
275	notices over several months. Users of cgd with blowfish cipher
276	ONLY must dump their data before updating their kernels, and
277	recreate cgd's and restore data using the new kernel. See
278	(recent message to current-users, URL when mail-index has updated)
279
28020040313:
281	On acorn32, the opms and qms drivers have been withdrawn, and
282	the old wsqms driver is now called qms.  Kernel config files
283	will need updating.  See the ones in sys/arch/acorn32/conf
284	for examples.
285
28620040125:
287	On acorn32, the beep and sysbeep devices are no longer
288	needed, and will need to be deleted from kernel configuration
289	files.
290
29120040109:
292	Compatibility for old ffs superblock layouts has been
293	added, and the restrictive fsck checks have been reenabled
294	when using those layouts.  If you have been using -current
295	since 20030402, you may find that fsck again signals fatal
296	superblock mismatches.  To repair, make sure you have
297	an updated fsck_ffs and then you can use fsck_ffs -b 16 -c 4
298	to complete the filesystem upgrade.  A message has
299	been added to the kernel which should detect this problem.
300	See the following discussion for more information:
301	http://mail-index.NetBSD.org/current-users/2004/01/11/0022.html
302
30320031203:
304	New binutils builds may fail due to old dependencies.
305	It's necessary to "make cleandir" to ensure that
306	the dependencies will be rebuilt correctly.
307
30820031111:
309	A newer mkdep is needed.  Error noting that is
310		cc: Ambiguous abbreviation --
311
31220031008:
313	/usr/include/sys/disklabel_mbr.h was removed.
314	It's necessary to "make cleandir" to ensure that
315	the dependencies will be rebuilt correctly.
316
31720031007:
318	A sign extension bug was fixed which set all the high bits
319	of our newly expanded ffs fs_flags.  This should only
320	affect users who installed or upgraded in September of 2003.
321	A small utility program was posted to tech-kern which
322	should fix this problem, and a warning message was added
323	to the kernel which should discover and warn about it.  See
324	http://mail-index.NetBSD.org/tech-kern/2003/10/07/0005.html
325
32620030906:
327	With the addition of siginfo support the old signal trampoline
328	code has been deprecated to COMPAT_16. Make sure that your running
329	kernel has COMPAT_16 enabled before building userland.
330
33120030801:
332	With the new openssl, there is some header and library shuffling.
333	rm -f /usr/include/des.h /usr/include/kerberosIV/* /lib/libdes* \
334	/usr/lib/libdes* before building.
335
33620030703:
337	Texinfo was updated to 4.6.  To avoid failures when trying to
338	build the included texinfo files, do:
339
340	cd src/gnu/usr.bin/texinfo
341	make MKINFO=no dependall install
342
34320030630:
344	Groff was updated to 1.19; it's probably necessary to do
345		cd share/mk && make install
346		cd src/gnu/usr.bin/groff
347		make MKMAN=no dependall install
348	(untested).
349
35020030516:
351	Due to bugs in the export handling code, invalid export lines
352	were accepted before and caused the kernel to panic when
353	mountd got restarted because it freed memory that had already
354	been freed. This has been fixed and the kernel checks
355	export addresses very strictly. If you upgrade your kernel,
356	make sure you also upgrade mountd, because if your export
357	file contains lines with an old inet4 address syntax (i.e.
358	a.b.c or a.b or a), they will get rejected by the new kernel.
359
36020030402:
361	The superblock layout for FFS was changed.  If you have 1.6
362	fsck binaries, they will signal a fatal superblock mismatch
363	with the first alternate, because they compare too many
364	fields (even ones that aren't useful).  If possible, upgrade
365	your fsck_ffs binary before using a new kernel.
366	None of this signals actual filesystem damage.
367
36820030324:
369	sendmail version 8.12.8 was imported.  Since sendmail is
370	now setgid to the smmsp group, and runs in "collection"
371	mode for most common activities, there is a new config
372	file called submit.cf that needs to live in /etc/mail.
373	The generic submit.cf sample in /usr/share/sendmail/cf
374	is named netbsd-msp.cf.  Upgrading your regular sendmail
375	configuration file is also strongly advised.
376
377	See the section named "MESSAGE SUBMISSION PROGRAM" in
378	the updated /usr/share/sendmail/README file for more
379	information.
380
38120030117:
382	Texinfo was updated to 4.3.  To avoid failures when trying to
383	build the included texinfo files, do:
384
385	cd src/gnu/usr.bin/texinfo
386	make MKINFO=no dependall install
387
38820021223:
389	The METALOG format changed slightly, to remove the leading
390	"${DESTDIR}" from path names.
391	This only affects people building with UNPRIVED.
392	For complete safety, remove the DESTDIR entirely and
393	update tools/mtree, before running make build.
394
39520021219:
396	CVS repository layout was changed.  See the following for details
397	if you are using (anonymous) cvs to update your tree.
398
399	http://mail-index.NetBSD.org/netbsd-announce/2002/12/19/0000.html
400
40120021219:
402	install(1) had a '-N dbdir' option added, to specify an
403	alternate location to look up users & groups (instead
404	of the host system passwd(5) and group(5) databases).
405
406	The build system was modified to take advantage of
407	this option (using ${NETBSDSRCDIR}/etc), so if you
408	use USETOOLS==no, you may have to rebuild and
409	reinstall usr.bin/xinstall first.
410
41120021130:
412	fparseln(3) moved from libutil to libc.
413	If building to DESTDIR=/, reinstall the includes
414	and rebuild libc:
415		make includes
416		make do-lib-libc
417	If using build.sh, "cd tools/compat && make clean"
418	before rebuilding the tools.
419
42020021126:
421	The mk.conf(5) variable SYS_INCLUDE has been deprecated,
422	including the optional "SYS_INCLUDE=symlinks" support.
423	All header files, including <sys/*.h> are copied into
424	/usr/include.
425
42620021121:
427	The C run-time support files crtbegin.o and crtend.o
428	(and their companions crtbeginS.o and crtendS.o) were
429	split up, with new crti.o and crtn.o files resulting.
430	This means that libtool needs to be rebuilt once the
431	new libraries are installed.  The process of rebuilding
432	libtool will cause it to automatically notice the new
433	required files, but it *must* be rebuilt in order to
434	do this.
435
436	An out-of-date libtool will result in shared libraries
437	which lack _init() and _fini() routines, which means that
438	their global constructors/destructors will not be invoked.
439
44020021121:
441	A bug related to how ARM ELF objects were tagged has been
442	corrected.
443
444	NetBSD ARM ELF uses the soft-VFP floating point model by
445	default.  However, the assembler lacked support for marking
446	objects as using the VFP floating point format, and the
447	compiler was not properly passing the flag indicating "soft-VFP"
448	to the assembler.
449
450	Unfortunately, this means that the linker will now consider
451	old (i.e. not marked "softvfp") NetBSD ARM ELF objects to be
452	incompatible with new (properly marked) objects.
453
454	The problem will only manifest itself if you attempt to compile
455	a new program using the fixed toolchain, and link that program
456	against old libraries which do not have the proper "softvfp"
457	markings.  ALL OF YOUR EXISTING BINARIES AND SHARED LIBRARIES
458	WILL CONTINUE TO WORK PROPERLY.
459
460	The only work-around for the problem is to recompile all of
461	the libraries on the system.  The easiest way to do this for
462	system libraries is to install a binary snapshot; they are
463	generally available on releng.NetBSD.org.  Any packages you
464	have installed which supply libraries will have to be recompiled
465	if you wish to link new programs against those libraries.
466
467	If you have questions about this matter, please contact
468	port-arm@NetBSD.org.
469
47020021011:
471	Systrace has been improved to support privilege elevation.
472	Updating the kernel requires the userland part of systrace
473	to be rebuilt.
474
47520021010:
476	The config(8) grammar was changed to allow options to register
477	dependencies on attributes, as well as other options.  Users
478	must update and reinstall usr.sbin/config before building a new
479	kernel.
480
48120021009:
482	A new attribute dependency syntax was introduced to config(8),
483	which is now used by the SCSI configuration description.  Users
484	must update and reinstall usr.sbin/config before building a new
485	kernel.
486
48720021003:
488	Several changes have been made to the autoconfiguration
489	framework.  Users must update and reinstall usr.sbin/config
490	before building a new kernel.
491
49220021001:
493	The i386mp branch has been merged.  To compile a kernel, users
494	will need to add the option 'cpu* at mainbus?' to their configuration
495	file.  Multiprocessor kernels will need
496	ioapic*		at mainbus? apid ?
497	options		MULTIPROCESSOR
498	options		COM_MPLOCK
499
50020020922:
501	MKDYNAMICROOT=yes enabled by default, which means that
502	certain shared libraries are installed into /lib, the shared
503	linker is installed into /libexec, and all programs in /bin
504	and /sbin are dynamically linked.
505	If you do not use "make build", you should ensure that
506	you have the libraries and shared linker in the new locations,
507	with:
508		make do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.elf_so
509
51020020917:
511	USE_NEW_TOOLCHAIN has been replaced with:
512	    -	TOOLCHAIN_MISSING -- set to "yes" on platforms for which
513		there is no working in-tree toolchain (hppa, ns32k, sh5,
514		x86_64).
515	    -	EXTERNAL_TOOLCHAIN -- if defined by the user, points to the
516		root of an external toolchain (e.g. /usr/local/gnu).  This
517		enables the cross-build framework even for TOOLCHAIN_MISSING
518		platforms.
519
52020020906:
521	gehenna-devsw has been merged into the trunk. Need to update and
522	reinstall usr.sbin/config before building the kernel.
523
52420020822:
525	Crunched rescue tools (contents of /bin and /sbin, plus others)
526	are now provided in /rescue.
527
528	To ensure that these are built statically linked (no matter
529	what the setting of LDSTATIC is), use a crunchgen(1) built
530	from sources newer than 20020820 (see the next entry).
531
53220020820:
533	crunchgen(1) changed to ensure that the generated program
534	is statically linked.
535
536	Solution: update and reinstall usr.bin/crunch
537
53820020605:
539	smmsp user/group has been added for sendmail.
540
541	Add the following into /etc/group:
542
543	smmsp:*:17:
544
545	and the following to /etc/master.passwd (via vipw):
546
547	smmsp:*:17:17::0:0:Sendmail Message Submission Program:/nonexistent:/sbin/nologin
548
54920020515:
550	sshd user/group has been added.  Need to hand add this in, or sshd
551	will not let you log in (with default, or UsePrivilegeSeparation=yes)
552
553	Add the following into /etc/group:
554
555	sshd:*:16:
556
557	and the following to /etc/master.passwd (via vipw):
558
559	sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin
560	
561	Also /var/chroot/sshd directory needs to be present (digged as part of
562	the build process).
563
56420020426:
565	NBUILDJOBS obsoleted in favor of just using -j.
566
56720020426:
568	etc/postinstall added, which performs various checks for 
569	configuration file updates and changes, and can fix most of
570	the problems identified.
571	This should make it much easier to upgrade a system's
572	configuration from earlier systems (as far back as NetBSD 1.5).
573
57420020320:
575	<bsd.lib.mk> needs a new install(1) for its "-a cmd" support.
576	Build and install at usr.bin/xinstall before the build.
577
57820020319:
579	Raw IPv6 socket now makes strict checking for sa_family and sa_len
580	on send(2) operation.  Be sure to have sbin/rtsol and usr.sbin/rtsold
581	newer than November 2001 when you upgrade the kernel.
582
58320020311:
584	ssh configuration files were moved from /etc to /etc/ssh.  Beware
585	if you restart your machine from remote.  Note that sshd.conf needs
586	to be changed (due to the use of "/etc" inside).
587
58820020223:
589	Users of the VAX port will need to rebuild and install gas
590	so it deal with the now present register prefix used in all
591	the VAX assembly files.
592
59320020118:
594	ntpd user/group has been added.  Need to hand add this in or builds
595	will break as mtree aborts early.
596
597	Add the following into /etc/group:
598
599	ntpd:*:15:
600
601	and the following to /etc/master.passwd (via vipw):
602
603	ntpd:*:15:15::0:0:Ntpd pseudo-user:/var/chroot/ntpd:/sbin/nologin
604
60520011207:
606	If you're attempting to build a snapshot on sparc64 and are getting
607	reloc errors from the toolchain groff binary this means your native
608	toolchain has some broken C++ bits.
609
610	To fix:
611
612	Build a new toolchain (i.e. build.sh -t)
613	Use the new toolchain to build and install natively (i.e. /usr/lib)
614
615	gnu/lib/libgcc
616	gnu/lib/libstdc++
617
618	After this a snapshot will be able to be built.
619
62020011201:
621	In order for a sparc64 build to work you must have a working awk. If
622	you've built and installed a system with the new toolchain up to this
623	point you do not have a working awk as its ability to do floating
624	point is broken. 
625
626	To build:
627
628	remake and install gnu/lib/libgcc
629	remake and install gnu/usr.bin/gawk into /usr/bin (make sure it links
630	against the new libgcc.a)
631
63220011128:
633	Kernel config information was changed to use defflag in
634	the various "files" files.  Bug fixes to config(8) are
635	required in order for this to work properly.  Make sure
636	to build and install in usr.sbin/config before attempting
637	to build a new kernel.
638
63920011030:
640	libc/locale/wcstod.c now needs new lint(1). Update lint(1)
641	before building libc.
642
64320011029:
644	The new document BUILDING.mdoc (view with nroff | more, or
645	see pre-generated .txt and .html versions) describes the build
646	procedure in great detail.  BUILDING, and the USE_NEW_TOOLCHAIN
647	build process, are intended in the long run to replace this
648	manual update log.
649
650	Users building a USE_NEW_TOOLCHAIN system should read the
651	BUILDING document for caveats.  Generally, BUILDING supersedes
652	UPDATING for these systems, as tool updating is taken care of
653	by the new build system.
654
65520011028:
656	src/etc/Makefile now needs install to be able to handle
657	symlinks that point to nowhere. A bug in install that
658	prevented this was corrected.
659
660	Solution: update and reinstall usr.bin/xinstall
661	Better Solution: Use the new toolchain and it will just work
662	for you.
663
66420011006:
665	/etc/mtree/NetBSD.dist has been updated to take advantage of
666	absolute path support added to mtree(8). Older mtree(8)s don't
667	understand the format.
668
669	Solution: update and reinstall usr.sbin/mtree
670
67120011004:
672	Crunchgen has been updated to work via reach-over makefiles. Updating
673	is suggested before running a snapshot build
674
67520010915:
676	The new "ubcperf" code committed by Chuck Silvers removed
677	a header file, uvm/uvm_vnode.h.  There may be stale .depend
678	files that still reference this file.
679
680	Solution: "make cleandir && make dependall" in affected
681	directories.
682
68320010803:
684	grep.info is now built from grep.texi using makeinfo.  Since it
685	requires makeinfo v4.0, you need to install new texinfo before
686	building gnu/usr.bin/grep.  To install new texinfo, please follow
687	the instruction described in 20010726 entry.
688
68920010803: 
690	(i386 only): i386 kernel now uses new instructions like
691	`fxsave' which old gas doesn't understand.  To build the
692	kernel successfully, you need to build and install a new toolchain, 
693	(i.e., build.sh -t) or 	(temporarily) comment out "options I686_CPU" 
694	from your kernel configuration until you rebuild your userland.
695	See 20011029 above and BUILDING file in this directory for more information.
696	[updated 20020630 since i386 gas moved when USE_NEW_TOOLCHAIN enabled]
697
69820010731:
699	Bootloader update on ELF platforms.  DDB in kernels from before
700	this will be unable to read symbol tables provided by newer
701	bootloaders.
702
70320010726:
704	Texinfo was updated to 4.0.  To avoid failures when trying to
705	build the included texinfo files, do:
706
707	cd src/gnu/usr.bin/texinfo
708	make MKINFO=no dependall install
709
71020010718:
711	Enabled correct .init/.fini processing in crt0.  The way this
712	was done was to change a -I directive to cc(1), which means
713	make(1) will have a stale dependency (it will be checking the
714	timestamp on the wrong "dot_init.h").
715
716	The symptom you will see is that new programs die with SIGSEGV
717	if you have a stale dependency.
718
719	Solution: "make cleandir" in both lib/csu and libexec/ld.elf_so
720	before starting your build.
721
72220010628:
723	A construct was added to uvm_page.h that uncovered a bug
724	in lint(1).  If you get a warning/error about a non-portable
725	bitfield, update your lint(1) before proceeding.
726
72720010226:
728	Added named user/group to system. Need to hand add this in or builds
729	will break as mtree aborts early.
730
731	To work around add by hand:
732
733	named:*:14:
734
735	to /etc/group and add:
736
737	named:*:14:14::0:0:Named pseudo-user:/var/named:/sbin/nologin
738
739	to master.passwd (use vipw for instance if doing by hand).
740
741	Now a make build should progress.
742
74320010219:
744	get/setprogname() added. Any hostprogs that may use this will need
745	to be bootstrapped manually until the host system is current.
746
747	Known problems: sys/arch/macppc/stand/fixcoff
748			usr.sbin/config (adding -DMAKE_BOOTSTRAP to
749			  CFLAGS and rebuilding should work)
750			usr.sbin/mdsetimage - Build a static copy if
751			  building a snapshot before fully bootstrapped.
752
75320010204:
754	prepare the code to compile with stricter gcc flags. in
755	particular start eliminating redundant declarations. Yacc
756	needs to be installed before make build.
757
75820010114:
759	introduce .if commands(target) in make(1). You need to
760	bring everything up-to-date first, then without installing
761	anything make and install in usr.bin/make, then proceed
762	with make build.
763
76420010101:
765	bsd.subdir.mk committed 20001230 had a bug which caused
766	afterinstall targets to run too soon; update again.
767
76820001230:
769	New share/mk files needed to support .WAIT in SUBDIR variables.
770	If you get make errors, 
771		(cd share/mk; make install)
772	Also, PRINTOBJDIR has changed and is now used more heavily.
773
77420001019:
775	The `ca' device driver has been replaced by `ld'; although the
776	major and minor numbers haven't changed, you should update your /dev
777	directory.
778
77920000929:
780	The following make directives are obsoleted.
781	MKCRYPTO_RSA NOCRYPTO_RSA NOCRYPTO_RC5 NOCRYPTO_IDEA 
782	By default, RSA is built into libcrypto.  IDEA and RC5 will not be
783	built into libcrypto.  By using MKCRYPTO_{RC5,IDEA}, you can build
784	additional library libcrypto_{idea,rc5}.
785
786
787Hints for a more successful build:
788^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
789    Use build.sh, but do not use its "expert mode":
790	This will automatically build the tools in the
791	   correct order, and it will keep the tools and the
792	   new build products from interfering with the running
793	   system.  This will allow you to ignore most of the
794	   other advice in this file.
795    Build a new kernel first:
796	This makes sure that any new system calls or features
797	   expected by the new userland will be present.  This
798	   helps to avoid critical errors when upgrading.
799    Use object directories:
800	This helps to keep stale object
801	   files from polluting the build if a Makefile "forgets"
802	   about one.  It also makes it easier to clean up after
803	   a build.  It's also necessary if you want to use the
804	   same source tree for multiple machines.
805	   To use object directories with build.sh:
806	    a) invoke build.sh with the "-M" or "-O" options.
807	   To use object directories without using build.sh:
808	    a) cd /usr/src ; make cleandir
809	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
810	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
811	    d) cd /usr/src ; make build
812	   Note that running "make obj" in a directory will create
813	   in obj.$MACHINE directory.
814    Build to a DESTDIR:
815	This helps to keep old installed files (especially libraries)
816	   from interfering with the new build.
817	   To build to a DESTDIR with build.sh, use the "-D" option.
818	   To build to a DESTDIR without using build.sh, set the DESTDIR
819	   environment variable before running make build.  It should be
820	   set to the pathname of an initially empty directory.
821	   Problems: if you do not use build.sh, you might need to
822		update critical utilities without using DESTDIR since
823		nothing is executed from what is installed in DESTDIR.
824		(See critical utils, below.)
825    Build often:
826	This keeps critical utilities current enough to not choke
827	on any other part of the source tree that depends on up to
828	date functionality.  If you use build.sh, you should not have
829	this problem.
830 
831What to do if things don't work:
832^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
833When things don't work there is usually a few things that commonly
834should be done.
835    1)	make includes
836	This should be done automatically by make build.
837    2)  cd share/mk && make install
838	Again, automatically done by make build.
839
840Failsafe rebuild of a small part of the tree:
841^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
842To make sure you rebuild something correctly you want to do
843something like the following:
844    1)  Make sure the includes and .mk files are up to date.
845    2)  Make sure any program used to build the particular
846	utility is up to date.  (yacc, lex, etc...)
847    3)  cd ...path/to/util...
848	make cleandir
849	rm ...all obj directories...
850	make cleandir			# yes, again
851	make obj
852	make depend && make
853
854Failsafe rebuild of the entire tree:
855^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
856If you really want to make sure the source tree is clean and
857ready for a build try the following.  Note that sourcing /etc/mk.conf
858(a make(1) Makefile) in this manner is not right, and will not work
859for anyone who uses any make(1) features in /etc/mk.conf.
860
861---cut here---
862#!/bin/sh
863. /etc/mk.conf
864
865if [ -z $NETBSDSRCDIR ] ; then
866    NETBSDSRCDIR=/usr/src
867fi
868if [ \! -d $NETBSDSRCDIR ] ; then
869    echo Unable to find sources
870    exit 1
871fi
872find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
873
874if [ -z $BSDOBJDIR ] ; then
875    BSDOBJDIR=/usr/obj
876fi
877if [ -d $BSDOBJDIR ] ; then
878    rm -rf $BSDOBJDIR
879fi
880
881cd $NETBSDSRCDIR && make cleandir
882
883---cut here---
884
885Critical utilities:
886^^^^^^^^^^^^^^^^^^^
887	usr.bin/compile_et
888	usr.bin/make
889	usr.bin/yacc
890	usr.bin/lex
891	usr.bin/xlint
892	usr.bin/config
893
894Other problems and possible solutions:
895^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
896Symptom:Complaints involving a Makefile.
897Fix:	Rebuild usr.bin/make:
898	cd usr.bin/make && make && make install
899	Or, a failsafe method if that doesn't work:
900	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
901
902Fix:	Make sure .mk files are up to date.
903	cd share/mk && make install
904
905Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
906Fix:	Rebuild usr.bin/config
907
908Symptom:
909Fix:	Rebuild usr.bin/yacc
910
911Symptom:
912Fix:	Rebuild usr.bin/lex
913
914Symptom:
915Fix:	rm /usr/lib/libbfd.a
916
917Symptom:Obsolete intermediate files are used during compilation
918Fix:	Try the following sequence of commands in the directory in question.
919	make cleandir; rm `make print-objdir`; make cleandir; make obj
920	(If you built the tree without "make obj" in the past, obsolete files
921	may remain.  The command tries to clean everything up)
922
923Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
924Fix:	Rebuild and install usr.bin/menuc
925
926Symptom:mklocale not found during build in share/locale/ctype
927Fix:	Build and install usr.bin/mklocale
928
929Symptom:undefined reference to `__assert13' or `__unsetenv13'
930Fix:    Rebuild and install lib/libc
931
932Symptom:usr.bin/config fails to build.
933Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
934
935Symptom:undefined reference to `getprogname' or `setprogname'
936Fix:    Rebuild and install lib/libc
937
938Symptom:lint does not understand the '-X' option
939Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
940