Install kernel source Package
Apt Install linux-source-3.16
Tools to install additional compilations: Apt install build-essential libc-dev libc6-dev pkg-config Ncurses-dev
Installed kernel source code and config file in/usr/src, Linux-source-3.16.tar.xz is the source of the compressed package (find a place to decompress, the following is called the source of the root of the Linux extracted $linux-tree), and linux-config-3.16 in the required config file, find a and uname-r output similar config, for 32-bit Debian should be config.i386_none_686-pae.xz, after decompression renamed. Config to $linux-tree, now you can compile the kernel and try it.
- Make Menuconfig (Enter/Start search, then enter localversion, press 1 to select Local version, enter a suffix that you can identify)
- Make Bzimage Modules
- sudo make Modules_install
- sudo make install
The compiled kernel is automatically installed into the/boot/directory, and the module is under/lib/modules/3.16.36xxx.
Simply run the Grub2-mkconfig-o/boot/grub2/grub.cfg to put the newly compiled kernel into the Boot Grub menu (try it out)
Download Xenomai and I-pipe
https://xenomai.org/downloads/xenomai/stable/latest/I downloaded is 3.0.3 version, decompression, the back is called Xenomai source root directory for $xeno-tree
Also to download the corresponding version of the I-pipe patch, I downloaded this https://xenomai.org/downloads/ipipe/v3.x/x86/older/ipipe-core-3.16-x86-3.patch (later I found that there was an unpublished version of the I-pipe patch for 3.16.36, but I didn't try again)
Install the Build tool: Apt Install autoconf automake libltdl-dev
(Note: Libltdl-dev must be installed, otherwise bootstrap will not pass, see https://xenomai.org/faq/)
Patch Kernel
Although Xenomai3 can also run under normal Linux, but that is certainly not what we want, we still want to cobalt the dual-core architecture, first of all, we have to patch the kernel up, because we do not correspond to the kernel minor version of the patch, so this step also need to manually adjust
- CD $linux-tree
- Patch-p1 < Ipipe-core-3.16-x86-3.patch
There will be some failures, there are some offset after the success of the item, according to my experience, the direct display of the success of the Tube, fuzz after the success of the attention, offset too much to focus on the inspection, it is possible wrong, if the failure, will generate a. rej file, so in the $linux-tree directory, Execute find. -name *.rej will be able to find these failed positions. Each @@ represents the beginning of a patch block, and the last @@ of the peer represents the current context (that is, the code above the modified block can be searched for this position, then see), there is no + or-the unchanged context of the change,-the deletion + means to add, take a closer look, General failure of the situation is also very good to determine how to correct, rarely encountered the function of renaming the situation, need to pay attention to, we recommend that you manually.
After all the REJ are done, prepare the kernel according to Xenomai's instructions, i.e. execute scripts/prepare-kernel.sh--linux= $linux-tree--arch=x86
OK below is the configuration kernel, make menuconfig, you may see xenomai below a bunch of warning, according to this page to configure the https://xenomai.org/2014/06/ configuring-for-x86-based-dual-kernels/, i.e.
- Config_cpu_freq–disable
- Config_apm–disable
- Config_acpi_processor–disable
- Config_cpu_idle–disable
- Config_intel_idle–disable
- Config_input_pcspkr–disable
- Migration/compaction-disable
If there are other warning, please try to eliminate the warning, look more help, some items are selected by other items, can not directly change, you have to change the selection of its items. Also note that ACPI can not all choose, that will not start the machine, or the machine is particularly slow (my PCI IRQ error, and the USB is not good), ACPI only selected processor.
All right, recompile the kernel. Make bzimage modules && sudo made modules_install && sudo make install
Restart, no accident can start the machine, after the DMESG | grep Xenomai, there should be some output, otherwise there is a problem. In addition, there is an SMI problem, this needs to modify the Grub boot parameters, add xenomai.smi=enabled to the kernel parameters, but this may lead to hardware corruption, such as CPU overheating burned down (see here https://xenomai.org/2014 /06/configuring-for-x86-based-dual-kernels/dealing-with-x86-smi-troubles), look at it yourself.
Compiling the Xenomai Library
- CD $xeno-tree
- Scripts/bootstrap
- mkdir Build
- CD Build
- .. /configure--with-core=cobalt--ENABLE-SMP--enable-pshared (basically everyone should be multi-core processors, the default kernel has SMP turned on)
- Make
- sudo make install
Install the library in the/usr/xenomai folder, execute sudo/usr/xenomai/bin/xeno-test, note that you must use root to run the test, and this test will not end by default, you must end the CTRL + C, see/usr/ Xenomai/bin/latency--help, you know the parameters of the latency test.
PS: My t410i book run a real-time task is still good, 50us round cycle, the maximum latency is more than 11us, also can!
Xenomai for Debian Jessie