How to build a kernel with added/modified options?

I want to use Anbox and thearchwiki page tells me to 'build the kernel with these options added/modified:


I was looking for a guide on how to do this. I don’t understand much from the archwiki page. Is this video a good enough guide?
Also I want to try this out in virtualbox first, to which I can give 2 cpu cores. How much time will it take to compile on that?
Also I was wondering what happens if something goes wrong. Does the system fall back to the default kernel?

Just to save you some time, linux-zen has those config options enabled already.

If you still want to do it yourself, grab the kernel packaging files, edit the config file, update the checksums, then build the package using makepkg.


So I will install the zen kernel for now, but I would still like to know how to do it myself. For starters, from where do I grab the kernel packaging files? ? Where do I find the config file?
Also if I wanted to revert back to the kernel I’m using (instead of linux-zen), what would I need to do?

EDIT: It turns out the zen kernel does not have those config options enabled.

Config file and PKGBUILD for vanilla Arch kernel are here:

To add/remove options, either change config file directly or use the appropriate kernel tools (e.g. make nconfig).
Note that Arch pulls the kernel source from their own git repo.
You can also just pull it from, simply edit source array in PKGBUILD.

On a full kernel with all drivers: a lot.

If you want to use your custom kernel alongside the default kernel(s), you have to give it a different name, e.g. linux-custom.


How would one change the config file directly? Because I typed make nconfig and got the following error:
Kconfig:32: can’t open file “Documentation/Kconfig”
make[1]: *** [scripts/kconfig/Makefile:35: nconfig] Error 1
make: *** [Makefile:606: nconfig] Error 2

By opening it in a text editor and making the changes you want?
Please also read this if you haven’t done so yet (I admit it’s poorly written).


Stupid question but where do I find the config file?

I posted the link in my previous comment, but once again:

Note this is the config for kernel 5.9.

Its super easy with pkg builds. I’m at work but I can help later tonight. You can use TKGs pkg builds which are really simple. If you want you can also do it the old fashioned way (that’s what I’m use to)

Oh, I thought it was supposed to be in my filesystem. So I suppose I need to copy that config file in a text editor, make my changes, but in what directory do I save it? What do I do after that?

You have to do a little bit of research by yourself…

Basic procedure:

  1. git clone the repository from the link above
  2. make your changes
  3. update the checksums (updpkgsums)
  4. run makepkg

Make sure you have a backup kernel like linux-lts ready, if you don’t change the names you current linux kernel will be overwritten.

It is also highly recommended that you:

  1. get some basic knowledge about PKGBUILDs
  2. have a look at other custom kernels (e.g. from AUR)

Yes, you can (and maybe should) test all of this in a virtual machine.


So I found this and it is clear enough. So I just have one problem now: the page says nothing about installing a custom kernel alongside the default kernel (unless I’m mistaken). How do I do that?

The link you provided shows the traditional compilation, probably for educational purposes.
That will not result in an easily installable package - the way to do this is to use a PKGBUILD as mentioned above.

Custom kernel needs custom name, i.e. something different from linux so as not to lead to conflicts.
It is literally written in the link I gave you:


It has the majority of those set:

It configures CONFIG_ANDROID_BINDER_IPC as a module rather than a built-in but the effect is the same (if you load the module). I don’t know if the CONFIG_ANDROID_BINDER_DEVICES setting is actually important - if it is then you might contact the package maintainer about that.

1 Like

So, I was following that page (which is well written enough, I have to say, for a simple guide) and everything was going well until I tried to compile using makepkg -s. I get the following error:archlinux-linux git repo ... FAILED (unknown public key 3b94a80e50a477c7 Error: One or more PGP signatures could not be verified!
I tried importing the A2FF3A36AAA56654109064AB19802F8B0D70FC30 because of reading this and while I was able to import it, I got the same error. Here’s the command I used to import: gpg --keyserver hkp:// --recv-keys A2FF3A36AAA56654109064AB19802F8B0D70FC30
Note that If I try to import the key that is causing the problem (3b94a80e50a477c7) then I get the following error: gpg: key A2FF3A36AAA56654109064AB19802F8B0D70FC30 rejected by import screener
I have also tried the following (in no particular order):

  1. update archlinux-keyring
  2. change my keyserver
  3. resetting my keyring configuration
  4. run a full system upgrade
  5. go to pacman.conf and set SigLevel = Never and SigLevel = TrustAll
  6. use the gpg --keyserver --search-keys command for both of the keys and get “no valid openPGP data found”.

I really don’t know what to do anymore.

I’m absolutely too lazy now to look after this gpg issue.
Someone else might help you.
EDIT: try a different keyserver:

You can skip key verification with --skippgpcheck makepkg option.


Thanks a lot for that --skippgpcheck option. By the way, is there anyway to resume makepkg if it gets aborted?


However, existing build output may be retained under $srcdir, and you can use ccache to cache compiler build artifacts between runs.

1 Like

Arch wiki has a good guide on how to build the arch way

you can also use the linux tkg pkgbuilds to make your life easier as it has a script that lets you select options and edit config

1 Like

last i remember seeing the arch wiki said dont build the anbox bit as modules and to build them into kernel instead