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