Please enable JavaScript.
Coggle requires JavaScript to display documents.
Linux Kernel (201) (Compiling a Linux kernel (weight: 3) (empacotamento do…
Linux Kernel (201)
Compiling a Linux kernel (weight: 3)
Terms and Utilities
mkinitrd
• mkinitramfs
• make
• make targets (all, config, xconfig, menuconfig, gconfig, oldconfig, mrproper, zImage, bzImage, modules, modules_install,
rpm-pkg, binrpm-pkg, deb-pkg)
• gzip
• bzip2
• module tools
• /usr/src/linux/.config
• /lib/modules/kernel-version/
• depmod
Cleaning the kernel
make clean
Deletes most generated files, but leaves enough to build external modules
make mrproper
Deletes the current configuration and all generated files
Running make mrproper before configuring and building a kernel is generally a good idea
make distclean
Removes editor backup files, patch leftover files and the like
Key Knowledge Areas
• /usr/src/linux/
• Kernel Makefiles
• Kernel 2.6.x, 3.x and 4.x make targets
• Customize the current kernel configuration
• Build a new kernel and appropriate kernel modules
• Install a new kernel and any modules
• Ensure that the boot manager can locate the new kernel and associated files
• Module configuration files
• Use DKMS to compile kernel modules
• Awareness of dracut
Código fonte
/usr/src/linux
Documentação oficial
Parametros que o kernel aceita a ser carregado
kernel-parameters.txt
/usr/src/linux/Documentation
Após compilado um novo kernel - Código fonte
/usr/src/linux/arch/x86/boot/zImage ou /usr/src/linux/arch/x86/boot/bzImage dever ser copiado para /boot
make zImage
make bzImage
make modules
Initial Ramdisk
mkinitrd
-c - elemi a arvore de diretório usadas para criação anteior do initial ramdisk
-o nome para o initial ramdisk
-m - versão de módulo a incluir
-k versão do kernel
mkinitramfs
/etc/mkinitramfs-tools/initramfs.conf
empacotamento do kernel
make deb-pkg
make tar-pkg
make binrpm-pkg
make targz-pkg
make rpm-pkg
make tarbz2-pkg
Kernel runtime management and troubleshooting (weight: 4)
modprob
-r : remove módulos.
-a : insere módulos.
-V ou --version : exibe informações sobre o comando.
-d diretório
lsmod
lsmod - lista os módulos do kernel que estão carregados na memória.
depmod
uname
-m
-p
-i
-n
-a
-r
-v
-s
modinfo ; mostra informações sobre o modulo
para lista apenas as opções que o modulo aceita ; modinfo -p
dispositivos udev
udevadm monitor
arquivo principal de configuração
/etc/udev/udev.conf
diretório de regras
/etc/udev/rules.d
insmod
insmod - carrega módulos do kernel na memória do sistema.
Kernel Components (weight: 2)
What are kernel modules
.ko
/lib/modules/kernel-version
uname -r
/proc/sys/kernel/osrelease
Multiple module hierarchies
/lib/modules
Scheme up to 2.6.0 kernels
kernel version number consisted of three parts
Key knowledge Areas:
Terms and Utilities
• /usr/src/linux
• /usr/src/linux/Documentation
• zImage
• bzImage
• xz compression
• Kernel 2.6.x documentation
• Kernel 3.x documentation
• Kernel 4.x documentation
Type kernel images
bzImage
zImage will be loaded in low memory and bzImage can also be loaded in high memory if needed.
zImage
The maximum allowed kernelsize for a zImage
is 512Kb
Both zImage and bzImage use gzip compression. The “bz” in bzImage refers to “big zImage” – not to the “bzip” compression
algorithm.