Linux - HowardWhile/2022_note GitHub Wiki

Linux

preempt_rt

https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/preemptrt_setup

https://blog.csdn.net/qq_28882933/article/details/118293544

https://www.twblogs.net/a/5d8745c4bd9eee5327000981?lang=zh-cn

https://hackmd.io/@oscarshiang/peempt_rt_raspi

下載和patch

https://askubuntu.com/questions/1349568/installing-real-time-patch-for-ubuntu-20-04

https://chenna.me/blog/2020/02/23/how-to-setup-preempt-rt-on-ubuntu-18-04/

下載

https://www.kernel.org/pub/linux/kernel/ 例如 linux-5.4.19 kernel from kernel.org and the rt patch

wget https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.4.19.tar.xz
wget https://mirrors.edge.kernel.org/pub/linux/kernel/projects/rt/5.4/patch-5.4.19-rt11.patch.xz

解壓與patch

xz -cd linux-5.4.19.tar.xz | tar xvf -
cd linux-5.4.19
xzcat ../patch-5.4.19-rt11.patch.xz | patch -p1

config

複製本機的config檔,並且以之為基礎修改成RT kernel的版本

這邊我是先透過mainline將os kernel先換成跟要編譯的kernel版本一樣

cd linux-5.4.19
cp /boot/config-5.3.0-40-generic .config

image-20221202095739944

配置

make oldconfig

主要是提示Preemption Model要修改成Fully Preemptible Kernel如圖:

編譯

#make -j8 deb-pkg 
make -j$(nproc) bindeb-pkg

我用deb-pkg編譯打包會出錯誤改用bindeb-pkg則正常

編譯好久 I7-8700 12核心編譯要2個小時

編譯環境需要的pkg

ㄧapt install make libncurses-dev

make這應該不用解釋

libncurses-dev 使用配置config的指令時make menuconfig會提示缺少

編譯報錯

https://blog.csdn.net/qq_36393978/article/details/118157426

要修改.config之中的兩個參數

CONFIG_SYSTEM_TRUSTED_KEYS CONFIG_SYSTEM_REVOCATION_KEYS

https://blog.csdn.net/qq_36393978/article/details/124274364

sudo apt install dwarves

測試實時性

apt install rt-tests
#cyclictest
cyclictest -p 90 -S

-p: 優先級記得要打

-S: 標準測試

怎麼看ubuntu的版本代號

https://linuxconfig.org/ubuntu-22-04-kernel-version

uname -r
5.15.0-52-generic
  • 5 – Kernel version.
  • 15 – Major revision.
  • 0 – Minor revision.
  • 52 – Patch number.

Linux kernel 安裝與切換

https://ubunlog.com/zh-TW/ukuu-abandona-la-licencia-gpl-y-ubuntu-mainline-kernel-installer-ocupa-su-lugar/

https://github.com/bkw777/mainline

https://www.sysgeek.cn/ubuntu-install-linux-mainline-kernel/

sudo add-apt-repository ppa:cappelikan/ppa
sudo apt update
sudo apt install mainline
mainline-gtk

image-20221201111429247

Home