Results 1 to 8 of 8

Thread: How to make my kernel leaner ?

  1. #1
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935

    How to make my kernel leaner ?

    Here is my new kernel.

    Code:
    -rw-r--r--    1 root     root       665509 Oct 27 08:22 vmlinuz-2.2.20-idepci
    -rw-r--r--    1 root     root       850860 Oct  3 22:08 vmlinuz-2.4.22-1-686
    -rwxr-xr-x    1 root     root      2907869 Dec  8 22:40 vmlinuz-2.4.23-1-686
    This seems to me that my new kernel is so much bloated. I believed major reason was compiling drivers ( such as sound, parallel and netcard support ) in the kernel than compiling as modules.

    So here is my question. If my box is not going to have any changes in hardware and configuration wise, what would be better? Leaner kernel with device drivers as modules or larger kernel but all support are in the kernel?

    All opinions are appreciated.

  2. #2
    Mentor
    Join Date
    Jun 2001
    Posts
    1,672

    Re:How to make my kernel leaner ?

    Lean kernel. Compile everything as modules and only load what you need. That's what I do.

  3. #3

    Re:How to make my kernel leaner ?

    hi compunuts,
    I tend to like modules because if something happens that I don't expect I figure I may need to unload a module or two. i would guess it does not matter much if one loads modules or has a monolithic kernel performance wise.


  4. #4
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935

    Re:How to make my kernel leaner ?

    [quote author=pbharris link=board=2;threadid=8316;start=0#msg75417 date=1071633075]
    if something happens that I don't expect I figure I may need to unload a module or two.[/quote]
    Such as??

    i would guess it does not matter much if one loads modules or has a monolithic kernel performance wise.
    Even if I have the kernel with 3 MB large? I see the only problem with larger kernel is it not being fit on the floppy for emergency boot disk.

    The only reason I'm having this undecisiveness is because I'm going to compile this kernel just for this box, only compile modules that I have the hardware for this specific box, kernel upgrades are more often than driver modules upgrade, and I will probably load all drivers that I need ( whether it's compiled in the kernel or load it as modules ).

    Thanks for the comments to both of you.

  5. #5

    Re:How to make my kernel leaner ?

    I rarely use parport or floppy modules, so i don't have them compiled into my kernel, also I will get a USB and plug it and need a module.

    Reasons why I may need to do this is sometimes things do happen, e.g. my internet is down and there happens to be a floppy i need access. if that will never happen to you then a monolithic may be better - but here is what someone else has to say:
    http://opensource.cis.ohio-state.edu...nel/node7.html

  6. #6
    Junior Member
    Join Date
    Aug 2003
    Posts
    76

    Re:How to make my kernel leaner ?

    lean.

    a modular kernel allows you to add modular support for devices you may get as well as being able to remove modules for devices that may die or not get used that often.

    there are things i prefer to have built in but having the majority of your kernel modular saves space and compatability issues.

  7. #7

    Re:How to make my kernel leaner ?

    I've found the best way to get a lean kernel is to actually invest the time involved in actually reading the 'help' information available for *every single option* in 'make xconfig', for *each new kernel* I compile. It's absolute drudgery, but the payoff is there. I have servers with 2.4.23 kernels that are under 1MB in size. My desktop is a little over 1MB, but I have more diverse needs of my multi-purpose desktop than my (relatively) fixed-universe servers.

    I always build the things into the kernel that I know would never get unloaded if they were modules, like ethernet drivers. Even if it makes the kernel a bit bigger, this is negligible when you consider that a kernel *can* be made to perform (relatively speaking) sluggishly if 'lsmod' shows 25 different modules, each of which may be loaded and unloaded dynamically by the kernel, which takes time.

    To keep it lean, I disable anything I know I won't use. I don't even build modules anymore for stuff I don't use. I used to kid myself into thinking I might use the v4l stuff one day - I'm over that now. There are a million things that you'd be surprised you *don't* need, while still having a fully functional system.

    PS - if you go experimenting down this route, ALWAYS save your config to a file before going forward!!!!!


  8. #8
    Guest

    Re:How to make my kernel leaner ?

    Heres a neat little trick:

    compile your kernel with -Os instead of -O2, it will save you some bytes here and there - plus in many cases it will make your kernel faster because it lowers the chance of a cache miss.

    To do this just edit the Makefile and search for CFLAGS it will be the 5th hit I think.

Similar Threads

  1. Maybe they will make one for the banjo
    By jro in forum General Chat
    Replies: 3
    Last Post: 07-09-2005, 01:50 AM
  2. make xconfig
    By cloverm in forum Linux - General Topics
    Replies: 7
    Last Post: 12-09-2003, 08:16 AM
  3. This'll make you laugh (or cry)
    By SwampDonkey in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 10-24-2002, 09:02 PM
  4. How to make .so's with g++?
    By GotAnyGrapes? in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 07-22-2002, 09:15 AM
  5. Forcing make
    By gmoreno in forum Linux - General Topics
    Replies: 5
    Last Post: 02-19-2002, 09:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •