# Kernel infos [Newbie inside]

## GSnake

Hello guys. I'm starting to love linux and the best part, IMHO, is the kernel compiling. 

BUT, I've got a lot of doubts... how can I add new "features" to it? 

Like a new governor, a new built in module for a specific peripheral...

I prefer to create an "all-in" kernel (without using modules) but... If I want to add a new feature should I recompile it over and over again?

Last but not least, what does really genkernel do? Why should I use the "initramfs"?

Thank you guys!

----------

## DaggyStyle

 *GSnake wrote:*   

> Hello guys. I'm starting to love linux and the best part, IMHO, is the kernel compiling. 
> 
> BUT, I've got a lot of doubts... how can I add new "features" to it? 
> 
> Like a new governor, a new built in module for a specific peripheral...
> ...

 

have to considered reading the gentoo handbook? there is a section here about kernel config which explains it.

I refer my kernel as monolithic at most because of memory consumption that isn't needed.

genkernel suppose to build you a generic kernel which should work on all systems, it isn't customized to your system.

regarding initramfs, read this: http://en.gentoo-wiki.com/wiki/Initramfs

----------

## GSnake

 *DaggyStyle wrote:*   

>  *GSnake wrote:*   Hello guys. I'm starting to love linux and the best part, IMHO, is the kernel compiling. 
> 
> BUT, I've got a lot of doubts... how can I add new "features" to it? 
> 
> Like a new governor, a new built in module for a specific peripheral...
> ...

 

Yeah I'm already compiling my kernel so I know how to build in modules and so on... but if I would like to add a new governor like "smartassv2" (first name that came in my mind [Android governor])?

I'm currently using initramfs but as I can see it's useless for me... I'm going to disable it.

One last thing... this is my lsmod output, how can I improve my kernel by disabling useless modules?

```
Module                  Size  Used by

snd_hda_codec_hdmi     21089  1 

snd_hda_codec_idt      46666  1 

coretemp                5150  0 

hp_wmi                  6978  0 

sparse_keymap           2472  1 hp_wmi

arc4                    1274  2 

microcode               7348  0 

ath9k                  84138  0 

pcspkr                  1763  0 

mac80211              173491  1 ath9k

snd_hda_intel          20296  3 

ath9k_common            1848  1 ath9k

snd_hda_codec          62395  3 snd_hda_codec_hdmi,snd_hda_codec_idt,snd_hda_intel

joydev                  8663  0 

ath9k_hw              340277  2 ath9k,ath9k_common

snd_hwdep               5062  1 snd_hda_codec

ath                    14175  3 ath9k,ath9k_common,ath9k_hw

snd_pcm                56683  3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec

snd_timer              15529  1 snd_pcm

cfg80211              139281  3 ath9k,mac80211,ath

r8169                  41053  0 

snd                    48173  13 snd_hda_codec_hdmi,snd_hda_codec_idt,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer

snd_page_alloc          5977  2 snd_hda_intel,snd_pcm

rfkill                 13313  2 hp_wmi,cfg80211

sha256_generic          9821  0 

libiscsi               29771  0 

scsi_transport_iscsi    33492  1 libiscsi

fuse                   57475  1 

nfs                   118257  0 

lockd                  52035  1 nfs

sunrpc                145149  2 nfs,lockd

jfs                   138968  0 

scsi_wait_scan           695  0 

hid_sunplus             1377  0 

hid_sony                2496  0 

hid_samsung             2822  0 

hid_pl                  1297  0 

hid_petalynx            1906  0 

hid_gyration            2012  0 

aic94xx                64680  0 

libsas                 50796  1 aic94xx

lpfc                  443332  0 

qla2xxx               323706  0 

megaraid_sas           65771  0 

megaraid_mbox          24030  0 

megaraid_mm             6937  1 megaraid_mbox

megaraid               35896  0 

aacraid                68111  0 

sx8                    11252  0 

DAC960                 62212  0 

cciss                  43533  0 

3w_9xxx                29257  0 

3w_xxxx                20819  0 

mptsas                 33233  0 

scsi_transport_sas     21752  3 aic94xx,libsas,mptsas

mptfc                  10413  0 

scsi_transport_fc      38669  3 lpfc,qla2xxx,mptfc

scsi_tgt                8328  1 scsi_transport_fc

mptspi                 11327  0 

mptscsih               16717  3 mptsas,mptfc,mptspi

mptbase                54808  4 mptsas,mptfc,mptspi,mptscsih

atp870u                23977  0 

dc395x                 26843  0 

qla1280                19387  0 

imm                     8772  0 

parport                25095  1 imm

dmx3191d                9060  0 

sym53c8xx              63372  0 

gdth                   73075  0 

advansys               51810  0 

initio                 15391  0 

BusLogic               19357  0 

arcmsr                 23427  0 

aic7xxx               106128  0 

aic79xx               110304  0 

scsi_transport_spi     17592  5 mptspi,dmx3191d,sym53c8xx,aic7xxx,aic79xx

sg                     21140  0 
```

