Re: new IRQ scalability changes in 2.3.48

From: David Hinds (dhinds@valinux.com)
Date: Tue Mar 21 2000 - 15:33:25 EST


> What would be *really* nice is if there were a file, say for example,
> /usr/src/linux/modules/Rules.make which could be simply included by
> stand-alone module maintainers in their Makefiles so they can grab all
> of the right .config and module symbols.

I think I have something better still. I have a script (evolved from
the PCMCIA Configure script) which just looks at your current kernel
and available modules, and generates .config, version.h, config.h, and
modversions.h.

(the reason this is nice, is that it lets you build modules given only
a clean set of header files for the current kernel: you don't need to
unpack a complete kernel source tree, and don't need to rebuild your
kernel just to get a consistent .config/autoconf.h/etc that matches
the kernel you're running. Which is much closer to a turnkey solution
for the average linux user running a stock kernel that came with their
distribution)

I'll attach it here... it's a bit long but not too horrible. It does
not reconstruct a complete .config file, but does determine all
options that impact the layout of kernel data structures, at least for
x86. It also determines a bunch of things that are probably less
useful for module building. It basically reports most things that are
easy to figure out from info in /proc or /lib/modules.

-- Dave

#!/bin/sh
#
# Configure $Revision: 1.5 $ $Date: 2000/01/26 23:00:54 $
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and
# limitations under the License.
#
# The initial developer of the original code is David A. Hinds
# <dhinds@pcmcia.sourceforge.org>. Portions created by David A. Hinds
# are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
#
# Alternatively, the contents of this file may be used under the terms
# of the GNU Public License version 2 (the "GPL"), in which case the
# provisions of the GPL are applicable instead of the above. If you
# wish to allow the use of your version of this file only under the
# terms of the GPL and not to allow others to use your version of this
# file under the MPL, indicate your decision by deleting the provisions
# above and replace them with the notice and other provisions required
# by the GPL. If you do not delete the provisions above, a recipient
# may use your version of this file under either the MPL or the GPL.
#
#=======================================================================

CONFIG=config
CONFIG_H=config.h
MODVER=modversions.h
VERSION=version.h

rm -f $CONFIG $CONFIG_H $MODVER $VERSION

cat << 'EOF' > $CONFIG
#
# Kernel configuration generated by 'kconfig'
#
EOF

cat << 'EOF' > $CONFIG_H
/*
  Kernel configuration generated by 'kconfig'
*/
#ifndef _FAKE_CONFIG_H
#define _FAKE_CONFIG_H

#define AUTOCONF_INCLUDED

EOF

#=======================================================================

section ()
{
    echo "" >> $CONFIG
    echo "# $1" >> $CONFIG
    echo "" >> $CONFIG
    echo "" >> $CONFIG_H
}

write_bool() {
    value=`eval echo '$'$1`
    if [ "$value" = "m" ] ; then
        echo "$1=m" >> $CONFIG
        echo "#undef $1" >> $CONFIG_H
        echo "#define ${1}_MODULE 1" >> $CONFIG_H
    elif [ "$value" = "y" ] ; then
        echo "$1=y" >> $CONFIG
        echo "#define $1 1" >> $CONFIG_H
    else
        echo "# $1 is not defined" >> $CONFIG
        echo "#undef $1" >> $CONFIG_H
    fi
}

sym_check () {
    eval "$1=n"
    if $KSYMS | grep "$2" >/dev/null ; then eval "$1=y" ; fi
    if [ "$3" -a -e $MODDIR/$3 ] ; then eval "$1=m" ; fi
    write_bool $1
}

mod_check () {
    eval "$1=n"
    if [ -e $MODDIR/$2 ] ; then eval "$1=m" ; fi
    write_bool $1
}

proc_check () {
    eval "$1=n"
    if [ -e $2 ] ; then eval "$1=y" ; fi
    if [ "$3" -a -e $MODDIR/$3 ] ; then eval "$1=m" ; fi
    write_bool $1
}

fs_check () {
    eval "$1=n"
    if grep " $2" /proc/filesystems > /dev/null ; then eval "$1=y" ; fi
    if [ -e $MODDIR/fs/$2.o ] ; then eval "$1=m" ; fi
    write_bool $1
}

misc_check () {
    eval "$1=n"
    if grep " $2" /proc/misc > /dev/null ; then eval "$1=y" ; fi
    if [ -e $MODDIR/char/$3.o ] ; then eval "$1=m" ; fi
    write_bool $1
}

fb_check () {
    eval "$1=n"
    if grep " $2" /proc/fb > /dev/null ; then eval "$1=y" ; fi
    if [ "$3" -a -e $MODDIR/video/$3.o ] ; then eval "$1=m" ; fi
    write_bool $1
}

ide_check () {
    eval "$1=n"
    if grep "$2" /proc/ide/drivers > /dev/null 2>&1 ; then eval "$1=y" ; fi
    if [ -e $MODDIR/block/$2.o ] ; then eval "$1=m" ; fi
    write_bool $1
}

