Subject: making profiling kernel with ./build.sh
To: None <current-users@NetBSD.org>
From: Makoto Fujiwara <makoto@ki.nu>
List: current-users
Date: 12/05/2007 17:06:22
Hi, I am just interesting to build profiling kernel. But
it doesn't seems to do with ./build.sh, so..

Index: build.sh
===================================================================
RCS file: /e/cvsync/cvsync/src/build.sh,v
retrieving revision 1.180
diff -u -u -r1.180 build.sh
--- build.sh	23 Nov 2007 19:38:43 -0000	1.180
+++ build.sh	5 Dec 2007 07:38:37 -0000
@@ -548,6 +548,7 @@
     -O obj      Set obj root directory to obj; sets a MAKEOBJDIR pattern.
                 Unsets MAKEOBJDIRPREFIX.
     -o          Set MKOBJDIRS=no; do not create objdirs at start of build.
+    -p          Build profiling kernel (good only with kernel=, releasekernel=)
     -R release  Set RELEASEDIR to release.  [Default: releasedir]
     -r          Remove contents of TOOLDIR and DESTDIR before building.
     -T tools    Set TOOLDIR to tools.  If unset, and TOOLDIR is not set in
@@ -569,7 +570,7 @@
 
 parseoptions()
 {
-	opts='a:B:bC:D:dEhi:j:k:M:m:N:nO:oR:rT:tUuV:w:xX:Z:'
+	opts='a:B:bC:D:dEhi:j:k:M:m:N:nO:opR:rT:tUuV:w:xX:Z:'
 	opt_a=no
 
 	if type getopts >/dev/null 2>&1; then
@@ -685,6 +686,11 @@
 			MKOBJDIRS=no
 			;;
 
+		-p)
+			profiling="-p"
+			PROF=".PROF"
+			;;
+
 		-R)
 			eval ${optargcmd}; resolvepath
 			setmakeenv RELEASEDIR "${OPTARG}"
@@ -1170,7 +1176,7 @@
 		kernelconfname="${kernelconf}"
 		;;
 	esac
-	kernelbuildpath="${KERNOBJDIR}/${kernelconfname}"
+	kernelbuildpath="${KERNOBJDIR}/${kernelconfname}${PROF}"
 }
 
 buildkernel()
@@ -1186,7 +1192,7 @@
 		buildkernelwarned=true
 	fi
 	getkernelconf $1
-	statusmsg "Building kernel:  ${kernelconf}"
+	statusmsg "Building kernel:  ${kernelconf}${PROF}"
 	statusmsg "Build directory:  ${kernelbuildpath}"
 	${runcmd} mkdir -p "${kernelbuildpath}" ||
 	    bomb "Cannot mkdir: ${kernelbuildpath}"
@@ -1198,7 +1204,7 @@
 	fi
 	[ -x "${TOOLDIR}/bin/${toolprefix}config" ] \
 	|| bomb "${TOOLDIR}/bin/${toolprefix}config does not exist. You need to \"$0 tools\" first."
-	${runcmd} "${TOOLDIR}/bin/${toolprefix}config" -b "${kernelbuildpath}" \
+	${runcmd} "${TOOLDIR}/bin/${toolprefix}config" "$profiling" -b "${kernelbuildpath}" \
 		-s "${TOP}/sys" "${kernelconfpath}" ||
 	    bomb "${toolprefix}config failed for ${kernelconf}"
 	${runcmd} cd "${kernelbuildpath}"

---
Makoto Fujiwara 
Chiba Japan