实时补丁操作步骤
1、 在Linux系统中执行命令uname -a
查看Linux内核版本,双数结尾的版本为稳定版本(内核版本为5.15.0)
2、下载相应的补丁压缩包与内核源码压缩包
由于内核版本5.15,这里选择linux-5.15.tar.xz,补丁选择patch-5.15-rt17.patch.xz
3、下载成功在压缩包所在路径执行解压命令,同时打入补丁代码
- xz -cd linux-5.15.tar.xz | tar xvf -
- cd linux-5.15/
- xzcat …/patch-5.15-rt17.patch.xz | patch -p1
4、安装内核编译工具
- 更新apt-get:sudo apt-get update
- 安装gcc:sudo apt-get install gcc
- 安装make:sudo apt-get install make
- 安装ncurses-dev :sudo apt-get install ncurses-dev
- 安装bison : sudo apt-get install bison
- 安装flex : sudo apt-get install flex
- 安装libssl-dev: sudo apt-get install libssl-dev
- 安装libelf-dev: sudo apt-get install libelf-dev
5、生成当前内核配置文件
- make localmodconfig
6、修改配置(弹出图形化界面)
- make menuconfig
依次选择
General setup -->Preemption Model(Fully Preemptible Kernel (Real-Time))或者Preemption Model(Voluntary Kernel Preemptible (Desktop)) --> FUlly Preemptible Kernel(Real-Time)
7、编译内核
- make -j 4 (4代表4线程同时编译)
8、安装内核模块
-
sudo make modules_install
如果安装内核模块抛出该异常arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support sed: can't read modules.order: No such file or directory make: *** [Makefile:1501: __modinst_pre] Error 2
- 按以下步骤修改
.config
文件- vim编辑器打开.config文件
sudo vim .config
(?:搜索命令) - 修改
CONFIG_SYSTEM_TRUSTED_KEYS=""
,将其赋空值,(修改前:CONFIG_SYSTEM_TRUSTED_KEYS=“debian/canonical-certs.pem”) - 修改
CONFIG_SYSTEM_REVOCATION_KEYS=""
将其赋空值,(修改前:CONFIG_SYSTEM_REVOCATION_KEYS=“debian/canonical-revoked-certs.pem”) - 修改
CONFIG_DEBUG_INFO_BTF=n
,(修改前CONFIG_DEBUG_INFO_BTF=y) - 保存并退出(esc–>:wq–>enter)
- vim编辑器打开.config文件
- 重新执行
make -j 4
编译内核
- 按以下步骤修改
9、安装内核
- sudo make install
出现以下提示表示安装成功arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support sh ./arch/x86/boot/install.sh 5.15.0-rt17 \ arch/x86/boot/bzImage System.map "/boot" run-parts: executing /etc/kernel/postinst.d/initramfs-tools 5.15.0-rt17 /boot/vmlinuz-5.15.0-rt17 update-initramfs: Generating /boot/initrd.img-5.15.0-rt17 run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 5.15.0-rt17 /boot/vmlinuz-5.15.0-rt17 run-parts: executing /etc/kernel/postinst.d/update-notifier 5.15.0-rt17 /boot/vmlinuz-5.15.0-rt17 run-parts: executing /etc/kernel/postinst.d/xx-update-initrd-links 5.15.0-rt17 /boot/vmlinuz-5.15.0-rt17 I: /boot/initrd.img is now a symlink to initrd.img-5.15.0-rt17 run-parts: executing /etc/kernel/postinst.d/zz-update-grub 5.15.0-rt17 /boot/vmlinuz-5.15.0-rt17 Sourcing file `/etc/default/grub' Sourcing file `/etc/default/grub.d/init-select.cfg' Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.15.0-71-generic Found initrd image: /boot/initrd.img-5.15.0-71-generic Found linux image: /boot/vmlinuz-5.15.0-rt17 Found initrd image: /boot/initrd.img-5.15.0-rt17 Warning: os-prober will not be executed to detect other bootable partitions. Systems on them will not be added to the GRUB boot configuration. Check GRUB_DISABLE_OS_PROBER documentation entry. done
10、选择实时内核启动
利用grub指定Ubuntu启动时默认的linux内核
- 按以下步骤操作
- 先重启,快速按ESC进入GNU grub界面,进入Advanced options for Ubuntu, 找到自己想要启动的Linux内核
- 如下图所示需要启动的内核为第三个
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-F8DIaVkx-1685955660077)(https://foruda.gitee.com/images/1684147908427956271/b971d113_9032182.png “屏幕截图”)] - 进入Ubuntu系统,打开终端,输入sudo vim /etc/default/grub, 把其中的GRUB_DEFAULT=0 修改GRUB_DEFAULT=“Advanced options for Ubuntu > Ubuntu, with Linux 5.15.0-rt17”
- 在终端输入 sudo update-grub, 启动设置
11、重启
- 执行命令
uname -a
,内核显示rt字样表示安装成功
连接WIFI
-
安装WIFI相关工具
- network-manager - 网络管理工具
- wpasupplicant - 提供对 WPA 加密的支持
- wireless-tools - 提供 iwconfig、iwlist 等无线网络配置工具
执行命令
sudo apt install network-manager wpasupplicant wireless-tools
查看无线网卡名称,名称一般以 wlan 或 wlp 开头:
ifconfig -a
-
扫描无线网络
sudo iwlist <网卡名称> scan
过滤无线网名称
sudo iwlist <网卡名称> scan | grep ESSID # 仅查看wifi的名称
-
修改配置文件
sudo vim /etc/netplan/00*-wifi.yaml
- 以wifi结尾的文件通常的wifi的网络配置文件或者有线网卡与wifi为同一个网络配置文件
修改后的文件格式为
network: version: 2 wifis: <无线网卡名称>: dhcp4: true access-points: <wifi名称>: password: <wifi密码>
如果修改静态IP需要把dhcp4:设置为false或者不设置与有线网卡设置一样
修改文件如下network: version: 2 wifis: <无线网卡名称>: addresses: [192.168.0.125/24] nameservers: addresses: [192.168.0.125] routes: - to: default via: 192.168.0.1 access-points: <wifi名称>: password: <wifi密码>
-
验证修改是否正确,尝试连接网络
sudo netplan try
如果网络配置没有问题,按下回车enter键确认即可
输入 ifconfig 查看是否连接至网络,若未连接网路,重启即可