Installing packages (programs) and recompiling the kernel --------------------------------------------------------- apt - tool for search, install, uninstall programs for Ubuntu apt search kernel - in ce pachete apare stringul "kernel" ... sunt prea multe apt upgrade kernel - upgrade pentru kernel, varianta cu kernel gata compilat apt search bz2 - in which package we can find bz2 in the name field or in the description field apt search unzip - same about unzip b) download and build it from sources. An exampe for this you have for the case of the kernel (how to do it for the kernel) In short, the steps, without the actual description are: 1) go on kernel.org and download the sourcesd for the kerrnel using the wget program 2) unzip and untar it (one command, using tar). It will result a folder with the same name as the downloaded sources file. 3) go into that folder and read the README file and see what to do next c) Search online for .deb packages. Download the appropriate package and then install it with apt. e.g. apt install name-of-the-downloaded-file.deb d) using dpkg for instalation of the downloaded packages Recompiling the kernel ---------------------- An example of a kernel is the following: https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.2.tar.xz Which one can download using a command similar to the one below. As you can see in this example is another kernel variant (version). To get the latest stable kernel sources we can find them on www.kernel.org wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.tar.bz2 The version from the last example (above) is packed using bz2. The normal packing for the latest ones is xz. Maybe we need a package (program) in order to be able to unpack the file. Whether it is bz2 or xz we need to search for the proper package to use. This can be doen by using apt search bz2 or apt search xz There will be a list of several packages there to download. We need to choose the apropriate one and install it with a command similar to the one below sudo apt install where you have to substitute with the name you got at the previous phase. bzip2 -dv linux-2.6.25.tar.bz2 - dezarhivarea kernelului tar -xvf linux-2.6.25.tar.xz - extragerea din arhiva tar Comanda de mai sus s-ar putea sa stie sa faca si unzip, cu conditia ca programul de dezarhivare adecvat sa fie instalat. La versiunile mai noi alr kernelului, arhivate cu extensia .xz, programul care stie sa dezarhiveze fisiere .xz e deja instalat, fiind folosit si de catre comanda man. Deci pasii suplimentari pentru dezarhivare nu sunt necesari, comanda tar va sti sa dezarhiveze ea insasi kernelul descarcat. mv linux-2.6.25 /usr/src/ - mutarea directorului linux-2.6.25 in directorul /usr/src (nu e neaparat necesara) cd /usr/src/linux-2.6.25 - trecerea in directorul /usr/src/linux-2.6.25 (daca la etapa anterioara mu l-am mutat acolo, atunci intram in directorul unde s-a dezarhivat, care e un subdirector in /root) make menuconfig - Cea mai importanta etapa! In aceasta etapa configuram kernelul pe care, eventual, il vom compila ulterior S-ar putea sa lipseasca cateva pachete: ncurses-devel, flex, bison, si altele care vor trebui instalate cu yum. Vom primi mesaje de eroare, in unele dintre ele scrie chiar numele corect al pachetului. In celelalte nu neaparat. Instalam pachetul lipsa, apoi incercam din nou make menuconfig, repetam procesul de cate ori este nevoie. make - compiling the kernel At this step, also a lot of errors will appear, caused by missing packages. The most complicated to solve is the one in which some *.pem certificates are missing. To solve that I used the information from the link below and adapted it: https://stackoverflow.com/questions/67670169/compiling-kernel-gives-error-no-rule-to-make-target-debian-certs-debian-uefi-ce First, I needed to install another package: linux-source. Then I edited the file .config from my souces folder, in the section specified from stackoverflow, but, since I wanted to use my sorces I copied the certificates into my sources folder. That would be ~/linux-6.8.6/debian The adapted section that I need to be written into the .config file is (the file is located, in my case, here: ~/linux-6.8.6/.config): # Certificates for signature checking # CONFIG_MODULE_SIG_KEY="certs/signing_key.pem" # CONFIG_MODULE_SIG_KEY_TYPE_RSA is not set CONFIG_MODULE_SIG_KEY_TYPE_ECDSA=y CONFIG_SYSTEM_TRUSTED_KEYRING=y CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem" CONFIG_SYSTEM_EXTRA_CERTIFICATE=y CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE=4096 CONFIG_SECONDARY_TRUSTED_KEYRING=y CONFIG_SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN=y CONFIG_SYSTEM_BLACKLIST_KEYRING=y CONFIG_SYSTEM_BLACKLIST_HASH_LIST="" CONFIG_SYSTEM_REVOCATION_LIST=y CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem" # CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE is not set # end of Certificates for signature checking The copied files are the *.pem and we need a folder for them mkdir ~/linux-6.8.6/debian sudo cp -v /usr/src/linux-source-*/debian/canonical-*.pem debian/ make modules - compilarea modulelor (nu avem nevoie) make modules_install - compilarea si instalarea modulelor (nu avem nevoie) make install - comprimarea kernelului in fisierul bzimage, copierea lui in directorul /boot. Modificarea fisierului /boot/grub/grub.conf ca sa contina si referinte la noul kernel (nu avem nevoie) mount /boot -o remount,ro - remontarea Read-Only a sistemului de fisiere /boot mount /boot -o remount,rw - remontarea Read-Write a sistemului de fisiere /boot Ultimele 2 comenzi nu le vom folosi. In lumea reala, pentru protectie, directorul unde se afla kernelul (/boot) este protejat la scriere, adica este montat in modul read-only. Deci, inainte sa incepem recompilarea kerneluli trebuie sa il montam in modul read-write, pentru a il putea scrie acolo pe cel nou. La sfarsit, il vom monta inapoi in modul read-only pentru al il proteja pe cel nou de stergeri accidentale ftp://ftp.gnu.org/gnu/gcc/ nano README de unde vedem ca aici e documentatia nano Documentation/admin-guide/README.rst si ca aici sunt requirements de sw version; nano Documentation/process/changes.rst