I am going to get around to answering your actual question, but I'm going to take the roundabout way to get there so that you have better context.
tldr: The package you need is make
or build-essential
. You need to be in the same directory as your linux source code and have a .config file configured (which it sounds like you already do). Then run those commands. Google keywords that might help are "compile linux kernel"
So make
is a build system. It allows you to run a series of compile commands (or any commands, really), recursively through a directory structure. It uses a simple system for only compiling programs with changes.
Make allows for the declaration of "targets." Traditionally a target is a filename, and it is followed by which files it depends on.
So a simple example is:
helloworld: helloworld.c helloworld.h
gcc helloworld.c -o helloworld
This would be stored in a file call Makefile
and it tells make that in order to build the helloworld file (compiled binary), you run gcc helloworld.c -o helloworld
and if helloworld already exists, don't do anything unless there are changes to helloworld.c or helloworld.h that are newer than the helloworld file.
If this is the only rule in the makefile, running make
will invoke this rule (as it's the first rule) and attempt to build helloworld
but it could also be explicitly invoked by running make helloworld
Makefiles are usually much more complicated and might look more like this (this is a heavily contrived example and I realize that a makefile will almost never look like this, but it's good for explaining):
hello: hello.o libhello.o
gcc hello.o libhello.o -o hello
hello.o: hello.c hello.h
gcc -c hello.c -o hello.o
libhello.o: libhello.c libhello.h
gcc -c libhello.c -o libhello.o
So if you run make
or make hello
this make file will check hello.o and libhello.o, if they don't exist, it will look for those targets, and thus find out how to build hello.o and libhello.o and THEN build the hello binary like you asked in the first place. This allows you to specify dependencies a level at a time and make figures out what order to compile everything to make it work (this also can save compile time if one of your library haven't changed, you don't need to recompile that object).
You can specify a target without any dependencies, in this case it will only run if the target file does not exist. Furthermore, your target doesn't have to be a file that is created by that rule. For example:
clean:
rm hello *.o
This allows you to run make clean
and it will delete the compiled binary and the object files. Since it doesn't actually create a file named clean
, every time you run make clean
this rule is executed and cleans up your working directory. This is called a phony target and they're used quite often. make install
is one you're likely to see often to install a program that you've built with make.
Back to your original question
So, the linux kernel uses make to build. It has a bunch of phony targets, when in the root of the Linux source, run make help
to show you the targets. Normally you start with one of the targets that launches a program to help you build a .config
file. These would be make config
, make menuconfig
, make xconfig
, and several others.
make
will run the default target which compiles the kernel using the options specified in the .config file. make modules
will compile only the bits marked as modules in the .config
file. Between these two commands you should end up with a vmlinuz kernel and bunch of kernel module binaries. What the Linux Kernel is/does is beyond the scope of this post, but the short story is that it is the software central to the operating system (if the whole system is a nut, then the kernel would be the central core, right?). It runs at the highest level of privilege on the processor and is the only piece of software that interacts directly with memory and hardware, and all other software on the system talks to the kernel to broker access to the hardware. (there are about 20 caveats in that description, but that covers the the most common 80% of how things work).
But hopefully that gives you enough context to search for more helpful information, if you search for "compile linux kernel" you should come up with a half dozen resources at all levels of complexity. The official guidance is at linux.org, but it gets in the weeds very quickly and isn't very helpful if this is your first time.
In Ubuntu (and most distros), make is in the make
package, so it is installed with sudo apt install make
however, to build the kernel, you'll need other programs too, so you'd generally want to install the build toolchain and accessories with sudo apt install build-essential
which includes make.