EDIT (I'm adding also lspci and lsusb outputs):

lspci:

```

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)

00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)

00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)

00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)

00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)

00:1c.2 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 3 (rev b4)

00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)

00:1c.5 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 6 (rev b4)

00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 8 (rev b4)

00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)

01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Seymour [Radeon HD 6400M Series]

24:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller (rev 30)

24:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller (rev 30)

24:00.3 System peripheral: JMicron Technology Corp. MS Host Controller (rev 30)

25:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)

26:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

27:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)

```

lsusb:

```

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 001 Device 003: ID 138a:003c Validity Sensors, Inc. 

Bus 002 Device 003: ID 1bcf:2805 Sunplus Innovation Technology Inc. 

Bus 002 Device 004: ID 03f0:311d Hewlett-Packard 

```

Laptop model: HP Probook 4530s

THanks!

----------

## DaggyStyle

there is no diff between enabling smartassv2 governor and enabling powersave, if it is in then you can enable it.

the best way to check llspci -k but it isn't fail proof.

----------

## GSnake

 *DaggyStyle wrote:*   

> there is no diff between enabling smartassv2 governor and enabling powersave, if it is in then you can enable it.
> 
> the best way to check llspci -k but it isn't fail proof.

 

I made some heavy mod to my kernel and now it's slim! But some devices haven't got any driver... could someone please help me?

lspci -k:

```

00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)

   Subsystem: Hewlett-Packard Company Device 167c

00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 04)

   Subsystem: Hewlett-Packard Company Device 167c

24:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller (rev 30)

   Subsystem: Hewlett-Packard Company Device 167c

24:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller (rev 30)

   Subsystem: Hewlett-Packard Company Device 167c

24:00.3 System peripheral: JMicron Technology Corp. MS Host Controller (rev 30)

   Subsystem: Hewlett-Packard Company Device 167c

```

lsmod (slim!):

```
Module                  Size  Used by

ipv6                  413269  44 

arc4                    1780  2 

hp_wmi                 11638  0 

coretemp                9948  0 

kvm_intel             152745  0 

kvm                   485536  1 kvm_intel

ath9k                 143784  0 

mac80211              530749  1 ath9k

ath9k_common            2796  1 ath9k

ath9k_hw              461014  2 ath9k,ath9k_common

ath                    23129  3 ath9k,ath9k_common,ath9k_hw

microcode              13398  0 

cfg80211              255591  3 ath9k,mac80211,ath

r8169                  76981  0 

rfkill                 22757  2 hp_wmi,cfg80211

```

----------

## DaggyStyle

```

00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)

   Subsystem: Hewlett-Packard Company Device 167c

```

CONFIG_INTEL_MEI, valid from 3.6 (next kernel)

```

00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 04)

   Subsystem: Hewlett-Packard Company Device 167c

```

CONFIG_LPC_ICH and CONFIG_MFD_CORE

```

24:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller (rev 30)

   Subsystem: Hewlett-Packard Company Device 167c

24:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller (rev 30)

   Subsystem: Hewlett-Packard Company Device 167c

```

CONFIG_MMC

```

24:00.3 System peripheral: JMicron Technology Corp. MS Host Controller (rev 30)

   Subsystem: Hewlett-Packard Company Device 167c

```

might be CONFIG_MMC_SDHCI

----------

## GSnake

These are the "pure" .config names right?

May you explain where can I find them in the menuconfig gui? (I know how to set those parameters but I'd like their position in the menu)

Thank you very much!

----------

## NeddySeagoon

GSnake,

Make yourself a kernel following kernel-seeds.org. You will learn a lot if you think about what you are doing and why you are doing it.

For help with a seed, post to Pappys sticky in the unsupported software forum.

----------

## GSnake

 *NeddySeagoon wrote:*   

> GSnake,
> 
> Make yourself a kernel following kernel-seeds.org. You will learn a lot if you think about what you are doing and why you are doing it.
> 
> For help with a seed, post to Pappys sticky in the unsupported software forum.

 

I've already compiled a "stable" kernel.. I just wanted to know the extended infos in the menuconfig. That's all. I'm sorry if I went OT..

----------

## NeddySeagoon

GSnake,

No problem.  These general principles are still good today.

You will need a good deal more coffee than when that post was written as there is a lot more inthe kenel now.

----------

## GSnake

Ok thanks! I'm improving although!

By the way those flags don't help... still not working.  :Sad: 

----------

## DaggyStyle

 *GSnake wrote:*   

> Ok thanks! I'm improving although!
> 
> By the way those flags don't help... still not working. 

 

compile them as modules, you will be able to verify if there were compiled.

see mine:

```
dagg@NCC-5001-D ~ $ lspci -k; lsmod

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)

        Kernel modules: intel-agp

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)

        Kernel driver in use: pcieport

00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)

        Subsystem: Giga-byte Technology Device 1c3a

00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)

        Subsystem: Giga-byte Technology Device 5006

        Kernel driver in use: ehci_hcd

        Kernel modules: ehci-hcd

00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)

        Subsystem: Giga-byte Technology Device a002

        Kernel driver in use: snd_hda_intel

        Kernel modules: snd-hda-intel

00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)

        Kernel driver in use: pcieport

00:1c.2 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 3 (rev b5)

        Kernel driver in use: pcieport

00:1c.3 PCI bridge: Intel Corporation 82801 PCI Bridge (rev b5)

00:1c.4 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 5 (rev b5)

        Kernel driver in use: pcieport

00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)

        Subsystem: Giga-byte Technology Device 5006

        Kernel driver in use: ehci_hcd

        Kernel modules: ehci-hcd

00:1f.0 ISA bridge: Intel Corporation Z68 Express Chipset Family LPC Controller (rev 05)

        Subsystem: Giga-byte Technology Device 5001

        Kernel driver in use: lpc_ich

        Kernel modules: lpc_ich

00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family SATA AHCI Controller (rev 05)

        Subsystem: Giga-byte Technology Device b005

        Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)

        Subsystem: Giga-byte Technology Device 5001

        Kernel driver in use: i801_smbus

        Kernel modules: i2c-i801

01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI Manhattan [Mobility Radeon HD 5430 Series]

        Subsystem: PC Partner Limited Device 6000

        Kernel driver in use: radeon

        Kernel modules: radeon

01:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI Cedar HDMI Audio [Radeon HD 5400/6300 Series]

        Subsystem: PC Partner Limited Device aa68

        Kernel driver in use: snd_hda_intel

        Kernel modules: snd-hda-intel

03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

        Subsystem: Giga-byte Technology GA-EP45-DS5/GA-EG45M-DS2H Motherboard

        Kernel driver in use: r8169

        Kernel modules: r8169

04:00.0 PCI bridge: Integrated Technology Express, Inc. Device 8892 (rev 10)

06:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RV630 [Radeon HD 3600 Series]

        Subsystem: PC Partner Limited Device e540

        Kernel driver in use: radeon

        Kernel modules: radeon

06:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI RV635 HDMI Audio [Radeon HD 3600 Series]

        Subsystem: PC Partner Limited Device aa20

        Kernel driver in use: snd_hda_intel

        Kernel modules: snd-hda-intel

Module                  Size  Used by

xt_LOG                  7564  2 

it87                   38193  0 

hwmon_vid               3368  1 it87

snd_usb_audio         119499  2 

snd_usbmidi_lib        19568  1 snd_usb_audio

snd_rawmidi            20661  1 snd_usbmidi_lib

snd_seq_device          6016  1 snd_rawmidi

hid_uclogic             2880  0 

xfs                   438961  1 

exportfs                3856  1 xfs

iTCO_wdt                6489  0 

snd_hda_codec_hdmi     23934  2 

intel_agp              11757  0 

r8169                  52636  0 

i2c_i801                8449  0 

intel_gtt              16021  1 intel_agp

snd_hda_codec_realtek    62655  1 

lpc_ich                10877  0 

mii                     4591  1 r8169

mfd_core                3153  1 lpc_ich

radeon                851464  5 

ttm                    70544  1 radeon

coretemp                5236  0 

drm_kms_helper         29339  1 radeon

snd_hda_intel          25483  6 

snd_hda_codec          97496  3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel

snd_hwdep               6123  2 snd_usb_audio,snd_hda_codec

snd_pcm                80713  4 snd_usb_audio,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec

snd_timer              20189  1 snd_pcm

snd                    66605  27 snd_usb_audio,snd_usbmidi_lib,snd_rawmidi,snd_seq_device,snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer

snd_page_alloc          7613  2 snd_hda_intel,snd_pcm

ehci_hcd               40743  0 

```

----------

## NeddySeagoon

GSnake,

There are a few trivial errors we all make from time to time related to kernel building and installing.  Indeed, I once helped someone with sound for about 8 hours on IRC before I checked exactly how they were building and installing the kernel.  The problem was fixed after about 45 minutes but we just didn't know it.

These errors are made by both newbies and old hands alike. The difference is the old hands know the following

a) forgetting to mount /boot. The old kernel is still loaded. The problem may be fixed but it appears not.

First reboot on a new kernel, run 

```
uname -a
```

and look at 

```
 $ uname -a

Linux NeddySeagoon 3.5.2-gentoo #1 SMP PREEMPT Sun Aug 19 12:15:45 BST 2012 x86_64 AMD Phenom(tm) II X6 1090T Processor AuthenticAMD GNU/Linux
```

The #1 is the number of times this kernel has been built. The Sun Aug 19 12:15:45 BST 2012 is the build time and date 3.5.2-gentoo is the kernel version.

The big giveaway here is the date.  If you have just built a new kernel it should be nowish.

This also picks up things like not fixing grub.conf if needed, forgetting to run /sbin/lilo, if you are a lilo user (are there any left?).

b) Not having /usr/src/linux pointing to the right kernel. This is more an issue for people using out of kernel kernel modules, like the binary blob video drivers.

The driver is built and installed for the kernel pointed to by the symlink, which need not be the kernel you are running.

Do check that readlink /usr/src/linux points to the same kernel as uname -a.   It need not but if it doesn't you should understand why not.

There are a few other causes of not running the kernel you thought you were but the above tests catch them.  

Finding out where things went wrong is left as an exercise to the reader.

----------

