树莓派Raspiberry 编译Linux实时内核PREEMPT 您所在的位置:网站首页 树莓派实时网速 树莓派Raspiberry 编译Linux实时内核PREEMPT

树莓派Raspiberry 编译Linux实时内核PREEMPT

2023-10-14 07:21| 来源: 网络整理| 查看: 265

树莓派4B 实时内核(Preempt_RT)的配置和编译https://blog.csdn.net/zlp_zky/article/details/114994444

基本按照这个blog来操作.

几点问题:1. 官方raspios 只有4.19.y-rt 是打过补丁的,可以直接下载编译.其它版本需要自己下载raspi 源码并打补丁.

-----------------------------------------------------------------

获取树莓派内核编译配置文件.config,该文件可从/proc/config.gz中获取,或者通过make生成

方法1:

$ sudo modprobe configs$ zcat /proc/config.gz > .config

然后基于此 .config文件, 用树莓派的设定 修改它:# KERNEL=kernel7# make bcm2837_defconf (针对rpi 3b+)

#KERNEL=kernel7l# make bcm2711_defconf (针对rpi 4b+)

---------------------------------------------------------------

(2)blog中编译命令make -j4 zImage modules dtbs

其中 zImage 已经没有了(我的arm64平台上没有了). . . 可以直接编译成 deb的包形式,方便安装.对应的编译目标为: deb-pkg

如下命令可以放到后台,之后关机睡觉, 第二天早上看是否编译完成# nohup make -j4  zImage modules dtbs deb-pkg &> ~/maketask.out &

查看编译的命令:# watch -n 0.5 tail ~/maketask.out -n20

查看后台make是否运行:# ps -aux | grep make

3. 编译过程中, 会产生一个编译错误,导致编译退出. 建议先修改好源码, 在开始编译, 在关机睡觉~~~否则第二天一场空.

/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined herecollect2: error: ld returned 1 exit status————————————————解决: 采用此贴中的方法一, 并没有注释那行, 而是加上 extern 就好了. https://blog.csdn.net/weixin_42792088/article/details/121657463

4. 编译完成后, 在源代码同一级目录下产生3个deb包:

linux-headers-4.19.71-rt24-v8_4.19.71-rt24-v8-1_arm64.deblinux-image-4.19.71-rt24-v8_4.19.71-rt24-v8-1_arm64.deblinux-libc-dev_4.19.71-rt24-v8-1_arm64.deb

5. 安装本地deb包, 没有yum localinstall xxx 的类似命令, 可使用gdebi代替:# apt install gdebi-core# gdebi linux-image-4.19.71-rt24-v8_4.19.71-rt24-v8-1_arm64.deb

6. 安装前是5.10的内核,但是不带实时补丁. (https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2021-11-08/2021-10-30-raspios-bullseye-arm64-lite.zip)Linux ProfinetPI 5.10.63-v8+ #1459 SMP PREEMPT Wed Oct 6 16:42:49 BST 2021 aarch64 GNU/Linux测试实时性:# apt-get install rt-tests# cyclictest -t 5 -p 80 -n新版本参数-n没有了, 改为次数10000, 即: -l 10000, 结果# cyclictest -t 5 -p 80 -l 10000WARN: cyclictest was not built with the numa option# /dev/cpu_dma_latency set to 0uspolicy: fifo: loadavg: 0.24 0.17 0.10 1/134 262521

T: 0 (262515) P:80 I:1000 C: 10000 Min: 12 Act: 26 Avg: 22 Max: 178T: 1 (262516) P:80 I:1500 C: 6669 Min: 11 Act: 29 Avg: 19 Max: 102T: 2 (262517) P:80 I:2000 C: 5001 Min: 13 Act: 30 Avg: 23 Max: 196T: 3 (262518) P:80 I:2500 C: 4001 Min: 14 Act: 29 Avg: 23 Max: 104T: 4 (262519) P:80 I:3000 C: 3334 Min: 14 Act: 29 Avg: 23 Max: 135

7. 安装更改配置文件/boot/config.txt, 以切换新的内核. $ vi /boot/config.txt 最后一行添加: kernel=vmlinuz-4.19.71-rt24-v8之后重启~~

8. 验证是否是刚编译的内核:# uname -aLinux ProfinetPI 4.19.71-rt24-v8 #1 SMP PREEMPT RT Wed Jan 26 01:35:13 CST 2022 aarch64 GNU/Linux再次运行测试:WARN: cyclictest was not built with the numa option# /dev/cpu_dma_latency set to 0uspolicy: fifo: loadavg: 0.93 0.63 0.27 1/147 741

T: 0 ( 737) P:80 I:1000 C: 10000 Min: 9 Act: 30 Avg: 24 Max: 93T: 1 ( 738) P:80 I:1500 C: 6673 Min: 9 Act: 30 Avg: 24 Max: 109T: 2 ( 739) P:80 I:2000 C: 5005 Min: 11 Act: 33 Avg: 24 Max: 101T: 3 ( 740) P:80 I:2500 C: 4004 Min: 10 Act: 32 Avg: 27 Max: 99T: 4 ( 741) P:80 I:3000 C: 3336 Min: 11 Act: 29 Avg: 25 Max: 94

Max值好像小了不少. 总体差别不到 . . . . 空载时候估计也不会有啥差别, 等cpu任务繁忙时再测试.

 

 

 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有