综合了多个参考文献,终于在红帽子red hat linux9.03上成功安装rtlinux 3.2 rc1,写出
电脑配置:
Pentium 4 CPU 3.0GHz;1GB 内存,80G IDE硬盘
系统配置:
Linux版本Red Hat Linux 9.03,内核版本2.4.20-8
安装过程
1.解压安装文件:
在/urs/src下解压RTLinux(rtl3.2-rc1,在rtlinuxfree.com下载),在RTLinux下解压Linux(2.4.28,在linux.org下载);
2.内核打补丁:
cd /usr/src/RTLinux/Linux
patch -p1 <
usr/src/RTLinux/patches/kernel_patch-2.4.28-rtl3.2-rc1 //p1,p后面为数字1
3.配置Linux内核
cd /usr/src/RTLinux/Linux
cp /boot/config-2.4.20-8 .config //使用当前Linux系统的配置,将其保存到/usr/src/RTLinux/Linux文件夹下
make xconfig &
处理器选型
选择Processor type and features/Pentium-4
APM(高级电源管理)
关闭General setup/Advanced Power Managemnet BIOS support
DECnet网络选项
关闭Networking options/DECnet
Support //该选项不关闭则会在编译可加载模块时出错
文件类型改为ext3
选择File systems/Ext3 journalling file system support
选择File systems/JBD(ext3)debugging support
BUSlogic支持(用虚拟机VM安装必须选择,否则编译内核出错)
选择SCSI support/SCSI low-level drivers/BusLogic SCSI support
cp .config /boot/config-2.4.28-rtl3.2-rc1 //手动配置后将其作为新内核的配置
make dep //检验文件依赖关系
make bzImage //压缩内核镜像
make modules //编译可加载模块
make modules_install //安装可加载模块
cp arch/i386/boot/bzImage /boot/rtzImage //安装新内核
cd /boot
mkinitrd initrd-2.4.28-rtl3.2-rc1.img 2.4.28-rtl3.2-rc1
4.在grub中添加启动新内核的选项:
gedit /etc/grub.conf //用gedit编辑器打开启动文件
添加如下:
title rtlinux
root(hd0,0) //(hd0,0)表示第一块IDE硬盘的第一个分区,此处填写的是linux的/boot启动分区
kernel /rtzImage ro
root=/dev/hdd3 //rtzImage为安装的新内核名称,“root=”后面填写的是linux的根分区/,可用fdisk
-l(l为字母)查看根分区信息,为hdd3
initrd /initrd-2.4.20-rtl3.2-pre3.img
5.RTLinux的bug修正(注意此处若不修正bug,在之后的rtlinux内核配置编译则会产生关于“xargs不能大于20k”的error而使得编译无法继续)
重启电脑,在启动界面下选择RTLinux进入
在rpmseek.com下载findutils-4.1.7-9.src.rpm,放于/usr/src下安装
rpm -ivh
findutils-4.1.7-9.src.rpm //在rpm文件包所在文件夹下会生成redhat文件夹,其中有一些资源文件
cp /usr/src/redhat/SOURCES/findutils-4.1.20.tar.bz2
/usr/local
cd /usr/local
tar xjvf findutils-4.1.7.tar.bz2
cd findutils-4.1.7
./configure
注释掉xargs.c中的如下两行
make
make install
cp /usr/bin/xargs /usr/bin/xargsold
cp /usr/local/bin/xargs /usr/bin
6.RTLinux配置和编译:
cd /usr/src/RTLinux
make xconfig
添加时钟选项
选择POSIX Support options/POSIX Signals
选择POSIX Support options/POSIX Timers
编译RTLinux之前需要修改浮点路径
去掉/usr/src/rtlinux/examples/fp/Makefile和
usr/src/rtlinux/examples/v1api/fp/Makefile中的第一个-lm
make dep
make
make install
7.测试Rtlinux和模块:
make regression
成功则显示为:Testing multiple loads of
rtl.o… [OK] Testing ……
……
否则回到第3步重新配置内核
8.RTLinux简单操作
启动rtlinux:rtlinux start
查看rtlinux:rtlinux status
关闭rtlinux:rtlinux stop
注:如果编译器gcc版本是2.96,那么在多处理器电脑上安装RTLinux则需要修改/usr/src/RTLinux/Linux/Makefile中的代码
CC = $(CROSS_COMPILE)gcc
改变编译器为kgcc(gcc 2.91),改变后的代码为:
CC = kgcc
实际上,使用gcc2.91,2.95和3.x都没有问题。