zynq操作系统:Linux打实时补丁preempt_rt

简介: Linux打实时补丁preempt_rt

1下载内核和补丁

  运行uname -a可以看到当前内核版本。

  补丁地址: https://www.kernel.org/pub/linux/kernel/projects/rt/ 从中选择一个与当前内核版本接近并且更新的补丁下载(系统启动时会自动选择版本更高的内核)

  内核地址: http://www.kernel.org/pub/linux/kernel/ 根据下载的补丁版本下载内核,内核版本要和补丁一致。

下面以linux-4.14.0内核(xilinx)与patch-4.14.0-rt1.patch补丁为例进行说明。

2.打补丁

  将解压后的补丁放到解压后的内核文件夹里面

  patch -p1 < patch-4.14-rt1.patch

  patch -R -p1 < patch-4.14-rt1.patch(卸载补丁)

3.内核配置

  1.安装几个必要的套件

  sudo apt-get install libncurses5-dev flex bison

  2.然后设置内核抢占模式

  Preemption Model

  Fully Preemptible Kernel(Real-Time

config - Linux/arm 4.14.0 Kernel Configuration> Kernel Features -
- Kernel Features.
Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty submenus ----). Highlighted letters are hotkeys. Pressing <Y>
includes<N> excludes, <M> modularizes features. Press <Esc><Esc> to exit,<?> for Help, </> for Search. Legend: [*] built-in []
↑(=)-
(4) Maximum number of CPUs(2-32)_ * _ Support for hot-pluggable CPUs
Support for the Arm Power State Coordination Interface (PSCI) Preemption Model (Fully Preemptible Kernel (RT)) ---> Timer frequency (100 Hz) --->
[ ] Compile the kernel in Thumb-2 mode
[*] Runtime patch udiv/sdiv instructions into aeabi {u}idiv().*_ Use the ARM EABI to compile the kernel
[] Allow old ABI binaries to run with this kernel (EXPERIMENTA[*] High Memory Support↓(+)
Select> < Exit >  < Help >  Save >  < Load >  
<
Hx--1024
.config - Linux/arm 4.14.0 Kernel Configuration→ Kernel Features
Preemption Model
Use the arrow keys to navigate this window or press the
hotkey of the item you wish to select followed by the <SPACE BAR>,Press <?> for additional information about this
()  No Forced Preemption (Server) 
() Voluntary Kernel Preemption (Desktop)
( ) Preemptible Kernel (Low-Latency Desktop)
Preemptible Kernel (Basic RT)(x) Fully Preemptible Kernel (RT)
Select> < Help >  
Hx--1024

  注意:由于Linux的版本不同,位置可能不一样,直接/在menuconfig里面不知道什么原因时搜索Preemption Model时搜不到的,怀疑没有编写进kconfig,所以可以查询到配置页面的kconfig文件,先判断有没有将执行语句编写进去,可以加一句容易搜索的测试用于定位

  vim Kconfig.preempt

5 1 config UCAS TEST
bool "ucas test" config PREEMPT NONE
bool "No Forced Preemption (Server)"
9
help
1日
This is the traditional Linux preemption model, geared towards throughput. It will still provide good latencies most of the time. but there are no auarantees and occasional lonaer delavs are possible.
14
5 Select this option if you are building a kernel for a server or 
26
scientific/computation system, or if you want to maximize the raw processing power of the kernel, irrespective of scheduling
18
10  latencies.  Hx--1024  

  3.make mrproper # 删除目录下残留的.o文件和其他从属文件

  make menuconfig

  回到上一层,进入”Device Drivers”中,去掉“Staging drivers”

Device Drivers
Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty submenus----). Highlighted letters are hotkeys. Pressing <Y>
includes,<N> excludes,<M> modularizes features. Press <Esc><Esc> to exit,<?> for Help,</> for Search. Legend: [*] built-in [ ]
A(a)-
[*] virtio drivers --->
Microsoft Hyper-V guest support ---> Xen driver support ---><M> Greybus support ---> i ] staging drivers ---.
.*. x86 Platform Specific Device Drivers --->
[1platform support for Goldfish virtual devices -...<M> platform support for chrome hardware (transitional)
<Select>  < Exit >  < Help >  < Save >  <Load >Hx--1024

  4.编译内核重启

root@zynq:~# cd root@zyng:/# ls
bin boot root@zyng:/# cd mnt dev etc home.lib media mnt proc run sbin
root@zynq:/mnt# ls
1.txt
root@zynq:/mnt# uname -r
4.14.0-rtl-xilinx
rootdzynq:/mnt# uname -a
Linuxzyng4.14.0-rt1-xilinx#1 SMP PREEMPT RT Fri Ju1 2319:40:37 PDT 2021 root@zynq:/mnt#
Xterm by subscribing to the professional edition here:http://mobaxterm.mobatek.net

  查看内核版本 妥了!



相关文章
|
4天前
|
存储 Linux C语言
Linux:冯·诺依曼结构 & OS管理机制
Linux:冯·诺依曼结构 & OS管理机制
9 0
|
1月前
|
存储 Linux
linux查看系统版本、内核信息、操作系统类型版本
linux查看系统版本、内核信息、操作系统类型版本
62 9
|
3天前
|
存储 Shell Linux
操作系统实战(一)(linux+C语言)
本篇文章重点在于利用linux系统的完成操作系统的实验,巩固课堂知识
|
4天前
|
Linux Shell
Linux操作系统下查找大文件或目录的技巧
Linux操作系统下查找大文件或目录的技巧
10 2
|
4天前
|
算法 Ubuntu Linux
为什么Linux不是实时操作系统
本文探讨了Linux为何不是实时操作系统(RTOS)。实时性关乎系统对事件的确定性响应时间,而Linux虽能保证调度执行的实时任务,但无法确保中断响应时间、中断处理时间和任务调度时间的确定性。中断响应时间受中断屏蔽时间影响,Linux中无法确保;中断处理时间因不支持中断嵌套而不确定;任务调度时间虽快,但调度点的限制影响实时性。Linux的定位是通用操作系统,追求平均性能而非绝对实时性。为改善实时性,Linux提供了不同抢占模型,如可抢占内核(Low-Latency Desktop)和PREEMPT-RT补丁,后者接近硬实时但牺牲了吞吐量。PREEMPT-RT正逐渐成为Linux实时增强的标准。
10 1
为什么Linux不是实时操作系统
|
4天前
|
存储 Ubuntu Linux
xenomai3+linux构建linux实时操作系统-基于X86_64和arm
Xenomai是一个实时性解决方案,通过在Linux上添加实时内核Cobalt来增强实时性能。它有三个主要部分:libcobalt(用户空间实时库)、Cobalt(内核空间实时内核)和硬件架构特定层(ipipe-core或dovetail)。ipipe-core适用于Linux 5.4以下版本,而dovetail用于5.4及以上版本。本文介绍了在X86 Ubuntu环境下,如何编译Xenomai内核,搭建应用环境,包括配置、编译、安装和实时性测试。对于其他硬件架构,如ARM和ARM64,步骤类似。文章还提到了Xenomai与Linux内核版本的兼容性和实时性测试结果。
13 0
xenomai3+linux构建linux实时操作系统-基于X86_64和arm
|
4天前
|
消息中间件 测试技术 Linux
linux实时操作系统xenomai x86平台基准测试(benchmark)
本文是关于Xenomai实时操作系统的基准测试,旨在评估其在低端x86平台上的性能。测试模仿了VxWorks的方法,关注CPU结构、指令集等因素对系统服务耗时的影响。测试项目包括信号量、互斥量、消息队列、任务切换等,通过比较操作前后的时戳来测量耗时,并排除中断和上下文切换的干扰。测试结果显示了各项操作的最小、平均和最大耗时,为程序优化提供参考。注意,所有数据基于特定硬件环境,测试用例使用Alchemy API编写。
11 0
linux实时操作系统xenomai x86平台基准测试(benchmark)
|
15天前
|
存储 Oracle 关系型数据库
linux操作系统相关资源优化
【4月更文挑战第21天】基于操作系统的性能优化也是多方面的,主要是系统安装、系统内核参数、网络参数、文件系统等几个方面进行衡量
25 2
|
20天前
|
存储 缓存 安全
【linux基础(八)】计算机体系结构--冯诺依曼系统&操作系统的再理解
【linux基础(八)】计算机体系结构--冯诺依曼系统&操作系统的再理解
|
28天前
|
Linux 内存技术 Perl
【ZYNQ】制作从 QSPI Flash 启动 Linux 的启动文件
【ZYNQ】制作从 QSPI Flash 启动 Linux 的启动文件