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