Custom Kernel on Fedora 20
The last time I built a Linux kernel for my machine was quite a time ago. In my Linux hacking times when I did my private researches on how Linux works and how the software can be built for it, I used Gentoo and there it was normal to build every package from source code, including the kernel. The portage system was a copy of the well known ports package system from FreeBSD. It contains all the metadata for the software packages to be built from scratch with its dependencies. But back to my custom and vanilla kernel on Fedora 20.
Prepare your system
You will need the basic C build environment which can be installed using a package group as root or using sudo:
# yum groupinstall 'C Development Tools and Libraries’
Download the kernel sources from kernel.org
I picked the last stable version which is current 3.16.1 and downloaded the sources to /usr/src/kernels to extract it there.
To extract a .xz compressed tar archive use:
# tar xvfJ <archive.tar.xz>
Configure your kernel
I prefer a minimalistic kernel. That why I am building my own kernel. I don’t like to have support for hardware in my system which I don’t want to use. I don’t use bluetooth, isdn, scsi or legacy audio devices in my workstation and so I decided to remove everything I don’t need.
Change into the kernel source directory you just extracted and run the kernel menu config tool:
# cd /usr/src/kernels/linux-3.16.1
# make menuconfig
I don’t explain how you have to configure your kernel that it will work for you. This is what you have to learn yourself. Read the options and decide if you need the support for that option. There is a lot of documentation out there how you can configure your kernel. And if you are not sure what hardware you have, you maybe should stay with the generic kernel and explore your system with tools like lsusb, lspci and lsmod.
Build your kernel and install your modules
This is quite easy. To build your kernel just run:
# make
And to install the created modules after your build was successful, run:
# make modules_install
Install your kernel to boot and create initrd
Now you need to copy your kernel image to /boot:
# cp /usr/src/kernels/linux-3.16.1/arch/x86_64/boot/bzImage /boot/vmlinuz-3.16.1
Create initrd:
# mkinitrd /boot/initramfs-3.16.1.img 3.16.1
Regenerate the Grub config to add the new kernel option
# grub2-mkconfig -o /boot/grub2/grub.cfg
Reboot and have fun with your new kernel
'Operating System > LINUX' 카테고리의 다른 글
Ubuntu root 계정 활성화 (0) | 2019.03.04 |
---|---|
lvreduce ext4 example (0) | 2019.03.04 |
쉘스크립트 (0) | 2019.03.04 |
Linux command (0) | 2019.03.04 |
Ubuntu Hostname 변경 (0) | 2019.03.04 |