UPDATING revision 1.170.6.1
1$NetBSD: UPDATING,v 1.170.6.1 2008/06/23 04:26:44 wrstuden 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 1920080531: 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 3120080503: 32 The <bsd.lib.mk> variable MKPRIVATELIB was renamed to LIBISPRIVATE. 33 3420080521: 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 4220080126: 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 4820071209: 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 5320071115: 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 6020071028: 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 6820070913: 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 7820070703: 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 8320070422: 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 9420070412: 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 9920070319: 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 10820070210: 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 11420070209: 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 12520061214: 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 13620061108: 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 14220061009: 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 14620060814: 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 15220060703: 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 15720060627: 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 163Hints 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 207What to do if things don't work: 208^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 209When things don't work there is usually a few things that commonly 210should 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 216Failsafe rebuild of a small part of the tree: 217^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 218To make sure you rebuild something correctly you want to do 219something 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 230Failsafe rebuild of the entire tree: 231^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 232If you really want to make sure the source tree is clean and 233ready 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 235for anyone who uses any make(1) features in /etc/mk.conf. 236 237---cut here--- 238#!/bin/sh 239. /etc/mk.conf 240 241if [ -z $NETBSDSRCDIR ] ; then 242 NETBSDSRCDIR=/usr/src 243fi 244if [ \! -d $NETBSDSRCDIR ] ; then 245 echo Unable to find sources 246 exit 1 247fi 248find $NETBSDSRCDIR -name \*.o -o -name obj.\* -o -name obj -exec rm \{\} \; 249 250if [ -z $BSDOBJDIR ] ; then 251 BSDOBJDIR=/usr/obj 252fi 253if [ -d $BSDOBJDIR ] ; then 254 rm -rf $BSDOBJDIR 255fi 256 257cd $NETBSDSRCDIR && make cleandir 258 259---cut here--- 260 261Critical 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 270Other problems and possible solutions: 271^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 272Symptom:Complaints involving a Makefile. 273Fix: 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 278Fix: Make sure .mk files are up to date. 279 cd share/mk && make install 280 281Symptom:Kernel `config' fails to configure any kernel, including GENERIC. 282Fix: Rebuild usr.bin/config 283 284Symptom: 285Fix: Rebuild usr.bin/yacc 286 287Symptom: 288Fix: Rebuild usr.bin/lex 289 290Symptom: 291Fix: rm /usr/lib/libbfd.a 292 293Symptom:Obsolete intermediate files are used during compilation 294Fix: 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 299Symptom:.../sysinst/run.c:xx: warning: initialization from incompatible pointer type 300Fix: Rebuild and install usr.bin/menuc 301 302Symptom:mklocale not found during build in share/locale/ctype 303Fix: Build and install usr.bin/mklocale 304 305Symptom:undefined reference to `__assert13' or `__unsetenv13' 306Fix: Rebuild and install lib/libc 307 308Symptom:usr.bin/config fails to build. 309Fix: Try building with -DMAKE_BOOTSTRAP added to CFLAGS in Makefile. 310 311Symptom:undefined reference to `getprogname' or `setprogname' 312Fix: Rebuild and install lib/libc 313 314Symptom:lint does not understand the '-X' option 315Fix: May need to build & install libs with NOLINT=1 before rebuilding lint 316