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

  查看内核版本 妥了!



相关文章
|
8月前
|
Ubuntu 物联网 Linux
从零安装一个Linux操作系统几种方法,以Ubuntu18.04为例
一切就绪后,我们就可以安装操作系统了。当系统通过优盘引导起来之后,我们就可以看到跟虚拟机中一样的安装向导了。之后,大家按照虚拟机中的顺序安装即可。 好了,今天主要介绍了Ubuntu Server版操作系统的安装过程,关于如何使用该操作系统,及操作系统更深层的原理,还请关注本号及相关圈子。
|
存储 Linux API
【Linux进程概念】—— 操作系统中的“生命体”,计算机里的“多线程”
在计算机系统的底层架构中,操作系统肩负着资源管理与任务调度的重任。当我们启动各类应用程序时,其背后复杂的运作机制便悄然展开。程序,作为静态的指令集合,如何在系统中实现动态执行?本文带你一探究竟!
【Linux进程概念】—— 操作系统中的“生命体”,计算机里的“多线程”
|
存储 Linux iOS开发
【Linux】冯诺依曼体系与操作系统理解
本文深入浅出地讲解了计算机体系的两大核心概念:冯诺依曼体系结构与操作系统。冯诺依曼体系作为现代计算机的基础架构,通过中央处理器、存储器和输入输出设备协同工作,解决了硬件性能瓶颈问题。操作系统则是连接硬件与用户的桥梁,管理软硬件资源,提供运行环境。文章还详细解析了操作系统的分类、意义及管理方式,并重点阐述了系统调用的作用,为学习Linux系统编程打下坚实基础。适合希望深入了解计算机原理和技术内幕的读者。
336 1
|
8月前
|
Ubuntu Unix Linux
操作系统的最强入门科普(Unix/Linux篇)
下期文章,小枣君会重点聊聊Windows和macOS那条线。敬请关注! 如果大家觉得文章不错,还请帮忙多多转发!谢谢!
|
8月前
|
监控 Ubuntu Linux
什么Linux,Linux内核及Linux操作系统
上面只是简单的介绍了一下Linux操作系统的几个核心组件,其实Linux的整体架构要复杂的多。单纯从Linux内核的角度,它要管理CPU、内存、网卡、硬盘和输入输出等设备,因此内核本身分为进程调度,内存管理,虚拟文件系统,网络接口等4个核心子系统。
903 0
|
8月前
|
Unix 物联网 Linux
都什么年代了,你还不懂啥是Linux操作系统
至于华为鸿蒙操作系统是不是独树一帜,这个留给各位阅读本文的网友们来讨论
365 0
|
8月前
|
Web App开发 缓存 Rust
|
8月前
|
安全 Linux iOS开发
linux属于什么操作系统
Linux是一种自由和开放源代码的操作系统,具有高度的灵活性和可定制性。与常见的操作系统如Windows和macOS相比,Linux具有自由、安全和稳定等优势。Linux已广泛应用于服务器、桌面电脑、超级计算机和嵌入式设备等领域,并且在未来的发展前景广阔。由于其自由和开放源代码的特性,Linux还促进了计算机技术和社区的发展,为全球的计算机用户提供了更多的选择和可能性。
|
8月前
|
安全 Ubuntu Unix
关于Linux操作系统,你必须要知道的事
我们可以看到无论是Debian还是Buildroot都有各自的特点,为客户提供了更大的选择空间和灵活性,大家可以根据自己的需求选择合适的版本来满足终端用户的体验和功能需求。从平技术将会一直关注更多更安全、灵敏、易于开发的Linux版本,做好适配工作,不断为客户带来“简单开发、方便应用”的使用体验。
|
8月前
|
安全 Ubuntu Linux
如何安装Linux操作系统?
此时,您可以选择重新启动计算机,然后从硬盘上的Linux系统启动。以上是一个大致的安装过程。请注意,不同的Linux发行版可能会在细节上有所差异,因此在进行安装之前,请确保您阅读并理解了相应发行版的安装指南或文档。

热门文章

最新文章