Kernel configuration - Slackware

This is a discussion on Kernel configuration - Slackware ; Hi there. How to understand what options are enables in standard kernel on Slackware 12? (I need to compile new kernel with thees options.)...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Kernel configuration

  1. Kernel configuration

    Hi there. How to understand what options are enables in standard
    kernel on Slackware 12? (I need to compile new kernel with thees
    options.)


  2. Re: Kernel configuration

    botzko wrote:
    > Hi there. How to understand what options are enables in standard
    > kernel on Slackware 12? (I need to compile new kernel with thees
    > options.)


    Copy /boot/config to /usr/src/linux/.config

    regards Henrik
    --
    The address in the header is only to prevent spam. My real address is:
    hc1(at)poolhem.se Examples of addresses which go to spammers:
    root@localhost postmaster@localhost


  3. Re: Kernel configuration

    Henrik Carlqvist wrote:
    > botzko wrote:
    >> Hi there. How to understand what options are enables in standard
    >> kernel on Slackware 12? (I need to compile new kernel with thees
    >> options.)

    >
    > Copy /boot/config to /usr/src/linux/.config


    or, in the time-old tradition of "ask eight slackers, get ten answers", do:

    zcat /proc/config >/usr/src/linux/.config


    --
    Joost Kremers joostkremers@yahoo.com
    Selbst in die Unterwelt dringt durch Spalten Licht
    EN:SiS(9)

  4. Re: Kernel configuration

    On Aug 27, 3:03 am, Joost Kremers wrote:
    > Henrik Carlqvist wrote:
    > > botzko wrote:
    > >> Hi there. How to understand what options are enables in standard
    > >> kernel on Slackware 12? (I need to compile new kernel with thees
    > >> options.)

    >
    > > Copy /boot/config to /usr/src/linux/.config

    >
    > or, in the time-old tradition of "ask eight slackers, get ten answers", do:
    >
    > zcat /proc/config >/usr/src/linux/.config
    >
    > --
    > Joost Kremers joostkrem...@yahoo.com
    > Selbst in die Unterwelt dringt durch Spalten Licht
    > EN:SiS(9)


    10x a lot It will help me very much .


  5. Re: Kernel configuration

    Joost Kremers -- Mon, 27 Aug 2007 00:03:37 +0000:

    > Henrik Carlqvist wrote:
    >> botzko wrote:
    >>> Hi there. How to understand what options are enables in standard
    >>> kernel on Slackware 12? (I need to compile new kernel with thees
    >>> options.)

    >>
    >> Copy /boot/config to /usr/src/linux/.config

    >
    > or, in the time-old tradition of "ask eight slackers, get ten answers",
    > do:
    >
    > zcat /proc/config >/usr/src/linux/.config


    Do you have any idea how long that compile will take? Better remove some
    unnecesary modules! Ok, figuring out which modules to remove will take
    more time than the extra compile time... well, try my script! I have
    tested it, and the kernel did compile and run, and compilation was a lot
    faster.

    You don't have to be root to run the script but should be running a
    generic 2.6 kernel. It parses the slackware's generic .config and removes
    modules when not currently loaded. You may want to add some modules
    you'll need occasionally after running this script.

    mkdir /home/$USER/kbuild/
    cd /home/$USER/kbuild/

    Save this script as 'debloatconfig' in this directory

    #!/bin/bash
    # Copyright (c) 2007 Roel Kluin GNU GPL v.2
    get_mod2conf_makefile() {
    sed -e :a -e '/\\$/N; s/\\\n//; ta' "$3/$2/Makefile" | \
    sed -n "s/^\W*obj-\$(CONFIG_\([A-Z0-9_]*\))\W*+=.*$1\.o$/\1/p";
    }

    for module in `/sbin/lsmod |cut -d" " -f1 | tail +2`; do
    license="`/sbin/modinfo -l "$module"`";
    if [ -n "${license##*GPL*}" ]; then
    echo "WARNING: $module has licence \"$license\", when \
    built this kernel will not include this module" 1>&2;
    else
    module="`/sbin/modinfo -n $module`";
    dir="${module%/*}";
    if [ -n "${dir##*/kernel/*}" ]; then
    echo "WARNING: module not in kernel directory: $module" 1>&2;
    continue;
    fi
    mod="${module%.ko}";
    mod="${mod##*/}"
    dir="${ksrcdir}${dir#*/kernel/}";
    option="`get_mod2conf_makefile $mod $dir $1`";
    if [ -z "$option" ]; then
    echo "WARNING: no kernel config option found for $mod" 1>&2;
    else
    # loop since grep/sed may return more options
    for op in $option; do
    char_count=${#enable_option};
    enable_option="${enable_option/ $op /}";
    if [ $char_count -ne ${#enable_option} ]; then
    continue;
    fi
    enable_option="$enable_option $op";
    done
    fi
    fi
    done

    cat $2 | while read line; do
    option=${line##\#*}; # delete comment
    option=${option%=m*}; # preserve module options
    option=${option%%*=*}; # remove other non-module options
    if [ "${option#CONFIG_}" ]; then
    char_count=${#enable_option};
    enable_option="${enable_option/${option#CONFIG_}/}";
    if [ $char_count -eq ${#enable_option} ]; then
    echo "$option=n # changed by $0"
    else
    echo "$option=m"
    fi
    else
    echo "$line"; # non-module options, left unchanged
    fi
    done

    now run:

    chmod u+x debloatconfig
    zcat /proc/config.gz > std.config

    If the latter command didn't work, then the kernel you run lacks the
    CONFIG_IKCONFIG option. You may be able to find the .config from some
    other source.

    debloatconfig /usr/src/linux std.config > .config

    you may see some warnings, that you'll have to resolve manually using
    menuconfig (below).

    cd /usr/src/linux
    make O=/home/$USER/kbuild/ oldconfig

    if you want to upgrade to a newer kernel, go to the path of that kernel's
    sources and do again:

    make O=/home/$USER/kbuild/ oldconfig

    If source code was changed, between kernel versions, the state for the
    corresponding config options will be asked again.

    make O=/home/$USER/kbuild/ menuconfig

    There are a few reasons why I'd suggest you to review the settings after
    usage, however:
    * Compiled in options won't be changed, although changing them may
    benefit your hardware.
    * This script removes modules that are not loaded. This may include some
    modules you'll want to use occasionally.
    *resolve previous warnings

    The advantage is, that now you'll have to make much less changes.

+ Reply to Thread