====== Minimalistic guide to build a Kernel (only) ====== \\ ===== Introduction ===== Brief guide to configure, compile and install a kernel. I do this all as root in /usr/src, others do all steps except install in /home/user/somewhere as user. If I'm going to use the Kernel to control my computer I might as well trust the build process. So this guide assumes as ROOT and /usr/src. It is mainly intended as my reference to other howto's that requires building a Kernel first. This howto assumes kernel-6.6.3. Obviously you should use the newest appropriate version and use those version numbers. **summary:** cd /usr/src tar -xvf linux-6.6.3.tar.xz cd linux-6.6.3 make clean && make mrproper cp ../config-custom ./.config make menuconfig make -j3 make modules && make modules_install cp System.map /boot/System.map-6.6.3_acer-v5 cp .config /boot/config-6.6.3_acer-v5 cp arch/x86/boot/bzImage /boot/vmlinuz-6.6.3_acer-v5 ===== Preparations ===== Download the latest Kernel stable from:\\ https://kernel.org/\\ Check the signature.\\ Optional: patch cd /usr/src tar -xvf linux-6.6.3.tar.xz cd linux-6.6.3 make clean && make mrproper cp ../config-custom ./.config You don't need both mrproper and clean, probably chose one or the other depending on your need (mrproper also does clean), I just do both out of habit. Cp assumes you already have a useful config-custom file in /usr/src, or you could cp /boot/config-generic. ===== Configure ===== make menuconfig Save the configuration. If you don't have a good configuration file for the particular computer you're on, you could use make localmodconfig (DON'T) before menuconfig to make one from scratch. Or you could do the opposite and make (copy) one from config-huge, or if you intend to use initrd, config-generic. If you use localmodconfig, you have to ADD lots of stuff to the configuration (that you need or might need), alternatively you CAN remove alot of stuff (you don't need) from config-generic or config-huge. If you intend to not use an initrd, you need to build into the Kernel anything you need, and you can build into or as modules(preferably) things you might need. ===== Compile ===== make -j3 Where 3 is 3 cores. Use more or less by have/needs. ===== Modules ===== make modules && make modules_install You don't need to do make modules (make basically does make "all" target), only modules_install, I just do out of old habits and precaution. Some targets however, do require make modules, like make bzImage. You also might want to make headers_install here once in awhile. ===== Install ===== cp System.map /boot/System.map-6.6.3_acer-v5 cp .config /boot/config-6.6.3_acer-v5 cp arch/x86/boot/bzImage /boot/vmlinuz-6.6.3_acer-v5 OR make install If you want to make and use **initrd**, this is the time. Then add your custom entry to the bootloader. (If you need some assistance with Grub2 bootloader look here: [[howtos:misc:lilo_to_grub_bios_mbr]]) ===== Further details ===== If you need further information or details regarding Linux kernel builds, there are several more detailed guides available on this page: \\ [[slackbook:linux_kernel | Slackbook]] \\ [[howtos:slackware_admin:kernelbuilding | Alienbob - detailed]] \\ [[howtos:slackware_admin:building_the_linux_kernel_using_git_repository | Git related]] \\ [[howtos:slackware_admin:using_slackwares_kernel_build_scripts | Slackware Helper scripts ]] \\ ====== Sources ====== * Originally written by [[wiki:user:zeebra | Zeebra]] {{tag>howtos general_admin kernel author_zeebra}}