From owner-freebsd-current Wed Oct 16 23:58:41 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C81237B401 for ; Wed, 16 Oct 2002 23:58:35 -0700 (PDT) Received: from protov.plain.co.nz (protov.plain.co.nz [202.36.174.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id B8ACD43E6A for ; Wed, 16 Oct 2002 23:58:34 -0700 (PDT) (envelope-from zombie@i4free.co.nz) Received: from i4free.co.nz (ppp65147.cyberxpress.co.nz [202.49.65.147]) by protov.plain.co.nz (Postfix) with ESMTP id 690B63C23B for ; Thu, 17 Oct 2002 19:58:28 +1300 (NZDT) Message-ID: <3DAE5F89.5020607@i4free.co.nz> Date: Thu, 17 Oct 2002 19:58:17 +1300 From: Andrew Turner User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: en-us, en MIME-Version: 1.0 To: current@freebsd.org Subject: Re: WARNING: Re: Kernel option dependency finding References: <3DAE4216.40706@i4free.co.nz> <3DAE545F.CBE1E1B2@mindspring.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Try this then: #!/bin/sh #Default options LINTCONF=LINT.CONF LINTCONF1=LINT.CONF1 ARCH=`uname -m` ARCH1=$ARCH SRCDIR=/sys START=0 END=0 NOCLEAN=0 TMPDIR=/tmp/makedepend WD=`pwd` #Read the command line while [ $# -ne 0 ] do case "$1" in --src-dir) shift SRCDIR=$1 shift ;; --conf-dir) shift CNFDIR=$1 shift ;; --compile-dir) shift CMPDIR=$1 shift ;; --arch) shift ARCH=$1 shift ;; --no-copy) NOCOPY="YES" shift ;; --no-clean) shift NOCLEAN=1 ;; --start) shift START=$1 shift ;; --end) shift END=$1 shift ;; --clean) rm -f ${LINTCONF} ${LINTCONF1} bad_list LINT tmp exit 0 ;; *) CMD=`basename $0` echo "USAGE: $CMD [option]" echo echo "Where option is any of:" echo echo "--help" echo " This help" echo "--clean" echo " Clean the work directory" echo "--no-clean" echo " Don't clean up" echo "--src-dir :" echo " The top of the kernel source default: /sys" echo "--conf-dir :" echo " The conf files dir default: //conf" echo "--compile-dir :" echo " The dir the kernel to run make [depend] in default: /compile" echo "--arch :" echo " The Arch to build for default: $ARCH1" echo "--start " echo "--end " echo " Only build kernels numbered between and " exit 1 ;; esac done # Move the options in the order we wan't them # This script builds in a decending order so $START is always larger then $END if [ $START -lt $END ] then STARTTMP=$START START=$END END=$STARTTMP fi # If we change end then finish on the one we said to if [ $END -ne 0 ] then END=`expr $END - 1` fi # Set the default dir for running make COMPDIR=$SRCDIR/$ARCH/compile # If is set as an option change it if [ $CMPDIR ] then COMPDIR=$CMPDIR fi # Set the default dir for the config files CONFDIR=$SRCDIR/$ARCH/conf # If is set as an option change it if [ $CNFDIR ] then CONFDIR=$CNFDIR fi # Clean the build directories if [ $NOCLEAN -eq 0 ] then rm -f ${LINTCONF} ${LINTCONF1} bad_list LINT tmp rm -f ${CONFDIR}/DEPEND.* rm -fr ${TMPDIR} mkdir -p ${TMPDIR} touch ${TMPDIR}/pass touch ${TMPDIR}/fail.config touch ${TMPDIR}/fail.depend touch ${TMPDIR}/fail.make fi # Do the copying on LINT/NOTES if [ $NOCOPY ] then : else cd ${CONFDIR} make LINT cd $WD cp ${CONFDIR}/LINT ./ fi if [ -f LINT ] then : else echo "Error: No LINT/NOTES File" exit 1 fi if [ -f depend ] then : else touch depend fi # The changeable Config Options from LINT/NOTES cat LINT | grep "^options" > ${LINTCONF} cat LINT | grep "^device" >> ${LINTCONF} cat LINT | grep "^pseudo-device" >> ${LINTCONF} # Make a list of unwanted options # The first character is always a ! awk '{ if ($1 =="!") print $2 " " $3 }' < depend > bad_list # Remove the unwanted options BADLINES=`awk '{ nlines++ } END { if ( nlines ) { print nlines } else { print "0" } }' < bad_list` while [ ${BADLINES} -ne 0 ] do LINE=`cat bad_list | head -n ${BADLINES} | tail -n 1` BADTYPE=`echo ${LINE} | awk '{print $1}'` BADDEV=`echo ${LINE} | awk '{print $2}'` cat ${LINTCONF} | awk "{ if ((\$1 == \"$BADTYPE\") && (\$2 ~ \"$BADDEV\")) { } else { print \$0 } }" > ${LINTCONF}2 mv ${LINTCONF}2 ${LINTCONF} BADLINES=`expr $BADLINES - 1` done rm -f bad_list # Unchangable Config Options from LINT/NOTES cat LINT | grep "^ident" > ${LINTCONF1} cat LINT | grep "^machine" >> ${LINTCONF1} cat LINT | grep "^maxusers" >> ${LINTCONF1} cat LINT | grep "^makeoptions" >> ${LINTCONF1} cat LINT | grep "^cpu" >> ${LINTCONF1} # If start is set use it as the first config if [ $START -eq 0 ] then START=`awk '{ nlines++ } END { print nlines }' < ${LINTCONF}` fi LINE=$START #echo $LINE > no_lines # Build the config files for LINT/NOTES in $CONFDIR # The file is always called DEPEND.${LINE} while [ ${LINE} -ne $END ] do cat ${LINTCONF1} > ${CONFDIR}/DEPEND.${LINE} awk "{ line++; if ( line == $LINE ) printf \"#\"; print \$0}" < ${LINTCONF} >> ${CONFDIR}/DEPEND.${LINE} LINE=`expr $LINE - 1` done # Do the builds LINE=$START while [ $LINE -ne $END ] do cd ${CONFDIR} config DEPEND.${LINE} > ${TMPDIR}/${LINE}.config if [ $? -eq 0 ] then cd ${COMPDIR}/DEPEND.${LINE} make clean > /dev/null 2>&1 make depend > ${TMPDIR}/${LINE}.depend 2>&1 if [ $? -eq 0 ] then make > ${TMPDIR}/${LINE}.make 2>&1 if [ $? -eq 0 ] then echo $LINE >> ${TMPDIR}/pass else echo $LINE >> ${TMPDIR}/fail.make fi else echo $LINE >> ${TMPDIR}/fail.depend fi else echo $LINE >> ${TMPDIR}/fail.config fi make clean > /dev/null 2>&1 LINE=`expr $LINE - 1` done To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message