UPDATING revision 1.177
1$NetBSD: UPDATING,v 1.177 2008/08/13 16:37:56 christos 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
1920080813:
20	MKDEBUG build was broken because the .depend files did not know
21	about .go files. You need to remove all .depend files and rebuild.
22
2320080731:
24	WAPBL (metadata journaling support) has been added, but at this
25	time isn't backwards compatible with pre-WAPBL aware kernels
26	and userland (fsck_ffs in particular).  Please make sure you
27	don't use a journaled filesystem with an older kernel/userland,
28	especially an uncleanly mounted journaled filesystem.  WAPBL
29	also requires the super block to be in the UFS2 format.  You
30	can use fsck_ffs -c 4 to update the superblock format.
31
3220080721:
33	Assembler warnings are now fatal if $WARNS>0 and $NOGCCERROR
34	isn't defined.
35
3620080531:
37	The ioctl number of DRVSUSPENDDEV command on /dev/drvctl changed 
38	from 125 (conflicted with DRVCTLCOMMAND) to 129. The drvctl(8)
39	utility needs to be rebuilt and reinstalled as older binaries
40	won't work correctly. The following sequence of commands:
41
42	  $ (cd sys/sys/ && nbmake-$arch includes)
43	  $ (cd sbin/drvctl/ && nbmake-$arch clean)
44	  $ (cd sbin/drvctl/ && nbmake-$arch all)
45
46	leaves new drvctl utility in sbin/drvctl build directory.
47
4820080503:
49	The <bsd.lib.mk> variable MKPRIVATELIB was renamed to LIBISPRIVATE.
50
5120080521:
52	For a while, unprivileged UPDATE builds would fail to
53	succeed at the checkflist stage, complaining that
54	${DESTDIR}/stand/<arch>/ did not exist.  A fix for this
55	problem was committed to share/mk/bsd.kmodule.mk, revision 1.9.
56	If you already hit this problem, update the .mk file,
57	remove ${DESTDIR}/stand/<arch>, and re-run the build.
58
5920080303:
60	Linker warnings are now fatal if $WARNS>0.
61
6220080126:
63	The posix_fadvise system call has been changed from an assembly
64	stub, to a c file that calls an assembly stub. You need to
65	'rm -f posix_fadvise.* .depend' in the libc build directory to
66	avoid using the old assembly stub.
67
6820071209:
69	The acpiec(4) driver has been split into two attachments. If you
70	get ACPI errors before the attachment, please update your kernel
71	configuration file appropriately or see GENERIC for more details.
72
7320071115:
74	The it(4) driver has been renamed to itesio(4) and the old port
75	argument specified in the kernel configuration file is not valid
76	anymore. The itesio(4) driver now uses the Super I/O address port
77	rather than the EC address port. Please update your kernel
78	configuration file appropriately or see GENERIC for more details.
79
8020071028:
81	The pccons(4) driver has been removed from the NetBSD/shark port.
82	You need to update any custom kernel configuration file you have
83	to remove any references to pccons (which includes removing the
84	now useless XSERVER option) and replace them with the correct
85	entries for the wscons driver.  See the GENERIC configuration file
86	for more details.
87
8820070913:
89	A latent bug in dhclient/dhcpd that caused it to be unable to
90	enumerate interfaces was fixed.  The bug began to cause
91	problems after 20070911 when the kernel's SIOCGIFCONF
92	implementation was repaired.  From 20070529 to 20070911 racoon
93	could not enumerate interfaces.  (These are noted because
94	normal kernel/userspace version matching hygiene is not
95	sufficient to avoid this problem.)  Ensure that both kernel
96	and userland are from after 20070913.
97
9820070703:
99	nbinstall has been renamed as it calls the target specific and
100	the logic to pass down STRIP from mk been removed.  This forces
101	a re-installation of tools.
102
10320070422:
104	The way OS emulations lookup filenames inside the emulation root
105	has been changed.  Rather than modify the pathname (and copy back
106	to userspace) namei() and lookup() directly check the emulation
107	root. One side effect is that absolute symlinks inside the emulated
108	root file system will be relative to that file system - unless they
109	start /../ this is useful when the emulated root is a real install
110	that has such links.
111	This might affect symlinks that have been added to reference outside
112	the emulated root.
113
11420070412:
115	The pckbc driver on sgimips IP32 has been removed. Use macekbc
116	instead. See the GENERIC32_IP3x kernel configuration for an
117	example.
118
11920070319:
120        src/lib/libc/Makefile revision 1.129 broke libc and ld.elf_so
121        on many platforms due to incorrect flags settings.  If you
122        updated and built after about 20070315, do "nbmake-$arch
123	cleandir" in src/lib/libc and src/libexec/ld.elf_so to force a
124	rebuild of object files that might have been built
125	incorrectly, and ensure that you have at least
126	src/lib/libc/Makefile 1.130.
127
12820070210: 
129        src/sys/sys/{sa.h,savar.h} were removed.
130          find ${OBJDIR} \( -name .depend -o -name '*.d' \) -print \
131              | xargs egrep -l '/sa.h|/savar.h' | xargs rm
132        will allow dependencies on those files to get get rebuilt
133
13420070209:
135        The threading model was changed when the newlock2 branch
136        was merged to NetBSD-current.  If you boot with a new
137        kernel (version 4.99.10), then you also need a new pthread
138        library (/usr/lib/libpthread.so.0.7).  If you boot with
139        an old kernel, then you need the old pthread library
140        (/usr/lib/libpthread.so.0.6).  Provided you keep the kernel and
141        the pthread library in sync, old threaded applications should
142        continue to work with an old or new kernel.  Note that named(8)
143	is the only threaded application in the base system.
144
14520061214:
146	Following the move of string_to_flags() and flags_to_string()
147	from the bin/ls/ sources to libutil, users doing UPDATE builds
148	will need to do a "make cleandir" in
149		tools/mtree/, tools/makefs/, tools/binstall/, tools/pax/,
150		bin/pax/, bin/ls/, usr.sbin/mtree/, usr.sbin/makefs/,
151		usr.bin/xinstall/, libexec/ftpd/, rescue/, as well
152		as the installation images in distrib/
153	in order to excise stale references to the old stat_flags.h header
154	file in the ls sources -- stat_flags.h has been removed.
155
15620061108:
157	The configure script used in the src/tools/gcc compiler has been
158	changed to indicate that our libc has ssp support built-in and
159	does not depend on -lssp and -lssp-nonshared. You'll need to
160	make clean in src/tools/gcc first to rebuild the compiler.
161
16220061009:
163	The sysctl variables net.inet{,6}.tcp{,6}.newreno are no longer
164	available. Use net.inet{,6}.tcp{,6}.congctl.selected instead.
165
16620060814:
167	The vt, vidcconsole, kbd, and rpckbd drivers on acorn32 have been
168	withdrawn.  Use vidcvideo and pckbd instead.  See the GENERIC
169	kernel configuration for an example.  X servers from the last
170	few years should cope.
171
17220060703:
173	MPACPI is no more. We always configure PCI interrupts using ACPI
174	if we have an ACPI kernel. The option MPACPI_SCANPCI has been renamed
175	to ACPI_SCANPCI. Thanks to work from fvdl.
176
17720060627:
178	socket(2) has changed, and its system call has been versioned.
179	For userlands with the old version of socket(2), make sure that
180	your kernel has 'options COMPAT_30' set, or else 'bad system call'
181	errors will result.
182
183Hints for a more successful build:
184^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
185    Use build.sh, but do not use its "expert mode":
186	This will automatically build the tools in the
187	   correct order, and it will keep the tools and the
188	   new build products from interfering with the running
189	   system.  This will allow you to ignore most of the
190	   other advice in this file.
191    Build a new kernel first:
192	This makes sure that any new system calls or features
193	   expected by the new userland will be present.  This
194	   helps to avoid critical errors when upgrading.
195    Use object directories:
196	This helps to keep stale object
197	   files from polluting the build if a Makefile "forgets"
198	   about one.  It also makes it easier to clean up after
199	   a build.  It's also necessary if you want to use the
200	   same source tree for multiple machines.
201	   To use object directories with build.sh:
202	    a) invoke build.sh with the "-M" or "-O" options.
203	   To use object directories without using build.sh:
204	    a) cd /usr/src ; make cleandir
205	    b) Add "OBJMACHINE=yes" to /etc/mk.conf
206	    c) Add "MKOBJDIRS=yes" to /etc/mk.conf
207	    d) cd /usr/src ; make build
208	   Note that running "make obj" in a directory will create
209	   in obj.$MACHINE directory.
210    Build to a DESTDIR:
211	This helps to keep old installed files (especially libraries)
212	   from interfering with the new build.
213	   To build to a DESTDIR with build.sh, use the "-D" option.
214	   To build to a DESTDIR without using build.sh, set the DESTDIR
215	   environment variable before running make build.  It should be
216	   set to the pathname of an initially empty directory.
217	   Problems: if you do not use build.sh, you might need to
218		update critical utilities without using DESTDIR since
219		nothing is executed from what is installed in DESTDIR.
220		(See critical utils, below.)
221    Build often:
222	This keeps critical utilities current enough to not choke
223	on any other part of the source tree that depends on up to
224	date functionality.  If you use build.sh, you should not have
225	this problem.
226 
227What to do if things don't work:
228^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
229When things don't work there is usually a few things that commonly
230should be done.
231    1)	make includes
232	This should be done automatically by make build.
233    2)  cd share/mk && make install
234	Again, automatically done by make build.
235
236Failsafe rebuild of a small part of the tree:
237^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
238To make sure you rebuild something correctly you want to do
239something like the following:
240    1)  Make sure the includes and .mk files are up to date.
241    2)  Make sure any program used to build the particular
242	utility is up to date.  (yacc, lex, etc...)
243    3)  cd ...path/to/util...
244	make cleandir
245	rm ...all obj directories...
246	make cleandir			# yes, again
247	make obj
248	make depend && make
249
250Failsafe rebuild of the entire tree:
251^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
252If you really want to make sure the source tree is clean and
253ready for a build try the following.  Note that sourcing /etc/mk.conf
254(a make(1) Makefile) in this manner is not right, and will not work
255for anyone who uses any make(1) features in /etc/mk.conf.
256
257---cut here---
258#!/bin/sh
259. /etc/mk.conf
260
261if [ -z $NETBSDSRCDIR ] ; then
262    NETBSDSRCDIR=/usr/src
263fi
264if [ \! -d $NETBSDSRCDIR ] ; then
265    echo Unable to find sources
266    exit 1
267fi
268find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \;
269
270if [ -z $BSDOBJDIR ] ; then
271    BSDOBJDIR=/usr/obj
272fi
273if [ -d $BSDOBJDIR ] ; then
274    rm -rf $BSDOBJDIR
275fi
276
277cd $NETBSDSRCDIR && make cleandir
278
279---cut here---
280
281Critical utilities:
282^^^^^^^^^^^^^^^^^^^
283	usr.bin/compile_et
284	usr.bin/make
285	usr.bin/yacc
286	usr.bin/lex
287	usr.bin/xlint
288	usr.bin/config
289
290Other problems and possible solutions:
291^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
292Symptom:Complaints involving a Makefile.
293Fix:	Rebuild usr.bin/make:
294	cd usr.bin/make && make && make install
295	Or, a failsafe method if that doesn't work:
296	cd usr.bin/make && cc *.c */*.c -I . -o make && mv make /usr/bin
297
298Fix:	Make sure .mk files are up to date.
299	cd share/mk && make install
300
301Symptom:Kernel `config' fails to configure any kernel, including GENERIC.
302Fix:	Rebuild usr.bin/config
303
304Symptom:
305Fix:	Rebuild usr.bin/yacc
306
307Symptom:
308Fix:	Rebuild usr.bin/lex
309
310Symptom:
311Fix:	rm /usr/lib/libbfd.a
312
313Symptom:Obsolete intermediate files are used during compilation
314Fix:	Try the following sequence of commands in the directory in question.
315	make cleandir; rm `make print-objdir`; make cleandir; make obj
316	(If you built the tree without "make obj" in the past, obsolete files
317	may remain.  The command tries to clean everything up)
318
319Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type
320Fix:	Rebuild and install usr.bin/menuc
321
322Symptom:mklocale not found during build in share/locale/ctype
323Fix:	Build and install usr.bin/mklocale
324
325Symptom:undefined reference to `__assert13' or `__unsetenv13'
326Fix:    Rebuild and install lib/libc
327
328Symptom:usr.bin/config fails to build.
329Fix:	Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile.
330
331Symptom:undefined reference to `getprogname' or `setprogname'
332Fix:    Rebuild and install lib/libc
333
334Symptom:lint does not understand the '-X' option
335Fix:    May need to build & install libs with NOLINT=1 before rebuilding lint
336