You are not logged in.

#1 2011-05-15 23:52:32

ushimitsudoki
Member
From: Okinawa
Registered: 2010-07-20
Posts: 18
Website

Checking kernel config

Here are a couple of stupid shell (zsh) functions that I've been banging on to help check out the current kernel config.

Just wondering if anyone thinks this might be useful and worth expanding upon.

kc - returns any KConfig help text for the specified kernel option (don't put CONFIG_) in front
Example:

[✍]  ~ $ kc TMPFS                                                                                                                                                                          
config TMPFS
        bool "Virtual memory file system support (former shm fs)"
        depends on SHMEM
        help
          Tmpfs is a file system which keeps all files in virtual memory.

The code:

function kc() {
  export SEARCH_TERM=$1
  find /usr/src/linux-`uname -r` -name Kconfig -print0 | xargs -0 perl -ne '
    $/ = "";
    while (<>) {
      while (/^(config $ENV{'SEARCH_TERM'}\s.*)/sgm) { 
        print "$1\n";
     }
    }
  '
  unset SEARCH_TERM  
}

kcc - uses the above to go through every kernel config (that is enabled or built as a module)
Example:

[✍]  ~ $ kcc                                                                                                                                                                               
config 60XX_WDT
        tristate "SBC-60XX Watchdog Timer"
        depends on X86
        help
          This driver can be used with the watchdog timer found on some
          single board computers, namely the 6010 PII based computer.
          It may well work with other cards.  It reads port 0x443 to enable
          and re-set the watchdog timer, and reads port 0x45 to disable
          the watchdog.  If you have a card that behave in similar ways,
          you can probably make this driver work with your card as well.


config 64BIT
        depends on TILEGX
        def_bool y

[...snip...]

The code:

function kcc() {
  for i in `zcat /proc/config.gz | perl -ne '/^CONFIG_(.*)=[y|m]/; print "$1\n";' | sort | uniq`
  do
    kc $i
  done
}

Free Software, Free Society

Offline

Board footer

Powered by FluxBB