0

I would like to set CONFIG_STRICT_DEVMEM=n and recompile my kernel in order to try out what @Oliv suggested in the comments of my question on stackoverflow.

I am following the BuildYourOwnKernel tutorial on the ubuntu wiki:

$ git clone git://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git
$ cd ubuntu-bionic/
$ chmod a+x debian/rules
$ chmod a+x debian/scripts/*
$ chmod a+x debian/scripts/misc/*
$ fakeroot debian/rules clean
$ sudo fakeroot debian/rules editconfigs
dh_testdir;
/bin/bash -e debian/scripts/misc/kernelconfig editconfigs
Do you want to edit config: amd64/config.flavour.generic? [Y/n] Y

and I face the following menu: enter image description here

I have searched arround in the hope of finding the variable that I need to change (CONFIG_STRICT_DEVMEM), but I didn't find it.

Most of the resources that I find on the internet elaborate on compiling/building the kernel, but I didn't find anything on actually making specific changes.

Could someone please point me in the right direction?

EDIT 1:

A file:

./build/.config

is created when sudo fakeroot debian/rules editconfigs is aborted.

$ cat ./build/.config | grep CONFIG_STRICT_DEVMEM

returns

CONFIG_STRICT_DEVMEM=y
CONFIG_STRICT_DEVMEM=y

I set these variables to n and ran

fakeroot debian/rules binary-headers binary-generic binary-perarch

which ended in an error:

/bin/bash: gawk: command not found
debian/rules.d/2-binary-arch.mk:123: recipe for target 'install-generic' failed
make: *** [install-generic] Error 127

EDIT 2:

Now I am following a different tutorial and @Oliv's advice:

  • I installed gawk
  • I ran make menuconfig to generate a file called .config at the root of the git repository.
  • I set CONFIG_STRICT_DEVMEM from =y to =n
  • I ran make menuconfig again.
  • cat .config | grep CONFIG_STRICT_DEVMEM returns # CONFIG_STRICT_DEVMEM is not set
  • Now I am running make && make modules_install && make install as root.

I will report any further progress...

0

Ok it worked out.

Here is a general "recipe" for people who want to modify their kernel

  • Use ll /proc/ | grep conf and ll /boot/ | grep conf to locate your config file.

  • Check how the variable of interest is configured using path_to_config | grep variable_of_interest or unzip it if necessary: path_to_config.gz | gunzip | grep variable_of_interest

If you want to change the value of one of these variables you need to do the following:

  • Clone the git repository that contains your kernel. I used:

    git clone git://kernel.ubuntu.com/ubuntu/ubuntu-bionic.git

    replace bionic with the code name of your operating system.

  • Install software:

    sudo apt-get build-dep linux-image-$(uname -r) && sudo apt-get install gawk

  • cd ubuntu-bionic/ again replace bionic with the codename of your OS.

  • Make the following files executable:

    chmod a+x debian/rules chmod a+x debian/scripts/* chmod a+x debian/scripts/misc/*

  • Run fakeroot debian/rules clean

  • Copy your current configurations into the root of the git repository:

    cp path_to_config ./.config

  • Configure .config according to your needs. I recommend setting CONFIG_DEBUG_INFO=n and CONFIG_DEBUG_INFO_DWARF4=n in order to reduce the compilation time and in order to avoid using up so much disk space during compilation.

  • Run:

    sudo su make menuconfig make && make modules_install && make install

Now be patient...

In my case path_to_config | grep variable_of_interest still returned the old configuration uppon completion of the above steps, but the changes had been made to the kernel and it was working as required.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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