For a while I have been working on a pet project with the goal of learning more about the limits of low-latency software development in Go.
Recently, I wanted to benchmark some of aspects of this on a tickless kernel. Since most of my development workflow is Ubuntu based and I have no compelling reason to change that, the most straightforward option was to compile the Ubuntu kernel with nohz_full
option.
After a quick DuckDuckGo (is that a verb yet?), I was mostly able to achieve this by following intructions provided here. The author has many other interesting writings, definitely worth checking out.
I write this as mostly a tweaked copy of the same instructions, complemented with a few that were missing and/or needed a bit of tweaking (some of which might be due to my eccentric setup).
Uncomment source repositories
This step might be optional depending on your setup:
Let’s quickly backup our sources.list
|
|
Open /etc/apt/sources.list
and uncomment the deb-src
lines.
Install required dependencies
|
|
If you have problems with the above you might also need to:
|
|
Clone kernel repo
The official site is very slow, but let’s use that anyway. If you’d like to clone from a faster location, please check the article mentioned above.
The last line picks one version ahead, for ease of recognition and for the newly compiled kernel to be the default at boot.
|
|
Update the config
Feel free to choose your own editor for this.
|
|
Select n
for edit config options of both flavors.
This will provide a bunch of questions with correct defaults already selected so go ahead and keep pressing [Enter] until the end.
The last few messages will contain a bunch of errors. To fix them run:
|
|
Change the appropriate params for the configs shown in the errors. We only need to change either the and64
or the amd64-generic
and amd64-lowlatency
options, as appropriate.
When done, run the command fakeroot debian/rules editconfigs
again. This should show no errors and all checks should pass. Repeat as necessary.
Build the kernel
That’s it! Time to build the kernel.
Choose the number of parallel jobs as appropriate. The more the cores you have, the more the jobs you can run in parallel and the faster this will go. If you don’t have a million core machine, perhaps best to run this overnight.
|
|
|
|
If everything goes well, the build should have completed without errors. Go one directory up.
|
|
There’s the shiny new compiled kernel packages. Install some/all of them.
|
|
If there’s no UEFI secure boot, this is it. reboot
into the new kernel.
UEFI
This is an optional step depending on whether UEFI secure boot is enabled. The instructions are based on the ones available here
Backup
|
|
Create a keypair to sign the kernel
|
|
Change the country, state, locality, org, common name and email values and run:
|
|
Run the following and remember your password for enrollment. Write it on a piece of paper perhaps since papssword manager will not be available during MOK enrollment.
|
|
Time to reboot.
|
|
On reboot you’ll see a blue MOK management screen. Choose “Enroll MOK” and then continue with the steps to enroll the newly created key. Enter the password from the enrollment step when asked.
Sign the kernel
Change into the sign
directory created in the previous step.
|
|
That’s it. You should be booting into the new signed tickless kernel.