Author: emaste
Date: Thu Sep 24 16:55:22 2015
New Revision: 288176
URL: https://svnweb.freebsd.org/changeset/base/288176

Log:
  Install kernel debug data under /usr/lib/debug
  
  This avoids needing a large boot partition / file system in order to
  accommodate multiple kernels, and provides consistency with userland
  debug. This also simplifies the process of moving kernel debug files
  to a separate package and installing them on demand.
  
  In addition, change kernel debug file extension to .debug, to match
  userland debug files.
  
  When using the supported kernel installation method the
  /usr/lib/debug/boot/kernel directory will be renamed (to kernel.old)
  as is done with /boot/kernel.
  
  Developers wishing to maintain the historical behavior of installing
  debug files in /boot/kernel/ can set KERN_DEBUGDIR="" in src.conf(5).
  
  Reviewed by:  bdrewery, brooks, imp, markj
  Relnotes:     yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D1006

Modified:
  head/UPDATING
  head/etc/mtree/BSD.debug.dist
  head/share/man/man7/hier.7
  head/sys/conf/kern.post.mk
  head/sys/conf/kmod.mk

Modified: head/UPDATING
==============================================================================
--- head/UPDATING       Thu Sep 24 15:59:08 2015        (r288175)
+++ head/UPDATING       Thu Sep 24 16:55:22 2015        (r288176)
@@ -31,6 +31,19 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
        disable the most expensive debugging functionality run
        "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20150925:
+       Kernel debug files have been moved to /usr/lib/debug/boot/kernel/,
+       and renamed from .symbols to .debug. This reduces the size requirements
+       on the boot partition or file system and provides consistency with
+       userland debug files.
+
+       When using the supported kernel installation method the
+       /usr/lib/debug/boot/kernel directory will be renamed (to kernel.old)
+       as is done with /boot/kernel.
+
+       Developers wishing to maintain the historical behavior of installing
+       debug files in /boot/kernel/ can set KERN_DEBUGDIR="" in src.conf(5).
+
 20150827:
        The wireless drivers had undergone changes that remove the 'parent
        interface' from the ifconfig -l output. The rc.d network scripts

Modified: head/etc/mtree/BSD.debug.dist
==============================================================================
--- head/etc/mtree/BSD.debug.dist       Thu Sep 24 15:59:08 2015        
(r288175)
+++ head/etc/mtree/BSD.debug.dist       Thu Sep 24 16:55:22 2015        
(r288176)
@@ -9,6 +9,8 @@
         bin
         ..
         boot
+            kernel
+            ..
         ..
         lib
             geom

Modified: head/share/man/man7/hier.7
==============================================================================
--- head/share/man/man7/hier.7  Thu Sep 24 15:59:08 2015        (r288175)
+++ head/share/man/man7/hier.7  Thu Sep 24 16:55:22 2015        (r288176)
@@ -383,7 +383,7 @@ shared libraries for compatibility
 a.out backward compatibility libraries
 .El
 .It Pa debug/
-standalone debug data for the base system libraries and binaries
+standalone debug data for the kernel and base system libraries and binaries
 .It Pa dtrace/
 DTrace library scripts
 .It Pa engines/

Modified: head/sys/conf/kern.post.mk
==============================================================================
--- head/sys/conf/kern.post.mk  Thu Sep 24 15:59:08 2015        (r288175)
+++ head/sys/conf/kern.post.mk  Thu Sep 24 16:55:22 2015        (r288176)
@@ -23,6 +23,11 @@ MKMODULESENV+=       CONF_CFLAGS="${CONF_CFLAG
 MKMODULESENV+= WITH_CTF="${WITH_CTF}"
 .endif
 
+# Allow overriding the kernel debug directory, so kernel and user debug may be
+# installed in different directories. Setting it to "" restores the historical
+# behavior of installing debug files in the kernel directory.
+KERN_DEBUGDIR?=        ${DEBUGDIR}
+
 .MAIN: all
 
 .for target in all clean cleandepend cleandir clobber depend install \
@@ -101,11 +106,11 @@ modules-all modules-depend: modules-obj
 .if !defined(DEBUG)
 FULLKERNEL=    ${KERNEL_KO}
 .else
-FULLKERNEL=    ${KERNEL_KO}.debug
-${KERNEL_KO}: ${FULLKERNEL} ${KERNEL_KO}.symbols
-       ${OBJCOPY} --strip-debug --add-gnu-debuglink=${KERNEL_KO}.symbols\
+FULLKERNEL=    ${KERNEL_KO}.full
+${KERNEL_KO}: ${FULLKERNEL} ${KERNEL_KO}.debug
+       ${OBJCOPY} --strip-debug --add-gnu-debuglink=${KERNEL_KO}.debug \
            ${FULLKERNEL} ${.TARGET}
-${KERNEL_KO}.symbols: ${FULLKERNEL}
+${KERNEL_KO}.debug: ${FULLKERNEL}
        ${OBJCOPY} --only-keep-debug ${FULLKERNEL} ${.TARGET}
 install.debug reinstall.debug: gdbinit
        cd ${.CURDIR}; ${MAKE} ${.TARGET:R}
