From 519253628e1847e60dca556221bbe0cda13f1172 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Sun, 3 Jul 2016 11:38:23 +0100 Subject: Updated linux kernel compilation --- md/writeup/compile_linux_kernel.md | 68 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'md/writeup') diff --git a/md/writeup/compile_linux_kernel.md b/md/writeup/compile_linux_kernel.md index 75966fe..821b46c 100644 --- a/md/writeup/compile_linux_kernel.md +++ b/md/writeup/compile_linux_kernel.md @@ -26,6 +26,47 @@ http://kernel.ubuntu.com/git/ And also there is little different native kernel building ways for some distros +## Config + +Easyes way startup config is just to get whatever you running now. If you hw works good +with current distro then use current kernel config its is stored in procfs _/proc/config.gz_. +Lets go to our kernel repo and do + +``` +zcat /proc/config.gz > .config +``` +now you are ready to compile kernel that will work at begining + +### Making yout own config + +When you making you own optimised config you need to check your current hardware settup. +If you whant minimal kernel there is two options. Just remove hardware that will be newer +used. Like if you have have laptop only with intel video card then everything that realted to +other video cards could be removed. Second approach is to make only bare minimum without +kernel modules. Here is interesting. You get you runnung kernel. And plug all deiveces that +you whant to work. Drivers will be autoloaded for this devices and you staticly compile them in. +And you will able to run your stuff only with staticly compiled kernel without loadable modules. + +List all loaded modules + +``` +lsmod +``` + +See all conntected USB devices + +``` +lsusb +``` + +See all PCI devices and modules that they are using + +``` +lspci -k +``` + +This bare minimum of command that you whant to run to start modifing your kernel. + ## Compiling Run to configure kernel @@ -40,6 +81,32 @@ compile our first kernel make ``` +## Install + +It depends from distro to distro expected way how to install new/fresh/clean kernel + +### ArchLinux + +Install modules. They all will go /lib/modules/`your kernel version` + +``` +make modules_install +``` + +Compy compiled kernel to boot directory + +``` +cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-linux318 +``` + +Create initram image + +``` +mkinitcpio -k -g /boot/initramfs-.img +``` + +All of this should be enought to run kernel with qemu + @@ -66,3 +133,4 @@ http://tomoyo.osdn.jp/ 2. https://wiki.ubuntu.com/Kernel/SourceCode 3. https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel 4. https://fedoraproject.org/wiki/Building_a_custom_kernel +5. https://wiki.archlinux.org/index.php/Kernels/Traditional_compilation -- cgit v1.2.3