Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jun 2003 12:21:47 +0400
From:      Alexey Neyman <alex.neyman@auriga.ru>
To:        "David E. O'Brien" <obrien@FreeBSD.org>
Cc:        arch@freebsd.org
Subject:   Re: cvs commit: src/sys/i386/i386 atomic.c autoconf.c bios.c busdma_machdep.c critical.c db_disasm.c db_interface.c db_trace.c dump_machdep.c elan-mmcr.c elf_machdep.c genassym.c i386-gdbstub.c i686_mem.c identcpu.c in_cksum.c initcpu.c k6_mem.c legacy.c ...
Message-ID:  <200306021221.47700.alex.neyman@auriga.ru>
In-Reply-To: <200306020643.h526hGg8017066@repoman.freebsd.org>
References:  <200306020643.h526hGg8017066@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Boundary-00=_bkw2+ELhZpXchWs
Content-Type: text/plain;
  charset="koi8-r"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi, there!

On Monday 02 June 2003 10:43, David E. O'Brien wrote:
DE>   Modified files:
DE>     sys/i386/i386        atomic.c autoconf.c bios.c 
DE>                          busdma_machdep.c critical.c db_disasm.c 
DE>                          db_interface.c db_trace.c dump_machdep.c 
DE>                          elan-mmcr.c elf_machdep.c genassym.c 
DE>                          i386-gdbstub.c i686_mem.c identcpu.c 
DE>                          in_cksum.c initcpu.c k6_mem.c legacy.c 
DE>                          machdep.c math_emulate.c mem.c mp_clock.c 
DE>                          mp_machdep.c mpapic.c nexus.c perfmon.c 
DE>                          pmap.c sys_machdep.c trap.c tsc.c vm86.c 
DE>                          vm_machdep.c 
DE>   Log:
DE>   Use __FBSDID().

BTW, I have a patch that strips the version information (more precisely,
.comment section, that contains $FreeBSD$ strings and a handful of
compiler versions "GCC: (GNU) 3.2.2 [FreeBSD] 20030205 (release)") into
a separate file and installs it under a separate name (${KMOD}.version
or kernel.version).

Even now, .comment section in GENERIC is somewhat about 30K (this gives
about 2.5K in the compressed kernel), but it will obviously grow as 
more __FBSDID()s are added.

PS. The patch is against ~1 week old sources, however, it should apply 
ok.

Regards,
Alexey.

-- 
,----------------------------------------,
| A quoi ca sert d'etre sur la terre     | Alexey V. Neyman
| Si c'est pour faire nos vies a genoux! | mailto:alex.neyman@auriga.ru
`------------------( Les Rois du Monde )-'

--Boundary-00=_bkw2+ELhZpXchWs
Content-Type: text/plain;
  charset="koi8-r";
  name="patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="patch"

diff -ur sys/conf/kern.post.mk sys/conf/kern.post.mk
--- sys/conf/kern.post.mk	Mon May 26 08:26:42 2003
+++ sys/conf/kern.post.mk	Mon May 26 19:50:41 2003
@@ -187,6 +187,10 @@
 .else
 	${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR}
 .endif
+.if !defined(NO_IDENTFILES)
+	${INSTALL} -p -m 444 -o root -g wheel ${KERNEL_KO}.version \
+		${DESTDIR}${KODIR}
+.endif
 
 kernel-reinstall:
 	@-chflags -R noschg ${DESTDIR}${KODIR}
@@ -194,6 +198,10 @@
 	${INSTALL} -p -m 555 -o root -g wheel ${FULLKERNEL} ${DESTDIR}${KODIR}
 .else
 	${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR}
+.endif
+.if !defined(NO_IDENTFILES)
+	${INSTALL} -p -m 444 -o root -g wheel ${KERNEL_KO}.version \
+		${DESTDIR}${KODIR}
 .endif
 
 config.o:
diff -ur sys/conf/kern.pre.mk sys/conf/kern.pre.mk
--- sys/conf/kern.pre.mk	Mon May 26 07:32:48 2003
+++ sys/conf/kern.pre.mk	Mon May 26 19:57:28 2003
@@ -14,9 +14,12 @@
 M=	${MACHINE_ARCH}
 
 AWK?=		awk
+IDENT?=		ident
 NM?=		nm
 OBJCOPY?=	objcopy
+SED?=		sed
 SIZE?=		size
+SORT?=		sort
 
 COPTFLAGS?=-O -pipe
 .if !defined(NO_CPU_COPTFLAGS)
@@ -71,7 +74,11 @@
 SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
 	-warn-common -export-dynamic -dynamic-linker /red/herring \
 	-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
-SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
+SYSTEM_LD_TAIL= @${OBJCOPY} -j .comment ${.TARGET} \
+		${KERNEL_KO}.comment 2>/dev/null ; \
+	${OBJCOPY} --strip-symbol gcc2_compiled. -R .comment ${.TARGET} ; \
+	${IDENT} ${KERNEL_KO}.comment | ${SED} '1d' | \
+		${SORT} -u > ${KERNEL_KO}.version ; \
 	${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET}
 SYSTEM_DEP+= $S/conf/ldscript.$M
 
diff -ur sys/conf/kmod.mk sys/conf/kmod.mk
--- sys/conf/kmod.mk	Mon May 26 07:52:49 2003
+++ sys/conf/kmod.mk	Mon May 26 19:55:58 2003
@@ -58,9 +58,13 @@
 #
 
 AWK?=		awk
+IDENT?=		ident
 KMODLOAD?=	/sbin/kldload
 KMODUNLOAD?=	/sbin/kldunload
 OBJCOPY?=	objcopy
+SED?=		sed
+SORT?=		sort
+TEST?=		test
 
 .if defined(KMODDEPS)
 .error "Do not use KMODDEPS on 5.0+, use MODULE_VERSION/MODULE_DEPEND"
@@ -122,6 +126,10 @@
 
 ${FULLPROG}: ${KMOD}.kld
 	${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld
+	${OBJCOPY} -j .comment ${.TARGET} ${KMOD}.comment 2>/dev/null
+	${OBJCOPY} -R .comment ${.TARGET}
+	${IDENT} ${KMOD}.comment 2>/dev/null | ${SED} '1d' | \
+		${SORT} -u > ${KMOD}.version
 
 EXPORT_SYMS?=	NO
 .if ${EXPORT_SYMS} != YES
@@ -206,10 +214,18 @@
 _kmodinstall:
 	${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
 	    ${_INSTALLFLAGS} ${FULLPROG} ${DESTDIR}${KMODDIR}
+.if !defined(NO_IDENTFILES)
+	${TEST} -s ${KMOD}.version && ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} \
+	    -m 444 ${_INSTALLFLAGS} ${KMOD}.version ${DESTDIR}${KMODDIR}
+.endif
 .else
 _kmodinstall:
 	${INSTALL} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
 	    ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}
+.if !defined(NO_IDENTFILES)
+	${TEST} -s ${KMOD}.version && ${INSTALL} -o ${KMODOWN} -g ${KMODGRP} \
+	    -m 444 ${_INSTALLFLAGS} ${KMOD}.version ${DESTDIR}${KMODDIR}
+.endif
 
 .include <bsd.links.mk>
 

--Boundary-00=_bkw2+ELhZpXchWs--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200306021221.47700.alex.neyman>