Kernel configuration in Ubuntu

So, I tried this:

debian/scripts/misc/annotations --arch amd64 --flavour myflav --file debian.myflav/config/annotations --export

And looked at the result. This tool created the correct .config style output. Yay!
However, if do this:

debian/scripts/misc/annotations --arch amd64 --flavour myflav --export

It does not do the correct thing.
This is what debian/rules.d/2-binary-arch.mk does. It does not specify the --file, but seems to expect that it can start with annotations and it should find the flavour annotations. Looking at the annotations script, it seems like it looks in debian/debian.env. Aha!
Looking at the lowlatency source debian/debian.env, it seems like I do need to change this file.

Cross your fingers. Edited debian/debian.env to be DEBIAN=debian.myflav. Tried

debian/scripts/misc/annotations --arch amd64 --flavour myflav --export

And it did the right thing. Yay.
Building now, which is slow. But I think this is it.

I ended up changing debian/debian.env back.
I changed debian/rules.d/2-binary-arch.mk and debian/rules.d/4-checks.mk to call with the --file to the myflav annotations. This is a work-around. But, seems to be working for now.

Well, the build doesn’t error. My new kernel modules are compiled according the configs in myflav annotations. But it does not build any debians. The last thing it does is a module check:

II: Checked 122 modules : 122 PASS, 0 FAIL

Maybe a nice weekend away will help. :smiley:

Did you change debian/debian.env to point to your debian.myflav directory?

Yes. That failed spectacularly. It seems like the build expects more to be in debian.myflav than just config/annotations. Looking at jammy lowlatency-next, I think that’s the case. Anyway, my plan is to follow the model of debian.lowlatency for debian.myflav, including debian/debian.env to point to my debian.myflav directory.

Thanks!

You also need debian.myflav/rules.d/amd64.mk which contains the flavor name. Probably other places where the flavor name is hard-coded :frowning:

Yes. I’ve started to find them. I’ll try to keep some notes.
Again, thanks!

So, I was able to get a kernel built. I took some notes.

  • Create debian.myflav directory
  • Add debian.myflav/config/annotations
  • Add flavour to debian.master annotations FLAVOURS:
  • Change debian/debian.env to DEBIAN=debian.myflav
  • Add debian.myflav/rules.d/amd64.mk with updated flavour
  • Add debian.myflav/changelog
  • In debian/rules.d/2-binary-arch.mk, the annotations script initially creates a correct .config.
  • But, during the build something saves .config as .config.old and creates a new .config (from kconfig, I think) which is not correct. And, debian/rules.d/4-checks.mk calls the annotations script which does not like it. Added work-around
  • Need to add debian.myflav/control.stub.in
  • Add debian.myflav/rules.d/hooks.mk
  • And copyright file
  • And control.d files, including new vars.myflav.
  • And abi directory and files, with myflav versions in amd64
  • And although I made sure modules.myflav was correct, in debian/rules.d/4-checks.mk, module-check-% is failing – probably caused by bad modules.myflav in abi/amd64/. Work-around by removing module-check-%

And I get a complete build. I have not tested it.
I am worried about:

  • Why .config is regenerated after annotations call in debian/rules.d/2-binary-arch.mk builds it correctly,
  • Why I can’t get module-check in debian/rules.d/4-checks.mk to work.

I think that Jammy lowlatency-next is building because of a little luck.

Finally, I noticed that you must be connected to the internet for a kernel build to work. I have all the source, what does it need from the internet?

So, I hope this is useful.

Thanks.

2 Likes

I had similar problems building a custom kernel flavour and in the end it was because I set CONFIG_IMA_DEFAULT_HASH_SHA256 to 'y' in debian.master/config/annotations but CONFIG_IMA_DEFAULT_HASH_SHA1 was also set to y, which was incompatible. I’m using debian/scripts/misc/annotations --arch amd64 --flavour foobar --update config.flavour.foobar to edit debian.master/config/annotations, and that script only updates the options you tell it to, it’s not smart enough to find and fix incompatible options. Adding CONFIG_IMA_DEFAULT_HASH_SHA1=n to config.flavour.foobar fixed the problem.

Maybe you have some incompatible options too?

Hello everyone,
I hope you’re doing fine.

If I have questions and / or issues about the ā€œannotationā€ way of building an Ubuntu kernel, is this thread still the correct one to use ?

Thanks in advance,
Have a nice day !

Yes. What are you trying to do?

Hello and thanks for your answer ; - )
I have opened a thread and here is what I am trying to do : Home made kernel build failed
Have a nice day ; - )