UPDATING revision 1.168
1$NetBSD: UPDATING,v 1.168 2007/12/17 14:38:40 joerg 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
1920071209:
20	The acpiec(4) driver has been split into two attachments. If you
21	get ACPI errors before the attachment, please update your kernel
22	configuration file appropiately or see GENERIC for more details.
23
2420071115:
25	The it(4) driver has been renamed to itesio(4) and the old port
26	argument specified in the kernel configuration file is not valid
27	anymore. The itesio(4) driver now uses the Super I/O address port
28	rather than the EC address port. Please update your kernel
29	configuration file appropriately or see GENERIC for more details.
30
3120071028:
32	The pccons(4) driver has been removed from the NetBSD/shark port.
33	You need to update any custom kernel configuration file you have
34	to remove any references to pccons (which includes removing the
35	now useless XSERVER option) and replace them with the correct
36	entries for the wscons driver.  See the GENERIC configuration file
37	for more details.
38
3920070913:
40	A latent bug in dhclient/dhcpd that caused it to be unable to
41	enumerate interfaces was fixed.  The bug began to cause
42	problems after 20070911 when the kernel's SIOCGIFCONF
43	implementation was repaired.  From 20070529 to 20070911 racoon
44	could not enumerate interfaces.  (These are noted because
45	normal kernel/userspace version matching hygiene is not
46	sufficient to avoid this problem.)  Ensure that both kernel
47	and userland are from after 20070913.
48
4920070703:
50	nbinstall has been renamed as it calls the target specific and
51	the logic to pass down STRIP from mk been removed.  This forces
52	a re-installation of tools.
53
5420070422:
55	The way OS emulations lookup filenames inside the emulation root
56	has been changed.  Rather than modify the pathname (and copy back
57	to userspace) namei() and lookup() directly check the emulation
58	root. One side effect is that absolute symlinks inside the emulated
59	root file system will be relative to that file system - unless they
60	start /../ this is useful when the emulated root is a real install
61	that has such links.
62	This might affect symlinks that have been added to reference outside
63	the emulated root.
64
6520070412:
66	The pckbc driver on sgimips IP32 has been removed. Use macekbc
67	instead. See the GENERIC32_IP3x kernel configuration for an
68	example.
69
7020070319:
71        src/lib/libc/Makefile revision 1.129 broke libc and ld.elf_so
72        on many platforms due to incorrect flags settings.  If you
73        updated and built after about 20070315, do "nbmake-$arch
74	cleandir" in src/lib/libc and src/libexec/ld.elf_so to force a
75	rebuild of object files that might have been built
76	incorrectly, and ensure that you have at least
77	src/lib/libc/Makefile 1.130.
78
7920070210: 
80        src/sys/sys/{sa.h,savar.h} were removed.
81          find ${OBJDIR} \( -name .depend -o -name '*.d' \) -print \
82              | xargs egrep -l '/sa.h|/savar.h' | xargs rm
83        will allow dependencies on those files to get get rebuilt
84
8520070209:
86        The threading model was changed when the newlock2 branch
87        was merged to NetBSD-current.  If you boot with a new
88        kernel (version 4.99.10), then you also need a new pthread
89        library (/usr/lib/libpthread.so.0.7).  If you boot with
90        an old kernel, then you need the old pthread library
91        (/usr/lib/libpthread.so.0.6).  Provided you keep the kernel and
92        the pthread library in sync, old threaded applications should
93        continue to work with an old or new kernel.  Note that named(8)
94	is the only threaded application in the base system.
95
9620061214:
97	Following the move of string_to_flags() and flags_to_string()
98	from the bin/ls/ sources to libutil, users doing UPDATE builds
99	will need to do a "make cleandir" in
100		tools/mtree/, tools/makefs/, tools/binstall/, tools/pax/,
101		bin/pax/, bin/ls/, usr.sbin/mtree/, usr.sbin/makefs/,
102		usr.bin/xinstall/, libexec/ftpd/, rescue/, as well
103		as the installation images in distrib/
104	in order to excise stale references to the old stat_flags.h header
105	file in the ls sources -- stat_flags.h has been removed.
106
10720061108:
108	The configure script used in the src/tools/gcc compiler has been
109	changed to indicate that our libc has ssp support built-in and
110	does not depend on -lssp and -lssp-nonshared. You'll need to
111	make clean in src/tools/gcc first to rebuild the compiler.
112
11320061009:
114	The sysctl variables net.inet{,6}.tcp{,6}.newreno are no longer
115	available. Use net.inet{,6}.tcp{,6}.congctl.selected instead.
116
11720060814:
118	The vt, vidcconsole, kbd, and rpckbd drivers on acorn32 have been
119	withdrawn.  Use vidcvideo and pckbd instead.  See the GENERIC
120	kernel configuration for an example.  X servers from the last
121	few years should cope.
122
12320060703:
124	MPACPI is no more. We always configure PCI interrupts using ACPI
125	if we have an ACPI kernel. The option MPACPI_SCANPCI has been renamed
126	to ACPI_SCANPCI. Thanks to work from fvdl.
127
12820060627:
129	socket(2) has changed, and its system call has been versioned.
130	For userlands with the old version of socket(2), make sure that
131	your kernel has 'options COMPAT_30' set, or else 'bad system call'
132	errors will result.
133
134Hints for a more successful build:
135^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136    Use build.sh, but do not use its "expert mode":
137	This will automatically build the tools in the
138	   correct order, and it will keep the tools and the
139	   new build products from interfering with the running
140	   system.  This will allow you to ignore most of the
141	   other advice in this file.
142    Build a new kernel first:
143	This makes sure that any new system calls or features
144	   expected by the new userland will be present.  This
145	   helps to avoid critical errors when upgrading.
146    Use object directories:
147	This helps to keep stale object
148	   files from polluting the build if a Makefile "forgets"
149	   about one.  It also makes it easier to clean up after
150	   a build.  It's also necessary if you want to use the
151	   same source tree for multiple machines.
152	   To use object directories with build.sh:
153	    a) invoke build.sh with the "-M" or "-O" options.
154	   To use object directories without using build.sh:
155	    a) cd /usr/src ; make cleandir
156	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
157	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
158	    d) cd /usr/src ; make build
159	   Note that running "make obj" in a directory will create
160	   in obj.$MACHINE directory.
161    Build to a DESTDIR:
162	This helps to keep old installed files (especially libraries)
163	   from interfering with the new build.
164	   To build to a DESTDIR with build.sh, use the "-D" option.
165	   To build to a DESTDIR without using build.sh, set the DESTDIR
166	   environment variable before running make build.  It should be
167	   set to the pathname of an initially empty directory.
168	   Problems: if you do not use build.sh, you might need to
169		update critical utilities without using DESTDIR since
170		nothing is executed from what is installed in DESTDIR.
171		(See critical utils, below.)
172    Build often:
173	This keeps critical utilities current enough to not choke
174	on any other part of the source tree that depends on up to
175	date functionality.  If you use build.sh, you should not have
176	this problem.
177 
178What to do if things don't work:
179^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
180When things don't work there is usually a few things that commonly
181should be done.
182    1)	make includes
183	This should be done automatically by make build.
184    2)  cd share/mk && make install
185	Again, automatically done by make build.
186
187Failsafe rebuild of a small part of the tree:
188^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189To make sure you rebuild something correctly you want to do
190something like the following:
191    1)  Make sure the includes and .mk files are up to date.
192    2)  Make sure any program used to build the particular
193	utility is up to date.  (yacc, lex, etc...)
194    3)  cd ...path/to/util...
195	make cleandir
196	rm ...all obj directories...
197	make cleandir			# yes, again
198	make obj
199	make depend && make
200
201Failsafe rebuild of the entire tree:
202^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
203If you really want to make sure the source tree is clean and
204ready for a build try the following.  Note that sourcing /etc/mk.conf
205(a make(1) Makefile) in this manner is not right, and will not work
206for anyone who uses any make(1) features in /etc/mk.conf.
207
208---cut here---
209#!/bin/sh
210. /etc/mk.conf
211
212if [ -z $NETBSDSRCDIR ] ; then
213    NETBSDSRCDIR=/usr/src
214fi
215if [ \! -d $NETBSDSRCDIR ] ; then
216    echo Unable to find sources
217    exit 1
218fi
219find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
220
221if [ -z $BSDOBJDIR ] ; then
222    BSDOBJDIR=/usr/obj
223fi
224if [ -d $BSDOBJDIR ] ; then
225    rm -rf $BSDOBJDIR
226fi
227
228cd $NETBSDSRCDIR && make cleandir
229
230---cut here---
231
232Critical utilities:
233^^^^^^^^^^^^^^^^^^^
234	usr.bin/compile_et
235	usr.bin/make
236	usr.bin/yacc
237	usr.bin/lex
238	usr.bin/xlint
239	usr.bin/config
240
241Other problems and possible solutions:
242^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
243Symptom:Complaints involving a Makefile.
244Fix:	Rebuild usr.bin/make:
245	cd usr.bin/make && make && make install
246	Or, a failsafe method if that doesn't work:
247	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
248
249Fix:	Make sure .mk files are up to date.
250	cd share/mk && make install
251
252Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
253Fix:	Rebuild usr.bin/config
254
255Symptom:
256Fix:	Rebuild usr.bin/yacc
257
258Symptom:
259Fix:	Rebuild usr.bin/lex
260
261Symptom:
262Fix:	rm /usr/lib/libbfd.a
263
264Symptom:Obsolete intermediate files are used during compilation
265Fix:	Try the following sequence of commands in the directory in question.
266	make cleandir; rm `make print-objdir`; make cleandir; make obj
267	(If you built the tree without "make obj" in the past, obsolete files
268	may remain.  The command tries to clean everything up)
269
270Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
271Fix:	Rebuild and install usr.bin/menuc
272
273Symptom:mklocale not found during build in share/locale/ctype
274Fix:	Build and install usr.bin/mklocale
275
276Symptom:undefined reference to `__assert13' or `__unsetenv13'
277Fix:    Rebuild and install lib/libc
278
279Symptom:usr.bin/config fails to build.
280Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
281
282Symptom:undefined reference to `getprogname' or `setprogname'
283Fix:    Rebuild and install lib/libc
284
285Symptom:lint does not understand the '-X' option
286Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
287