kernel build & preempt-rt patch & xenomai
提前准备好 linux 内核源代码,假设是 x86 系统。能够去下载原生内核(Vanilla kernel):
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.17.tar.gz
假设是arm系统,或者其它系统,则下载厂商定制过的内核源代码。
假设有须要。patch内核。如 preempt-rt 补丁:(注意补丁版本号必须与内核版本号相应,此处均为 3.18.17 版本号。假设是定制过的内核。则必须找到相应定制过的补丁.)
wget https://www.kernel.org/pub/linux/kernel/projects/rt/3.18/patch-3.18.17-rt14.patch.gz // 注意 patch 和 patchs
cd linux-3.18.17 //内核源代码根文件夹
zcat ../patch-3.18.17-rt14.patch.gz | patch -p1 // 打补丁,假设.bz2压缩格式则使用 bzcat;
// 假设在源代码根文件夹的上层文件夹。则 patch -p0 < xxx.patch
在现有系统上改动配置:
make mrproper //清理一下
scp pi@raspberrypi:/proc/config.gz . //复制现有系统的配置文件,x86系统则能够找到 /boot/config-3.18.17-32-generic 文件
gunzip -c config.gz > .config
// 由于你的交叉编译器可能不叫gcc。而是 arm-linux-gnueabihf-gcc,所以:
export CCPREFIX=/home/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-
// 这样子执行你的交叉编译器:
${CCPREFIX}gcc -v
//依据须要改动.config文件,或者 make menuconfig 图形化改动内核配置
ARCH=arm CROSS_COMPILE=${CCPREFIX} make menuconfig
ARCH=arm CROSS_COMPILE=${CCPREFIX} make -jx // build kernel, 多核系统
mkdir module_build_directory
INSTALL_MOD_PATH=module_build_directory make modules_install // build modules
// 这里是交叉编译。所以不能直接安装。假设是x86系统,直接 make && sudo make modules_install && sudo make install && sudo update-grub 就可以
复制新的内核到sd卡(树莓派2)
Copy arch/arm/boot/Image to /boot/kernel7.img on SD card.
Copy arch/arm/boot/dts/bcm2709-rpi-2-b.dtb to /boot/bcm2709-rpi-2-b.dtb on SD card
Copy (merge if necessary) kernel-rt/lib to / on SD card.
cd linux/arch/arm/boot
scp Image pi@raspberrypi:/tmp
scp dtb/bcm2709-rpi-2-b.dtb pi@raspberrypi:/tmp
cd module_build_directory
tar czf modules.tgz *
scp modules.tgz pi@raspberrypi:/tmp
// ssh to raspberry
ssh pi@your_ip_address_to_rasp
cd /
sudo mv /tmp/Image /boot/kernel7.img // 忽略属性不同的信息
scp mv /tmp/bcm2709-rpi-2-b.dtb /boot/bcm2709-rpi-2-b.dtb
sudo tar xzf /tmp/modules.tgz // 解压后能够通过ls /lib/modules查看
关于内核配置
Symbol(s) Description:
[ ], [*] Options in square brackets can be activated or deactivated. The asterisk marks the menu entry as activated. The value can be changed with the space key. It is also possible to press Y key (Yes) to activate or N key (No) to deactivate the selected entry.
If the option is activated, the selected feature/driver will be built into the kernel and will always be available at boot time.
< >, <M>, <*> Options in angle brackets can be activated or deactivated, but also activated as module (indicated by a M). The values can be modified by pressing Y/N keys as before or by pressing the M key to activate the feature/driver as a module.
See the Kernel Modules article for differentiation.
{M}, {*} Options in curly brackets can be activated or activated as module but not be deactivated. This happens because another feature/driver is dependent on this feature.
-M-, -*- Options between hyphens are activated in the shown way by another feature/driver. There is no choice.
Tag Description:
(NEW) This driver is new in the kernel and is maybe not stable enough.
(EXPERIMENTAL) This driver is experimental and most likely not stable enough.
(DEPRECATED) This driver is deprecated and not needed for most systems.
(OBSOLETE) This driver is obsolete and should not be activated.
关于 x86 的 preemt-rt patch & kernel build,见 连接:
t=2273355">https://ubuntuforums.org/showthread.php?
t=2273355
- http://askubuntu.com/questions/72964/how-can-i-install-a-realtime-kernel
- https://sourceforge.net/p/emc/mailman/message/33665819/ 这个注意是使用 64 位系统还是 32位。可能须要改动 .config 文件。
假设有哪个 kernel config 不懂的话。能够在这个里头搜:
preempt-rt kernel config:
CONFIG_PREEMPT_RT_FULL: Kernel Features > Preemption Model > Fully Preemptible Kernel (RT)
Enable HIGH_RES_TIMERS: General Setup > Timers subsystem > High Resolution Timer Support (already enabled)
去掉某些 ACPI 和 PowerManage 相关选项,不能所有去掉,由于高精度时钟可能会依赖当中某些配置
去掉 CPU 频率调整选项等
去掉 Device Driver 中的 Staging Drivers 选项
去掉 Kernel Hacking 中的某些 debug 选项(假设不须要debug内核的话)
推荐配置例如以下(xenomai-2.6.5):
* General setup
--> Local version - append to kernel release: -xenomai-2.6.5
--> Timers subsystem
--> High Resolution Timer Support (Enable)
* Real-time sub-system
--> Xenomai (Enable)
--> Nucleus (Enable)
* Power management and ACPI options
--> Run-time PM core functionality (Disable)
--> ACPI (Advanced Configuration and Power Interface) Support
--> Processor (Disable)
--> CPU Frequency scaling
--> CPU Frequency scaling (Disable)
--> CPU idle
--> CPU idle PM support (Disable)
* Pocessor type and features
--> Processor family
--> Core 2/newer Xeon (if \"cat /proc/cpuinfo | grep family\" returns 6, set as Generic otherwise)
* Power management and ACPI options
--> Memory power savings
--> Intel chipset idle memory power saving driver
假设遇到问题,查看 linux log ( dmesg | grep -i xenomai
),查找相应问题 see link: http://www.xenomai.org/documentation/xenomai-head/TROUBLESHOOTING.txt
假设是 xeno latency 測试,发现 周期性高延时,那么非常可能是遇到了 SMI 的问题。
About how to fix it:
FixingSMIIssues">http://wiki.linuxcnc.org/cgi-bin/wiki.pl?FixingSMIIssues
- http://blog.csdn.net/gw569453350game/article/details/46737141
- https://rt.wiki.kernel.org/index.php/HOWTO:_Build_an_RT-application
other ref link:
kernel build & preempt-rt patch & xenomai的更多相关文章
- ./utils/build.sh: line 131: patch: command not found
安装 percona-xtrabackup-2.1.5过程中遇到如下问题: [root@test percona-xtrabackup-2.1.5]# ./utils/build.sh innodb5 ...
- kernel build command
Uboot: make ARCH=arm CROSS_COMPILE=${CC} distclean make ARCH=arm CROSS_COMPILE=${CC} am335x_evm_defc ...
- Lock-less and zero copy messaging scheme for telecommunication network applications
A computer-implemented system and method for a lock-less, zero data copy messaging mechanism in a mu ...
- Lock-less buffer management scheme for telecommunication network applications
A buffer management mechanism in a multi-core processor for use on a modem in a telecommunications n ...
- xenomai内核解析之嵌入式实时linux概述
Linux系统作为一个GPOS(通用操作系统)发展至今已经非常成熟可靠了,并且由于遵循GPL协议,开放所有系统源代码,非常易于裁剪.更重要的是,与其他开源的GPOS或RTOS相比,Linux系统支持多 ...
- 嵌入式 uboot以及kernel添加看门狗临时记录(个人记录未整理乱)
Uboot_Kernerl_Add_Watch_Dog: U-Boot 2010.06 (Nov 01 2013 - 15:28:44) DRAM: 128 MiBCheck spi flash c ...
- Linux kernel Wikipedia
http://en.wikipedia.org/wiki/Linux_kernel Development model The current development model of the Lin ...
- xenomai内核解析之xenomai的组成结构
@ 目录 一.xenomai 3 二.xenomai3 结构 这是第二篇笔记. 一.xenomai 3 从xenomai3开始支持两种方式构建linux实时系统,分别是cobalt 和 mercury ...
- linux内核可以接受的参数 | Linux kernel启动参数 | 通过grub给内核传递参数
在Linux中,给kernel传递参数以控制其行为总共有三种方法: 1.build kernel之时的各个configuration选项. 2.当kernel启动之时,可以参数在kernel被GRUB ...
随机推荐
- [Redux-Observable && Unit testing] Testing the output of epics
Epics can be unit-tested just like any other function in your application - they have a very specifi ...
- 取消xp开机默认登陆账户
取消xp开机默认登陆账户 建了个新用户,把以前的用户删除后重新启动电脑,始终停留在 "正在启动" 界面,网上说是 Event Log:Eventlog(系统日志纪录服务) 没有自动 ...
- js30--代理模式
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...
- Android 给图片加边框
图片处理时,有时需要为图片加一些边框,下面介绍一种为图片添加简单边框的方法. 基本思路是:将边框图片裁剪成八张小图片(图片大小最好一致,不然后面处理会很麻烦),分别对应左上角,左边,左下角,下边,右下 ...
- node.js是什么
node.js是什么 一.总结 一句话总结:Node.js 就是运行在服务端的 JavaScript. 二.node.js是什么 简单的说 Node.js 就是运行在服务端的 JavaScript. ...
- Java Base64、HMAC、SHA1、MD5、AES DES 3DES加密算法
● BASE64 严格地说,属于编码格式,而非加密算法 ● MD5(Message Digest algorithm 5,信息摘要算法) ● SHA(Secure Hash Algo ...
- js面向对象3-继承
一.了解继承 首先我们一起了解下js中继承,其实继承就是后辈继承前辈的属性和方法. 二.继承的方法 从父类继承属性和方法 这是对象冒充的方法,模仿java的继承方法.实现的原理是,通过改变父类的执行 ...
- C++面试必备,概念解析
1.C和C++中struct有什么差别? 1> C++中的struct类似于class,有变量.有构造函数.虚函数等.有继承,多态等类的特征: 2> C中的struct仅仅有变量,不能有函 ...
- word2vec源代码解析之word2vec.c
word2vec源代码解析之word2vec.c 近期研究了一下google的开源项目word2vector,http://code.google.com/p/word2vec/. 事实上这玩意算是神 ...
- Java经典23种设计模式之行为型模式(二)
本文接着介绍行为型模式里的解释器模式.迭代器模式.中介者模式. 一.解释器模式Interpret 给定一个语言,定义它的文法的一种表示,并定义一个解释器,这个解释器使用该表示来解释语言的中的句子. 1 ...