第一步,下载:
$ wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.4.164.tar.xz
$ wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/4.4/patch-4.4.164-rt176.patch.xz
参考
https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/preemptrt_setup
https://www.xuebuyuan.com/3233840.html
第二步,打补丁:
$ xz -cd linux-4.4.164.tar.xz | tar xvf -
$ cd linux-4.4.164
$ xzcat ../patch-4.4.164-rt176.patch.xz | patch -p1
第三步,修改配置:
make menuconfig
第四步,内核编译:
相关包安装
apt-get install -y gcc
apt-get install make
apt-get install libncurses-dev
apt-get install libncurses5-dev libncursesw5-dev
apt-get install -y bison
apt-get install -y flex
apt-get install -y bc
apt-get install -y libssl-dev
编译:
# 根据cpu核数*2
make -j16
make modules -j16
make modules_install
make install
第五步,引导:
参考 https://blog.csdn.net/fjt19900921/article/details/8316481
sudo mkinitramfs -o /boot/initrd.img-4.4.164
sudo update-initramfs -c -k 4.4.164
sudo update-grub2 //自动修改系统引导配置,产生grub.cfg启动文件。
测试工具
1 cyclictest
https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/rt-tests#compile-and-install
https://blog.csdn.net/longerzone/article/details/16897655
https://www.xuebuyuan.com/3233840.html
2 stresstest
sudo stress --cpu 8 --timeout 20
stress --vm 10 --vm-bytes 1G --vm-hang 100 --timeout 100s
stress --vm 10 --vm-bytes 500M --vm-hang 100 --timeout 100s
https://www.tecmint.com/linux-cpu-load-stress-test-with-stress-ng-tool/
https://www.cnblogs.com/muahao/p/6346775.html
压力测试
压力:innotek@ubuntu-innotekcar-001:~$ stress --vm 10 --vm-bytes 500M --vm-hang 100 --timeout 100s
测试:innotek@ubuntu-innotekcar-001:~/rt-tests$ sudo cyclictest -t1 -p 80 -n -i 10000 -l 100000
非实时结果:
实时结果:
----
另类结果:
innotek@ubuntu-innotekcar-001:~$ stress --vm 10 --vm-bytes 1G --vm-hang 100 --timeout 100s
and
innotek@ubuntu-innotekcar-001:~/rt-tests$ sudo cyclictest -t1 -p 80 -n -i 10000 -l 10000
执行期间shell卡死,无法操作
结果T: 0 ( 4759) P:80 I:10000 C: 2146 Min: 1 Act: 2 Avg: 3 Max: 98。。。???可能cyclictest也无法正常测试