Automatic kernel configuration tool

8,711

Solution 1

Now, that we talked about this a bit in the comments the answer for you is: no, there isn't.

The main reason for that conclusion is that I think you are not looking for a tool to configure a kernel, but to automatically tune the kernel for your specfic (and yet unstated) use case.

As stated in the comments, you can skip unneeded drivers and compile the wanted drivers statically into the kernel. That saves you some time during the boot process, but not after that, because the important code is the same whether builtin or module.

Kernel tuning

The kernel offers some alternatives, you mentioned scheduler yourself. Which scheduler works best for you depends on your use case the applications you use and the load and kind of load you put on your system. No install-and-run program will determine the best scheduler for you, if there even is such a thing.

The same holds for buffers and buffer sizes. Also, a lot of (most?) settings are or at least can be set at runtime, not compile time.

Optimal build options

Also without automation, you can optimize the build options when compiling the kernel, if you have a very specialized CPU. I know of the Buildroot environment which gives you a nice framework for that. This may also help you if you are looking to create the same OS for many platforms. While this helps you building, it will not automate kernel tuning.

That's why I and others tell you to use a generic kernel. Without a specific problem to solve building your own kernel is not worth while. Maybe you can get more help by identifying/stating the problem you are trying to solve.

Solution 2

If you are worrying about boot time, the kernel load time is a fraction of that. Worry about what happens later, use e.g. systemd to speed up boot by paralellizing, configure to not run useless daemons, ... Systemd has tools to analyze the boot times. If the worry is space, disks are cheap.

Your time in futzing around, setting up the myriard configurations, getting the right kernel to each machine, fixing configurations/recompiling when something changes, ... is much more valuable than a few seconds shaved off booting.

Share:
8,711

Related videos on Youtube

vprisivko
Author by

vprisivko

Updated on September 18, 2022

Comments

  • vprisivko
    vprisivko over 1 year

    Is there any developed automatic linux kernel configuration tool?

    I have found a method of make localmodconfig, but it is certainly very limited. I have searched the web but unfortunately have not come to any acceptable result.

    Although I am quite conversant in kernel configuration issues, I would like to optimize my time wasted on configuration every new system with particular hardware, since it is rather technical work than creative.

    • goldilocks
      goldilocks over 11 years
      You mean like something that would parse stuff from lspci, lsusb, /proc/cpuinfo etc. and set the appropriate options in a config file? I'm not sure if there is really a big demand for that, since generic modular kernels work well for people who don't want to muck around, and it is hard to see what difference that would make in the end.
    • YoloTats.com
      YoloTats.com over 11 years
      Using a generic kernel from your Linux distribution and then run make localmodconfig is a easy solution. Additionally, there exists some (probably outdated) tools like cateee.net/autokernconf .
    • peterph
      peterph over 11 years
      @goldilocks the difference is in size and hence also in the time spent on loading the kernel - which is important if you target fast boot (of course one needs to have some things compiled in, at least to bring up the /). More importantly perhaps: the code you don't have [compiled and installed] can not harm you.
    • Bananguin
      Bananguin over 11 years
      If you consider kernel configuration as a waste of time don't do it but stick with a generic one. There really isn't that much to be gained by building your own kernel. There are few use cases where an "optimized" kernel performs notably better then a "working" kernel.
    • vprisivko
      vprisivko over 11 years
      @user1129682 Perhaps I would decide in favor of generic kernel, but could you provide any references that the performance is not affected?
    • goldilocks
      goldilocks over 11 years
      @peterph : Sorry, I did not mean that I think custom kernels are pointless, I meant that I'm dubious how significant a tool that detects hardware and sets some options for you would be -- that is really the easy part anyway. I do usually roll my own kernels on machines I use a lot, but I do that mostly to stay in touch (having toyed around with writing modules a bit). I honestly do not think it results in a performance improvement, and WRT "the code you don't have can't hurt you", generic kernels are modular, so most of that code is not loaded anyway.
    • goldilocks
      goldilocks over 11 years
      So: the idea is not a totally bad one, I just think few people would be interested in using it and it would be a hassle to keep maintained. @vprisivko : I think it makes more sense to look for references proving how a custom kernel can improve performance, if by "custom" we just mean you've built in appropriate hardware options instead of using modules, etc. Again: configuring your own kernel is a good way to learn and stay abreast of things, but I just can't see it making any real difference performance wise.
    • peterph
      peterph over 11 years
      @goldilocks Indeed, maintaining such a program would be a nightmare, plus drivers are just a piece of the puzzle - there is lot of other things (schedulers, filesystems, generic things going through the whole kernel). But the drivers are probably the most tricky thing to figure out. As for modularity: it's a good thing, but you can still happen to load a crappy module that crashes your system. There is a reason why enterprise distributions often consider unloading a module to be tainting the kernel.
    • vprisivko
      vprisivko over 11 years
      I think that processor type option in kernel affects the performance almost certainly. Schedulers as well, but not that significantly, I think. Sure I understand the issues of maintaining such a tool, but there exists a well-known project nmap that has to be aware of program fingerprints in order to stay up-to-date.
  • vprisivko
    vprisivko over 11 years
    Thanks for the answer, it seems to be truthful. But what about CPU type if you have not very specialized CPU? Is it worthwhile to configure manually at least this option?
  • Bananguin
    Bananguin over 11 years
    Depends on your CPU. I'd guess the gerneric x86 and x86_64 kernels gernerally suffice about the others, I cannot tell.
  • Pro Backup
    Pro Backup about 10 years
    @Bananguin Buildroot doesn't seem to give optimal build options in the definition of find the most optimal compiler options to get the fastest running code (=compiler flag selection). Buildroot automates the building process of your embedded system and eases the cross-compilation process.
  • Bananguin
    Bananguin about 10 years
    @ProBackup: I never said it gives optimal build options, I said its a framework for optimizing build options. Just because it lets you set options explicitly which are set for you (or even not available at all) when building a kernel natively.
  • Kirollos Morkos
    Kirollos Morkos over 4 years
    The boot-up process is no issue even without systemd - see various websites that debunked this systemd-myth. I think you may have misread the question - the question was about KERNEL configuration to be less tedious, not what happens at a later time: " I would like to optimize my time wasted on configuration every new system with particular hardware", and my use case is very similar. Not the same, but similar. I also need a tool to make configuration simpler. I would also suggest to avoid telling others how THEY spend their time - instead, focus on the issue at hand.