dev_check () {
    eval "$1=n"
    if grep " $2" /proc/devices > /dev/null ; then eval "$1=y" ; fi
    if [ "$3" -a -e $MODDIR/$3 ] ; then eval "$1=m" ; fi
    write_bool $1
}

#=======================================================================

# What kernel are we compiling for?

version () {
    expr $1 \* 65536 + $2 \* 256 + $3
}

CUR_RELEASE=`uname -r`
ARCH=`uname -m | sed -e 's/i.86/i386/'`
TMP=`uname -r | sed -e 's/\(.\)\.\(.\)\.\([0-9]*\).*/\1 \2 \3/'`
VERSION_CODE=`version $TMP`
MODDIR=/lib/modules/$CUR_RELEASE

if [ $ARCH = "ppc" ] ; then
    CONFIG_ISA=n
    AFLAGS="-fno-builtin -msoft-float"
    if [ $VERSION_CODE -ge `version 2 1 26` ] ; then
        AFLAGS="$AFLAGS -ffixed-r2"
    fi
elif [ $ARCH = "alpha" ] ; then
    AFLAGS="-mno-fp-regs"
    if [ $VERSION_CODE -ge `version 2 1 26` ] ; then
        AFLAGS="$AFLAGS -ffixed-8"
    fi
fi

echo "#define UTS_RELEASE \"$CUR_RELEASE\"" > $VERSION
echo "#define LINUX_VERSION_CODE $VERSION_CODE" >> $VERSION
echo "#define KERNEL_VERSION(a,b,c) (((a)<<16)+((b)<<8)+(c))" >> $VERSION

#=======================================================================

tweak () {
    if [ $VERSION_CODE -ge `version 2 2 0` ] ; then
        if [ $CONFIG_SMP = "y" ] ; then
            CONFIG_X86_IO_APIC=y
            CONFIG_X86_LOCAL_APIC=y
            write_bool CONFIG_X86_IO_APIC
            write_bool CONFIG_X86_LOCAL_APIC
        fi
    fi
}

if [ -x /sbin/ksyms ] ; then
    KSYMS="/sbin/ksyms -a"
else
    echo "Hmmm... /sbin/ksyms is broken. Using /proc/ksyms..."
    KSYMS="cat /proc/ksyms"
fi

if [ $ARCH = "i386" ] ; then
    sym_check CONFIG_1GB ^c01
    sym_check CONFIG_2GB ^801
    sym_check CONFIG_3GB ^401
fi
if [ $ARCH = "alpha" ] ; then
    sym_check CONFIG_ALPHA_LCA hwrpb
fi
if [ $ARCH = "i386" ] ; then
    proc_check CONFIG_MTRR /proc/mtrr
fi
sym_check CONFIG_SMP smp_invalidate_needed

section "General setup"

CONFIG_MODULES=1
write_bool CONFIG_MODULES
sym_check CONFIG_MODVERSIONS printk_R
sym_check CONFIG_KMOD request_module

sym_check CONFIG_NET sock_register
sym_check CONFIG_PCI pcibios
sym_check CONFIG_PCI_QUIRKS isa_dma_bridge_buggy
proc_check CONFIG_SYSCTL /proc/sys
proc_check CONFIG_SYSVIPC /proc/sys/kernel/shmmax
proc_check CONFIG_BSD_PROCESS_ACCT /proc/sys/kernel/acct
sym_check CONFIG_PARPORT parport misc/parport.o
sym_check CONFIG_PARPORT_PC parport_pc misc/parport_pc.o
sym_check CONFIG_APM apm_register_callback

section "Block devices"

dev_check CONFIG_BLK_DEV_FD fd block/fd.o
sym_check CONFIG_BLK_DEV_IDE ide_register block/ide-mod.o
ide_check CONFIG_BLK_DEV_IDEDISK ide-disk
ide_check CONFIG_BLK_DEV_IDECD ide-cd
ide_check CONFIG_BLK_DEV_IDETAPE ide-tape
ide_check CONFIG_BLK_DEV_IDEFLOPPY ide-floppy
dev_check CONFIG_BLK_DEV_LOOP loop block/loop.o
dev_check CONFIG_BLK_DEV_NBD nbd block/nbd.o
sym_check CONFIG_BLK_DEV_MD md_size block/md.o
dev_check CONFIG_BLK_DEV_RAM ramdisk block/rd.o
proc_check CONFIG_BLK_DEV_INITRD /proc/sys/kernel/real-root-dev

section "Networking options"

#sym_check CONFIG_NETLINK netlink_broadcast
#if [ $CONFIG_NETLINK = "y" ] ; then
# sym_check CONFIG_RTNETLINK rtnetlink
#fi
sym_check CONFIG_FIREWALL register_firewall
sym_check CONFIG_FILTER sk_run_filter
proc_check CONFIG_UNIX /proc/net/unix
sym_check CONFIG_INET inet_add_protocol
proc_check CONFIG_IP_MASQUERADE /proc/net/ip_masquerade
sym_check CONFIG_IPV6 ipv6_addr_type
sym_check CONFIG_NET_FASTROUTE dev_fastroute_stat
#sym_check CONFIG_IPX ipx_register
#sym_check CONFIG_ATALK ltalk_setup
#sym_check CONFIG_BRIDGE br_ioctl
#sym_check CONFIG_NET_HW_FLOWCONTROL netdev_register_fc
#sym_check CONFIG_NET_SCHED register_qdisc

