2

I am following the steps on Build Your Own Kernel

I got a stock kernel from Ubuntu's git main

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

Then proceeded to configure the kernel

LANG=C fakeroot debian/rules clean
LANG=C fakeroot debian/rules editconfigs

Go to "General Setup/Timer Subsystem/Timer Tick Handling"

Click on "Full Dynticks System"

Go to "Preemption Model"

Select "No Forced Preemption (server)"

Repeat that for the low latency kernel and at exit I get these configuration errors

check-config: /tmp/tmp.B1SJkC9a1n/CONFIGS/amd64-config.flavour.generic: loading config
check-config: /src/ubuntu-focal/debian.master/config/annotations loading annotations
check-config: FAIL (n != y): CONFIG_NO_HZ policy<{'amd64': 'y', 'arm64': 'y', 'armhf': 
     'y', 'i386': 'y', 'ppc64el': 'y', 's390x': 'y'}>
check-config: FAIL (n != -): CONFIG_CONTEXT_TRACKING_FORCE policy<{'amd64': '-', 
       'arm64': '-', 'armhf': '-', 'i386': '-', 'ppc64el': '-', 's390x': '-'}> 
       note<LP:1349028> mark<ENFORCED>
check-config: FAIL (n != y): CONFIG_NO_HZ_IDLE policy<{'amd64': 'y', 'arm64': 'y', 
       'armhf': 'y', 'i386': 'y', 'ppc64el': 'y', 's390x': 'y'}> note<LP:1413968>
check-config: FAIL (y != n): CONFIG_NO_HZ_FULL policy<{'amd64': 'n', 'arm64': 'n', 
       'armhf': 'n', 'ppc64el': 'n'}>
check-config: FAIL (- != y): CONFIG_TICK_CPU_ACCOUNTING policy<{'amd64': 'y', 'arm64': 'y', 
       'armhf': 'y', 'i386': 'y', 'ppc64el': 'y', }>
check-config: FAIL (y != n): CONFIG_VIRT_CPU_ACCOUNTING_GEN policy<{'amd64': 'n', 
       'arm64': 'n', 'armhf': 'n', 'ppc64el': 'n'}>

If I proceed to compile the binary, it will eventually fail.

I feel like I'm going on a wild goose chase here by trying to tweak parameters manually. Is there a missing step here somewhere?

I am very confused by these check-config messages, I am not sure what they mean.

Note: I made sure I could fully compile a kernel without the modifications above. It works.

3 Answers3

2

I have never had much success using the referenced method for compiling the kernel. The configuration change you are attempting to make has some follow on configuration dependencies and they appear to be a challenge for check-config. If I just make the one change and then let the compile process figure out the rest, I get:

doug@s19:~/kernel/linux$ scripts/diffconfig .config-6.0-rc5 .config
-TICK_CPU_ACCOUNTING y
 NO_HZ_FULL n -> y
 NO_HZ_IDLE y -> n
 VIRT_CPU_ACCOUNTING_GEN n -> y
+CONTEXT_TRACKING_USER y
+CONTEXT_TRACKING_USER_FORCE n
+RCU_NOCB_CPU y
+RCU_NOCB_CPU_DEFAULT_ALL n
+VIRT_CPU_ACCOUNTING y

Some of those you can see in your check-config list of errors. Using this method, the kernel compiled fine for me, albeit 6.0-rc5 low latency.

Doug Smythies
  • 15,448
  • 5
  • 44
  • 61
  • There is an issue with your method that you do not create a .deb file for easy installation. – Henrique Bucher Sep 12 '22 at 17:50
  • ???? My method creates .deb files (2, image and headers) for easy installation and kernel management. – Doug Smythies Sep 12 '22 at 20:06
  • there are 12 deb files created by the debian/rules binary command. – Henrique Bucher Sep 14 '22 at 00:45
  • The two methods differ in the .deb file contents, with Ubuntu splitting things up into multiple .deb file and compiling multiple flavors. – Doug Smythies Sep 14 '22 at 13:30
  • 1
    Finally I got it done: https://lucisqr.substack.com/p/compiling-a-tickless-kernel-on-ubuntu – Henrique Bucher Sep 14 '22 at 14:14
  • In debian/rules.d/4-checks.mk the config-prepare-check-% rule references "$(skipconfig)" "$(do_enforce_all)".

    So using a build line like

    LANG=C fakeroot debian/rules do_doc_package=false do_tools_perf_jvmti=false do_cloud_tools=false do_enforce_all=false do_tools_hyperv=false skipconfig=true binary-headers binary-generic binary-perarc got around the config check errors.

    – Joe Doyle Mar 31 '23 at 16:36
1

There is a useful guidance from Canonical posted as the accepted answer here:

"The annotations files are managed by Canonical and are used to prevent kernel config mistakes from being made during the maintenance period. If someone is modifying the kernel configs , we assume they know what they are doing and we recommend they disable annotation checks.

<...>

To disable annotation checks, you can run the following command:

fakeroot debian/rules editconfigs do_enforce_all=false

So, for the most part, it is unnecessary to actually edit the annotaitons by hand and those checks can (and should) just be skipped with do_enforce_all=false.

Note: when changing configs non-interactively, such as with scripts/config, same parameter can be passed to fakeroot debian/rules updateconfigs do_enforce_all=false

An exception to this are the rules marked with mark<ENFORCED> which are enforced regardless. Specifically, CONTEXT_TRACKING_FORCE is enforced as undefined. This was done to prevent users inadvertently enabling it, however it has to be defined when NO_HZ_FULL is enabled. So despite the fact that disabling it is the correct thing to do, there is no way to pass the check. The workaround is to comment out the annotation line enforcing it:

sed -e '/LP:1349028/ s/^#*/#/' -i ./debian.master/config/annotations

Note that same do_enforce_all=false setting should also be passed to skip annotation checks during the build itself:

fakeroot debian/rules do_enforce_all=false binary
nirvana-msu
  • 109
  • 3
0

OK this is solved. If you came across here following that kernel guide, the issue is that the check-config script checks that the configuration in the kernel be exactly the golden one they published.

This means that if you change a single configuration entry , you will have to edit the file debian.master/config/annotations, search for the respective entry and change the setting for your platform (amd64 in my case).

Another mistake I did was to edit debian.master/config/annotations while trying to compile the branch origin/hwe-5.15.0. If you are not in master, you should edit debian.hwe-5.15.0/config/annotations instead.

Once you get all changed by hand, you can compile the kernel without problems.

Report: https://lucisqr.substack.com/p/compiling-a-tickless-kernel-on-ubuntu