I've read many tutorials about how to build custom kernels and boot Ubuntu using those kernels, and successfully followed the guides and booted custom kernels, but I have no understanding about what each of the command in the guides do and what is actually happening with each command. The procedure described on Ubuntu's site does a lot of work with fakeroot, dpkg, make-kpkg, some initramfs, and other horrible stuff that works but simply does not help me understand what is going on.What is the output of make in a linux kernel directory? Does it create a compressed kernel image? What is the name of the compressed kernel image file and where is it placed?What does make modules do?Should make modules be done before or after make?Doesn't make build my modules automatically?What is the process (in English, not just the list of commands) of adding newly built kernels to the list of bootable kernels?What does make install do?Will make install add it to my list of bootable kernels so that I don't have to do anything more?Is there an equivalent make modules_install?
What happens in each step of the Linux kernel-building process?
ubuntu;linux kernel;make
From the top...make compiles and links the kernel image. This is a single file named vmlinuz.make modules compiles individual files for each question you answered M during kernel config. The object code is linked against your freshly built kernel. (For questions answered Y, these are already part of vmlinuz, and for questions answered N they are skipped).make install installs your built kernel to /vmlinuz.make modules_install installs your kernel modules to /lib/modules or /lib/modules/<version>.As for adding it to the list of available kernels, that's taken care of by the boot loader. It's different for each boot loader, but grub is the most common on x86 and amd64 so I'll describe that. It's actually quite simple. Grub looks in /, /boot and /lib/modules for any thing that looks like it might be a working kernel and adds it. And yes, this is an oversimplified description.That extra horrible stuff in the Ubuntu documentation is extra stuff to create a deb package. When you're doing it for more than yourself it's far better to package it. You'll switch in time.Building the kernel and modules is kept separate because for the people who need to (i.e., kernel developers) they are often making changes to only a module. They can apply their changes, rebuild and install just the modules. This saves a lot of time when it has to be done 20 times a day. It will never be updated to have a single make everything command. You instead, run make && make modules && make install && make modules_install just like the documentation says to do. The build process favors kernel developers, not you. And that's the way it should be.In reality there's almost no reason for anybody except kernel developers or distro packagers to compile a kernel. In almost any circumstance the kernel feature you want has already been built for you and is available in one of the pre-packaged kernels. There are exceptions, but they are exceedingly rare these days.Not that I'm discouraging you from doing building your own kernel, I actually encourage you to do it. I think building your kernel from scratch is an invaluable practice for learning about how it all works down there. In part, because maybe one day you will be the exception that needs to. But it also teaches you a lot about the kernel & boot process in general. You will be a better person for having done it.