#sym_check CONFIG_ARPD neigh_app_ns
#sym_check CONFIG_NETLINK_DEV netlink_attach
#sym_check CONFIG_NET_FC fc_setup
#sym_check CONFIG_NET_FDDI fddi_setup
#sym_check CONFIG_HIPPI init_hippi_dev

section "SCSI drivers"

sym_check CONFIG_SCSI scsi_register scsi/scsi_mod.o
dev_check CONFIG_BLK_DEV_SD sd scsi/sd_mod.o
dev_check CONFIG_CHR_DEV_ST st scsi/st.o
dev_check CONFIG_BLK_DEV_SR sr scsi/sr_mod.o
dev_check CONFIG_CHR_DEV_SG sr scsi/sg.o
#sym_check CONFIG_SCSI_LOGGING scsi_logging_level

section "Network devices"

sym_check CONFIG_DUMMY dummy_init net/dummy.o
sym_check CONFIG_PPP ppp_register net/ppp.o
mod_check CONFIG_SLIP net/slip.o
proc_check CONFIG_NET_RADIO /proc/net/wireless
sym_check CONFIG_TR tr_setup
proc_check CONFIG_IRDA /proc/irda net/irda.o

section "Character devices"

dev_check CONFIG_VT vcs
dev_check CONFIG_UNIX98_PTYS pty
dev_check CONFIG_SERIAL ttyS misc/serial.o
misc_check CONFIG_PSMOUSE psaux
misc_check CONFIG_NVRAM nvram char/nvram.o
misc_check CONFIG_RTC rtc
dev_check CONFIG_JOYSTICK js char/joystick.o
proc_check CONFIG_FTAPE /proc/ftape char/ftape.o

section "Filesystem drivers"

fs_check CONFIG_AUTOFS_FS autofs
fs_check CONFIG_ADFS_FS adfs
fs_check CONFIG_AFFS_FS affs
fs_check CONFIG_HFS_FS hfs
fs_check CONFIG_FAT_FS msdos
fs_check CONFIG_MSDOS_FS msdos
fs_check CONFIG_UMSDOS_FS umsdos
fs_check CONFIG_VFAT_FS vfat
fs_check CONFIG_ISO9660_FS iso9660
fs_check CONFIG_MINIX_FS minix
fs_check CONFIG_NTFS_FS ntfs
fs_check CONFIG_HPFS_FS hpfs
fs_check CONFIG_PROC_FS proc
fs_check CONFIG_DEVPTS_FS devpts
fs_check CONFIG_QNX4FS_FS qnx4
fs_check CONFIG_ROMFS_FS romfs
fs_check CONFIG_EXT2_FS ext2
fs_check CONFIG_SYSV_FS sysv
fs_check CONFIG_UFS_FS ufs
fs_check CONFIG_EFS_FS efs

fs_check CONFIG_CODA_FS coda
fs_check CONFIG_NFS_FS nfs
sym_check CONFIG_NFSD do_nfsservctl fs/nfsd.o
sym_check CONFIG_SUNRPC rpc_allocate misc/sunrpc.o
sym_check CONFIG_LOCKD lockd_up fs/lockd.o
fs_check CONFIG_SMB_FS smbfs
fs_check CONFIG_NCP_FS ncpfs

section "Framebuffer drivers"

proc_check CONFIG_FB /proc/fb
if [ "$CONFIG_FB" = "y" ] ; then
    CONFIG_DUMMY_CONSOLE=y
    write_bool CONFIG_DUMMY_CONSOLE
    fb_check CONFIG_FB_VESA "VESA VGA" vesafb
    fb_check CONFIG_FB_VGA16 "VGA16 VGA" vga16fb
    fb_check CONFIG_FB_MATROX "MATROX VGA" matroxfb
    fb_check CONFIG_FB_VIRTUAL "Virtual FB", vfb
fi

echo "" >> $CONFIG ; echo "" >> $CONFIG_H

proc_check CONFIG_MAGIC_SYSRQ /proc/sys/kernel/sysrq

echo "" >> $CONFIG_H
echo "#endif" >> $CONFIG_H

#=======================================================================

echo "#ifndef __FAKE_MODVERSIONS_H" > $MODVER
echo "#define __FAKE_MODVERSIONS_H" >> $MODVER
$KSYMS | sed -ne 's/.* \(.*\)_R\([0-9a-f]*\)/\1 \2/p' | \
    awk '{ printf "#define %s\t%s_R%s\n", $1, $1, $2 }' \
>> $MODVER
echo "#endif" >> $MODVER

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:34 EST