1

I am compiling a custom linux kernel. I want to set some sysctl values at kernel compile time. Defaults I want are different to the defaults kernel sets.

Is there a way to do this?

Please note I do understand that this can be set via /etc/sysctl.conf , but I don't want do that. Reason is I want some settings to be active on kernel boot and do not want to wait until /etc/sysctl.conf is read.

  • 1
    Why would you want to do that? There is, you can modify the source code, however the modifications are highly dependent on the intended sysclt variables, and can be non trivial to do. And even if successful, you will have to patch and compile all the kernel versions; with the added difficulty than when migrating between kernel major versions, you may have to redo again the work. e.g. sysctl is a standard, portable and painless way to do that; yours is not. Even openWRT that intends to be lightweith, uses sysctl. – Rui F Ribeiro Jun 13 '16 at 11:04
  • Reason I want to do this? A) I want the settings be active the moment kernel is booted. This is useful for settings that apply to hardware. B) This system is meant to be a minimal embedded system, so I want least complexity in userland. C) There is no requirement for these settings to be configurable at run time. – KernNewbie Jun 13 '16 at 12:09
  • If I asked, maybe I was hoping you to say something different from the question. – Rui F Ribeiro Jun 13 '16 at 16:27

Your Answer

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

Browse other questions tagged or ask your own question.