1

I'm compiling the kernel for usage in portable USB stick. Which means it must run on any hardware, not just hardware of the machine where it is being compiled. What should I choose in kernel config for that? Is make allyesconfig suitable for this?

Just in case, I'm doing this because stock kernels for my operating system (Debian Stretch) don't include the latest drivers I need (touchpad support for some 2019 Lenovo laptops appeared only in 5.1)

  • check out the knoppix distribution ... the live CD boots on almost everything – jsotola Jun 18 at 5:20
1

Instead of compiling a custom kernel, you can just add the relevant kernel modules to your initramfs. In my project I just created a file inside the initramfs-tools folder called "modules" where I listed each module to be loaded, then I ran:

mkinitramfs -o "initrd.img" initramfs-tools

to build it.

More info can be found here: http://manpages.ubuntu.com/manpages/trusty/man8/initramfs-tools.8.html


If you just want the desktop environment to have them, then adding modules can be done by editing the /etc/modules file to load the modules automagically at boot time.

1

make allyesconfig builds as many drivers into the main kernel as possible, which makes for a huge kernel file. The <kernel source>/Documentation/admin-guide/README.rst says:

Having unnecessary drivers will make the kernel bigger, and can under some circumstances lead to problems: probing for a nonexistent controller card may confuse your other controllers.

Also:

The "kernel hacking" configuration details usually result in a bigger or slower kernel (or both), and can even make the kernel less stable by configuring some routines to actively try to break bad code to find kernel problems (kmalloc()). Thus you should probably answer 'n' to the questions for "development", "experimental", or "debugging" features.

make allmodconfig builds as many drivers as loadable modules as possible, so it might be a better starting point than make allyesconfig.

You might consider grabbing a linux-config package from Debian Testing or from Stretch-backports and picking the kernel configuration from it. That's only a few kernel releases away from 5.1, so it should not be too hard to run make oldconfig with that configuration, and reading the help text before deciding on any kernel features added in versions 4.20, 5.0 and 5.1.

Note that the kernel packages from Debian should be already configured to be as generic as possible, and using that as a basis for your new kernel configuration might allow you to avoid some pitfalls with debugging features or settings related to system console. Debugging a kernel configuration that fails with no viable system console drivers is a special kind of nuisance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.