Calculate linux версия ядра

Calculate kernel

Our kernel comes as the package and has several versions and variants described by USE flags. Example:

[I] sys-kernel/calculate-sources [1] Available versions: (4.19.96) 4.19.96^bs (4.19.97) ~4.19.97^bs (5.4.12) 5.4.12^bs (5.4.13) ~5.4.13^bs build desktop firmware fsync +grub minimal muqss pae symlink themes uksm +vmlinuz KERNEL="linux"> Installed versions: 5.4.12(5.4.12)^bs (02:38:06 18.01.2020)(desktop firmware fsync grub minimal symlink themes vmlinuz -build -muqss -pae -uksm KERNEL color:#DCA3A3;font-weight:bold;">linux") Home page: http://www.calculate-linux.org Description: Calculate Linux kernel image [1] "calculate" /var/db/repos/calculate

Stable kernel versions, as well as the latest one comes in binary both for desktop and server applications. When we were writing this, the stable kernel versions were 5.4.12 and 4.19.96 , while the latest version was 5.4.13 .

To switch between the and the versions, toggle the USE flag. Here is the list of all other kernel USE flags:

  • adds sys-kernel/linux-firmware or sys-firmware/eth-firmware to dependencies
  • improves performance in games that use Proton by Valve
  • add Grub to dependencies
  • does not install the sources when installing the kernel
  • adds support for MuQSS
  • creates a symlink pointing to the sources files, /usr/src/linux
  • adds the Plymouth theme to dependencies
  • is an alternative to ksm, a technology of merging identical memory pages into one.
  • compiles and installs the kernel at package installation time

Downgrading the kernel

In case of problems due to system instability, as well as hardware or driver support problems, you can downgrade the kernel. To move to version 4.19.x , run:

echo «>sys-kernel/calculate-sources-5» >> /etc/portage/package.mask/custom

emerge -a sys-kernel/calculate-sources

Now restart your computer. Select in the bootloader menu and select kernel version 4.19 . Once the system has loaded, complete the update procedure by running:

Cl-update will remove the ~5.4 kernel and rebuild packages containing kernel modules.

Installing the latest kernel version

Installing the latest kernel version is justified only if you need some functionality that is not provided by your kernel version, or add support for new hardware. To install the latest version of the Calculate sources, run:

echo «sys-kernel/calculate-sources» >> /etc/portage/package.keywords/custom

It will install the latest version of the kernel, then update all modules. One of the packages might fail to compile with the new kernel. If this is a module you do not use, feel free to delete the failing package.

Custom kernel compilation

When building a kernel from the package, it is configured using relevant Calculate Utilities templates. You can create your template with modified settings in the most convenient way. Your template will be applied later on whenever you recompile the kernel.

First, you need to fetch source files for the kernel. To do this, run:

USE=»-minimal -vmlinuz» emerge -a sys-kernel/calculate-sources

To edit the settings and recompile the kernel, run:

The program will launch Calculate Utilities to generate the default settings, then run make menuconfig to call the configuration interface. When completed, a template will be created that includes the changes made, and then the kernel compilation and installation processes will launch:

Linux kernel configuration

By default, the kernel sources pointed to by symlink will be used. If you have multiple versions of installed on your system, or other packages with kernel source code (such as sys-kernel/gentoo-sources , sys-kernel/vanilla-sources ~, etc.), you may need to specify the kernel version to be compiled. To view available versions, run:

* 4.19.97-gentoo * 4.19.96-calculate * 

Here is an example of how you specify a kernel version:

cl-kernel —kver 4.19.96-calculate

If you do not want the kernel to recompile after configuring it, use the option.

You may need to update the kernel modules once you have updated the kernel itself. Make sure that symlink points to the relevant kernel version, then run:

You can restart the configuration to make sure that your modifications have been saved. The result is saved in the directory of custom templates, , in subdirectory.

tree -a /var/calculate/templates

/var/calculate/templates └── kernel ├── 10-calculate-x86_64-4.19 └── .calculate_directory 1 directory, 2 files

To use the new configuration later on when installing new versions of the kernel, you should install sys-kernel/calculate-sources as a non-binary package. You may enable the USE flag for calculate-sources:

echo «sys-kernel/calculate-sources -minimal» >> /etc/portage/package.use/custom

Now when you install the package, the kernel will compile with your modifications:

emerge -a sys-kernel/calculate-sources

Switching to another kernel

As mentioned above, cl-kernel helps you build and install + as well as any other kernel such as +, +, etc.

For example, install the latest version of from the original source with no third-party patches:

echo sys-kernel/vanilla-sources >> /etc/portage/package.keywords/custom

emerge -a sys-kernel/vanilla-sources

View all available kernels:

Note that 5.4.12-calculate is marked with red. This means that it contains no source code, since sys-kernel/calculate-sources is installed by default with the disabled USE flag.

To configure, compile and install any kernel, you only have to run something like that:

Obviously, building a kernel from scratch is quite time-consuming, and anyway, you probably already have your custom configuration file. If this is the case, you can copy it to the kernel source directory, /usr/src/linux-5.4.15/.config , before actually building up the kernel. To apply the actual kernel settings, run:

cl-kernel —kver 5.4.15 —convert

In this case, if there is no in the directory containing kernel sources, the settings will be fetched from the currently running kernel. Then the make oldconfig command will be run to set values in the new parameters, followed by make menuconfig to configure the kernel. When the configuration process is complete, the kernel will be compiled and installed on your system. A kernel configuration template will be created:

head -1 /var/calculate/templates/kernel/10-vanilla-x86_64-5.4

# Calculate format=kernel name=.config os_install_arch_machine==x86_64&&merge(sys-kernel/vanilla-sources)>=5.4

When installing , this template will be used to create a file.

Building kernel without initramfs

The initramfs file is used to load kernel modules at an early stage of system boot. After the first boot of an installed system, initramfs is optimised and modules that are not loaded in memory are removed, thus reducing kernel boot time. Not using initramfs can speed up kernel startup even further, noticeably improving overall system boot time.

To rebuild your kernel without initramfs, two conditions have to be met: you must disable initramfs creation in the kernel settings and enable including filesystem and hardware drivers into the kernel.

Launch the kernel configuration process:

Go to the section and disable .

Initial RAM filesystem and RAM disk (initramfs/initrd) support

Include the root file system in the kernel. To find out which file system is being used:

TARGET SOURCE FSTYPE OPTIONS / /dev/nvme0n1p2 btrfs rw,noatime,ssd,discard,space_cache,subvolid=5,subvol=/

Go to the section and specify for your file system.

Btrfs filesystem support

This must be sufficient for a desktop running on a M.2 hard drive. If you are using SATA/SAS or SCSI controllers, RAID volumes, etc., you may need to compile additional drivers into the kernel that are responsible for supporting your device. Once the setup is complete, exit the program. Kernel compilation will be launched.

Adding patches

Kernel patches can add hardware support or, in some cases, improve system responsiveness or make other improvements. To add this, save the patch to and add the template header as the first line of the file to convert it to a template:

# Calculate format=diff env=install ac_install_patch==on&&merge(sys-kernel/calculate-sources)>=4.19 .

The header contains the format, the condition for the patch to be applied and the version check for the package to be installed.

Example

Here is an example of adding the [kernel_gcc_patch] (https://github.com/graysky2/kernel_gcc_patch) that extends the list of processors the kernel can be optimized for. Fetch the repo content first:

git clone https://github.com/graysky2/kernel_gcc_patch.git

Copy the patch file to the kernel template directory:

cp kernel_gcc_patch/enable_additional_cpu_optimizations_for_gcc_v9.1+_kernel_v4.13+.patch /var/calculate/templates/kernel_gcc_patch

Add the template header to the patch:

# Calculate format=diff env=install ac_install_patch==on&&merge(sys-kernel/calculate-sources)>=4.19 .

Install the kernel sources. will start installation in a single process. You can check the log for the successful patch application message:

. >>> Source configured. * Applying Calculate patches with tools for calculate-sources . * Applying patch enable_additional_cpu_optimizations_for_gcc_v9.1+_kernel_v4.13+.patch * Calculate Utilities modified files: * .config * arch/x86/Kconfig.cpu * arch/x86/Makefile * arch/x86/Makefile_32.cpu * arch/x86/include/asm/module.h >>> Compiling source in /var/calculate/tmp/portage/sys-kernel/calculate-sources-5.4.12/work/linux-5.4.12-calculate . .

Configure the kernel by selecting your CPU from the new list:

Go to . You will see a much longer list of available CPUs.

Linux/x86 Kernel Configuration

Once the configuration process completed, the new kernel will be built. The patch and the updated kernel settings will be used as well when compiling +.

Kernel modules

A module is an object that contains some code providing additional functionality to the running kernel. Run lsmod to view the loaded modules in real time. To view full info on a module, run modinfo . To make the kernel module load automatically during system boot, create a file with the extension in . In this directory, you can list custom modules and, if necessary, the parameters for them as separate lines. Example:

options [HTML_REMOVED] [HTML_REMOVED]=[HTML_REMOVED]

Use the modinfo tool to view the available module options. Here is how to view the parameters available for a module ( snd-intel8x0 in this example):

index:Index value for Intel i8x0 soundcard. (int)
id:ID string for Intel i8x0 soundcard. (charp)
ac97_clock:AC’97 codec clock (0 = whitelist + auto-detect, 1 = force autodetect). (int)
ac97_quirk:AC’97 workaround for strange hardware. (charp)
buggy_semaphore:Enable workaround for hardwares with problematic codec semaphores. (bool)
buggy_irq:Enable workaround for buggy interrupts on some motherboards. (bint)
xbox:Set to 1 for Xbox, if you have problems with the AC’97 codec detection. (bool)
spdif_aclink:S/PDIF over AC-link. (int)
inside_vm:KVM/Parallels optimization. (bint)
enable: (bool)
joystick: (int)

For instance, here is how to load snd-intel8x0 with the set ac97_clock value:

options snd-intel8x0 ac97_clock=48000

You can add modules to to disable them. For instance, this is how to disable module usblp :

Removing a kernel

If you delete , the Calculate kernel and all its modules will be removed from your system. If a kernel (either a Calculate one or not) was built with cl-kernel , the installed kernel will be removed together with its modules when this package is removed.

If you want to prevent removing a kernel package from removing /boot and its modules, proceed as follows:

[system] remove_old_kernel = off

When updating packages with cl-update , the old kernel will not be removed if the system is running on it.

For faster kernel compilation

Use ccache to compile your kernel in a much faster way:

Now kernel 5.4.12 builds up in with ccache on a test PC with AMD Ryzen 5 3600 processor, instead of ~~10 min 24 sec before.

Источник

Читайте также:  Build python on linux
Оцените статью
Adblock
detector