Could use a tl;dr guide (if there is such thing) on how to build a kernel.
Could use a tl;dr guide (if there is such thing) on how to build a kernel.
Title. Basically, a "step-by-step" guide that goes like
$CLI_COMMAND
to configure the kernel. `
$CLI_COMMAND
to compress the kernel.
And so on, so forth.
Thanks in advance.
1a. A traditional location for source directory is
/usr/src/linux-[version]
. And/usr/src/linux
is traditionally a symlink that points to the "currently active" kernel source.[source_path]/.config
. You can copy that file from a previous kernel version to the next revision, and it will mostly work):2a.
make config
. This is the original configuration script. It asks you about a 1000 yes / no / module questions one at a time. Not recommended.2b.
make menuconfig
. This is the same options as make config, but in a text-based menu format, where you can use arrow keys to go back and revisit previous options. Much better.2c.
make xconfig
ormake gconfig
ormake qconfig
. Same idea as menuconfig but using X Windows, GTK, or Qt, respectively, with actual windows and dialog boxes.make clean
. This deletes stale object files. This is unnecessary if you just extracted the tarball and haven't built anything yet. There's alsomake mrproper
which is deeper than clean.make
.make modules_install
. This copies loadable kernel modules (in *.ko files) that were compiled during make into/lib/modules
.make install
. At least this is available on my distributions sources. If you don't do this, you just need to pull the kernel image out of[source_path]/arch/[your_arch]/boot
. The filename depends on which compression was selected in configuration. For me its "bzImage". Take this file and copy it to a location where your bootloader can get to it. Traditionally it also gets renamed tovmlinuz-[version]
.Note that most distributions will also do an initramfs, which isn't covered here. Most people don't actually need initramfs, particularly if they compile the key early drivers into the kernel (select "yes" rather than "module"). You may need an initramfs if your root partition is encrypted and you need an early system capable of decrypting it.
Edit: Lemmy ate all my angle bracket paths, and monospace formatting.