0

I would like to build an optimized kernel for a machine that runs Ubuntu 20.04 but in my scenario I cannot "pollute" the Linux installation with all the dependencies required to do the build. So, ideally, everything that is installed via

sudo apt-get install build-essential
sudo apt-get build-dep linux

(and whatever other dependencies are required)
should be isolated and once I've done the build and installed the new kernel I should be able to easily roll back as if nothing was installed, kernel aside. Since I've never used LXC, I am not sure about the potential complications there might be in using it for this purpose so I'm asking:

Is it possible to cleanly build a kernel inside an LXC container, move it to the host system and later get rid of the container?

Also a quick how to would help a lot. Many thanks

1 Answer 1

2

Building software is just regular work. It doesn’t (usually) need special privileges or access or anything. In fact, it is often done in sandboxes already, to prevent malicious or accidental modification of unrelated files.

So the answer is simply yes, this is possible.

I recommend you build a .deb package from the kernel. You can use make-kpkg to do this. There’s a guide in the Ubuntu handbook.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .