准备工作 :
32位ubuntu16.04
内核版本 3.14.44 (需要的话后面附上)
Xenomai版本 xenomai-2.6.5(需要的话后面附上)
gcc修改一下,改成4.8.5,(把/usr/bin 下的链接文件gcc改掉,指向4.x版本的gcc就行)
安装必要的工具
sudo apt-get install devscripts devscripts debhelper dh-kpatches findutils autotools-dev autoconf automake libtool
sudo apt-get install kernel-package libncurses-dev fakeroot zlib1g-dev
(1) 配置并安装Xenomai实时补丁
tar -vxf xenomai-2.6.5.tar.bz2
cd xenomai-2.6.5
./configure --enable-x86-sep
make
make install
(2)修改内核并打补丁(注意linux-3.14.44 和xenomai-2.6.5在同一个目录下)
tar -vxf linux-3.14.44.tar
cd linux-3.14.44/
../xenomai-2.6.5/scripts/prepare-kernel.sh --arch=amd64 --linux=. --adeos=../xenomai-2.6.5/ksrc/arch/x86/patches/ipipe-core-3.14.44-x86-12.patch
cp /boot/config-$(uname -r) ./
sudo vim config-$(uname -r) 后将 CONFIG_CC_STACKPROTECTOR=y CONFIG_CC_STACKPROTECTOR_REGULAR=y注释掉
make menuconfig
* General setup
--> Local version - append to kernel release: -xenomai-2.6.5
--> Timers subsystem
--> High Resolution Timer Support (Verify you have HRT ON)
--> Stack Protector buffer overflow detection(None)
* 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\" 返回值 6, 选择 Generic otherwise)
--> SMT (Hyperthreading) scheduler support (Disable)
--> Preemption Model
--> Voluntary Kernel Preemption (Desktop)
* Device Driver
-->GPIO Support
--> Intel EG20T PCH/LAPIS Semiconductor***(Disable)
-->USB Support
--> USB Gadget Support (Disable)
-->stagging drivers
--> Data Aquisation Support(comedi) (Disable)
编译
CONCURRENCY_LEVEL=$(nproc) make-kpkg --rootcmd fakeroot --initrd kernel_image kernel_headers
cd ..
sudo dpkg -i linux-*.deb
3(配置GRUB)
sudo vim /etc/default/grub 后 更改grub配置如下:
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.i915_enable_rc6=0 i915.powersave=0 noapic xeno_nucleus.xenomai_gid=1234 xenomai.allowed_group=1234"
sudo update-grub
sudo reboot
重启后选择新的内核,启动后使用 uname -a 命令查看当前系统的内核.