@@ -151,7 +156,7 @@ ${mfile:T:S/.m$/.h/}: ${mfile}
 
 kernel-clean:
        rm -f *.o *.so *.So *.ko *.s eddep errs \
-           ${FULLKERNEL} ${KERNEL_KO} ${KERNEL_KO}.symbols \
+           ${FULLKERNEL} ${KERNEL_KO} ${KERNEL_KO}.debug \
            linterrs tags vers.c \
            vnode_if.c vnode_if.h vnode_if_newproto.h vnode_if_typedef.h \
            ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
@@ -249,19 +254,26 @@ kernel-install:
        if [ ! "`dirname "$$thiskernel"`" -ef ${DESTDIR}${KODIR} ] ; then \
                chflags -R noschg ${DESTDIR}${KODIR} ; \
                rm -rf ${DESTDIR}${KODIR} ; \
+               rm -rf ${DESTDIR}${KERN_DEBUGDIR}${KODIR} ; \
        else \
                if [ -d ${DESTDIR}${KODIR}.old ] ; then \
                        chflags -R noschg ${DESTDIR}${KODIR}.old ; \
                        rm -rf ${DESTDIR}${KODIR}.old ; \
                fi ; \
                mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old ; \
+               if [ -n "${KERN_DEBUGDIR}" -a \
+                    -d ${DESTDIR}${KERN_DEBUGDIR}${KODIR} ]; then \
+                       rm -rf ${DESTDIR}${KERN_DEBUGDIR}${KODIR}.old ; \
+                       mv ${DESTDIR}${KERN_DEBUGDIR}${KODIR} 
${DESTDIR}${KERN_DEBUGDIR}${KODIR}.old ; \
+               fi ; \
                sysctl kern.bootfile=${DESTDIR}${KODIR}.old/"`basename 
"$$thiskernel"`" ; \
        fi
 .endif
        mkdir -p ${DESTDIR}${KODIR}
        ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} 
${DESTDIR}${KODIR}
 .if defined(DEBUG) && !defined(INSTALL_NODEBUG) && ${MK_KERNEL_SYMBOLS} != "no"
-       ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols 
${DESTDIR}${KODIR}
+       mkdir -p ${DESTDIR}${KERN_DEBUGDIR}${KODIR}
+       ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.debug 
${DESTDIR}${KERN_DEBUGDIR}${KODIR}
 .endif
 .if defined(KERNEL_EXTRA_INSTALL)
        ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} 
${KERNEL_EXTRA_INSTALL} ${DESTDIR}${KODIR}
@@ -273,7 +285,7 @@ kernel-reinstall:
        @-chflags -R noschg ${DESTDIR}${KODIR}
        ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO} 
${DESTDIR}${KODIR}
 .if defined(DEBUG) && !defined(INSTALL_NODEBUG) && ${MK_KERNEL_SYMBOLS} != "no"
-       ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.symbols 
${DESTDIR}${KODIR}
+       ${INSTALL} -p -m 555 -o ${KMODOWN} -g ${KMODGRP} ${KERNEL_KO}.debug 
${DESTDIR}${KERN_DEBUGDIR}${KODIR}
 .endif
 
 config.o env.o hints.o vers.o vnode_if.o:

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk       Thu Sep 24 15:59:08 2015        (r288175)
+++ head/sys/conf/kmod.mk       Thu Sep 24 16:55:22 2015        (r288176)
@@ -172,11 +172,11 @@ PROG=     ${KMOD}.ko
 .if !defined(DEBUG_FLAGS)
 FULLPROG=      ${PROG}
 .else
-FULLPROG=      ${PROG}.debug
-${PROG}: ${FULLPROG} ${PROG}.symbols
-       ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROG}.symbols\
+FULLPROG=      ${PROG}.full
+${PROG}: ${FULLPROG} ${PROG}.debug
+       ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROG}.debug \
            ${FULLPROG} ${.TARGET}
-${PROG}.symbols: ${FULLPROG}
+${PROG}.debug: ${FULLPROG}
        ${OBJCOPY} --only-keep-debug ${FULLPROG} ${.TARGET}
 .endif
 
@@ -266,7 +266,7 @@ ${_ILINKS}:
 CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS}
 
 .if defined(DEBUG_FLAGS)
-CLEANFILES+= ${FULLPROG} ${PROG}.symbols
+CLEANFILES+= ${FULLPROG} ${PROG}.debug
 .endif
 
 .if !target(install)
@@ -277,6 +277,7 @@ _INSTALLFLAGS:=     ${_INSTALLFLAGS${ie}}
 .endfor
 
 .if !target(realinstall)
+KERN_DEBUGDIR?=        ${DEBUGDIR}
 realinstall: _kmodinstall
 .ORDER: beforeinstall _kmodinstall
 _kmodinstall:
@@ -284,7 +285,7 @@ _kmodinstall:
            ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}
 .if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && ${MK_KERNEL_SYMBOLS} 
!= "no"
        ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
-           ${_INSTALLFLAGS} ${PROG}.symbols ${DESTDIR}${KMODDIR}
+           ${_INSTALLFLAGS} ${PROG}.debug ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}
 .endif
 
 .include <bsd.links.mk>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to