- カーネル用DIRを作成
cd /usr/src
mkdir linux2.6.20+RTAI3.5/
cd linux2.6.20+RTAI3.5/
- RTAIソースをダウンロード
mkdir download
cd download
wget https://www.rtai.org/RTAI/rtai-3.5-cv.tar.bz2
#https://www.rtai.org/より、最新のRTAI (rtai-3.5-cv)をダウンロード
- RTAIソースを解凍
cd /usr/src/linux2.6.20+RTAI3.5
tar jxfv download/rtai-3.5-cv.tar.bz2
ls rtai-3.5-cv/base/arch/i386/patches/
README hal-linux-2.6.16-i386-1.3-08.patch
hal-linux-2.4.32-i386-1.2-07.patch hal-linux-2.6.17-i386-1.5-02.patch
hal-linux-2.4.33-i386-1.3-03.patch hal-linux-2.6.19-i386-1.7-01.patch
hal-linux-2.4.34-i386-1.3-03.patch hal-linux-2.6.20-i386-1.7-01.patch
hal-linux-2.6.15-i386-1.3-07.patch hal-linux-2.6.20-i386-1.8-04.patch
より、linux-2.6.20カーネルにパッチをあてることにしましょう。
- 本家カーネルソースをダウンロード
cd /usr/src/linux2.6.20+RTAI3.5/linux-2.6.20rtai
patch -p1 -b < /usr/src/linux2.6.20+RTAI3.5/rtai-3.5-cv/base/arch/i386/patches/hal-linux-2.6.20-i386-1.8-04.patch
※今回はbigphysareaパッチをあてない
- カーネルのconfigファイルをつくる
cd /usr/src/linux2.6.20+RTAI3.5/linux-2.6.20rtai
#vineの.configファイルを利用する
cp /boot/config-2.6.16-0vl68 ./.config
#.configファイルを編集する
make menuconfig
rtai-3.4のREADME.INSTALLより
/*-----------------------------------------------------------------------------------*/
<> “Use register arguments” under “Processor type and features” must be disabled
<> “Interrupt pipeline” under “Processor type and features” must be enabled (but, unless
you want to control/debug the patch behaviour) is better to disable statitics gathering as
it adds some overhead)
<> “Module versioning support” under “Loadable module support” must be disabled
Note: Attention must be taken for the APIC (Advanced Programmable Interrupt Controller)
configuration; the option is located under “Processor type and features”. In the previous
versions the APIC had to be disabled on UP machine, and could only by used on MP ones. With
the latest RTAI release the APIC can be enabled and used with success even on UP machines
and with this option enabled the system will benefit of faster timer reprogramming in oneshot
mode and lesser overhead. Anyhow if the APIC is configured/enabled in the kernel but it's not
present on your hardware RTAI will complain and give you the following error:
RTAI[hal]:ERROR, LOCAL APIC CONFIGURED BUT NOT AVAILABLE/ENABLED
/*-----------------------------------------------------------------------------------*/
よって、
"Processor type and features" -> "Use register arguments" [disabled] このoptionがみあたらない、、設定せず
"Processor type and features" -> "Interrupt pipeline" [enabled]
!!! "Processor type and features" -> " Local APIC support on uniprocessors" [disabled] このoptionがみあたらない、、設定せず
"Loadable module support" -> "Module versioning support" [disabled]
また、http://debian.fam.cx/index.php?Software0.000000LinuxKernel#content_1_5
/*-----------------------------------------------------------------------------------*/
2.1.2 システム起動に必要な設定について
システムの起動時に必要なものは モジュール (M) ではなく Y にした方がいいです。
例えば HDD のアクセス関係
* CONFIG_IDE (IDE 接続の HDD)
* CONFIG_SCSI (SCSI 接続の HDD)
ルートファイルシステムに使われているファイルシステム関係
* CONFIG_EXT3_FS (ext3 ファイルシステム)
* CONFIG_REISERFS_FS (reiserfs ファイルシステム)
など。これらを M にした場合、initrd-tools (initramfs-tools, yaird) 等を利用しないと
起動できなくなります。公式のカーネルパッケージの /boot/config-* は、これらが M になって
いるので、そのまま流用するとハマります。最も初歩的な kernel panic で起動できなくなる
原因の一つなので注意。
/*-----------------------------------------------------------------------------------*/
らしいので、
Device Drivers ---> ATA/ATAPI/MFM/RLL support --->
<*> ATA/ATAPI/MFM/RLL support
< > PCMCIA IDE support
Device Drivers ---> SCSI device support --->
<*> SCSI device support
<*> SCSI disk support
File systems --->
<*> Ext3 journalling file system support
[*] Ext3 extended attributes
[*] Ext3 POSIX Access Control Lists
[*] Ext3 Security Labels
[ ] JBD (ext3) debugging support
<*> Reiserfs support
[ ] Enable reiserfs debug mode
[*] Stats in /proc/fs/reiserfs
[*] ReiserFS extended attributes
[*] ReiserFS POSIX Access Control Lists
[*] ReiserFS Security Labels
Device Drivers ---> Serial ATA (prod) and Parallel ATA (experimental) drivers --->
ATA device support
Intel PIIX/ICH SATA support
Moduleにすること。そうしないと起動時におこられる
サウンドドライバはうっとおしいのではずす
Device Drivers ---> Sound --->
< > Sound card support
Processor type and features ---> Processor family (Pentium-4/Celeron(P4-based)/Pentium-4 M/old
< > Toshiba Laptop support
< > Dell laptop support
- カーネルをmake/install
cd /usr/src/linux2.6.20+RTAI3.5/linux-2.6.20rtai
make
#ひたすら待つ、、
#/*-----------------------------------------------------------------------------------*/
#http://itpro.nikkeibp.co.jp/members/SI/oss/20031024/3/
#カーネルをコンパイルする際も,従来必要だったmake depのステップが
#必要なくなり,makeコマンドを実行するだけでbzImageやモジュール・
#ドライバがコンパイルされるようになった。なお,引数を与えずにmakeを
#実行した場合は最低限のメッセージしか表示されない静粛(quiet)モード
#になる。従来のように実際に実行しているコマンドを表示させたい場合は
#make V=1
#のように,V=1オプションを与えて冗長(verbose)モードにする必要がある。
#/*-----------------------------------------------------------------------------------*/
#カーネルイメージを確認
ls -la vmlinux
#-rwxr-xr-x 1 root root 5038373 9月12日 15:51 vmlinux*
#カーネルのインストール
make install
最後で/etc/lilo/installに書き込むところでこける。
sh /usr/src/linux2.6.20+RTAI3.5/linux-2.6.20rtai/arch/i386/boot/install.sh 2.6.20 arch/i386/boot/bzImage System.map "/boot"
/usr/src/linux2.6.20+RTAI3.5/linux-2.6.20rtai/arch/i386/boot/install.sh: line 54: /etc/lilo/install: そのようなファイルやディレクトリはありません
make[1]: *** [install] エラー 127
make: *** [install] エラー 2
が、無視
確認。System.mapとvmlinuzが/bootにコピーされている。OK!
ls -la /boot/ | grep 9月12日
-rw-r--r-- 1 root root 905674 9月12日 16:10 System.map
-rw-r--r-- 1 root root 1835112 9月12日 16:10 vmlinuz
モジュールのインストール
make modules_install
- initrdファイルの作成
/sbin/mkinitrd initrd-2.6.20rtai-0v001.img 2.6.20
mv ./initrd-2.6.20rtai-0v001.img /boot/
- カーネルイメージなどの名前をわかりやすくかえる
rm -f /boot/vmlinuz.old
rm -f /boot/System.old
rm -f /boot/System.map.old
rm -f /boot/initrd.img
rm -f /boot/initrd.old.img
mv /boot/vmlinuz /boot/vmlinuz-2.6.20rtai-0v001
mv /boot/System.map /boot/System.map-2.6.20rtai-0v001
cp .config /boot/config-2.6.20rtai-0v001
- GRUBを設定+reboot
GRUBを編集
emacs -nw /boot/grub/menu.lst
default=0
timeout=5
title Kernel 2.6.20 + RTAI
root (hd0,0)
kernel /vmlinuz-2.6.20rtai-0v001 ro resume2=swap:/dev/hda3 vga=0x314 acpi=off
initrd /initrd-2.6.20rtai-0v001.img
title Kernel 2.6.16 (Vine Linux 4.1 Original)
root (hd0,0)
kernel /vmlinuz-2.6.16-0vl68 ro root=LABEL=/1 resume2=swap:/dev/hda3 vga=0x314
initrd /initrd-2.6.16-0vl68.img
再起動
reboot
- rtaiモジュールのmake+install
su
cd /usr/src/linux2.6.20+RTAI3.5/rtai-3.5-cv
ln -s /usr/src/linux2.6.20+RTAI3.5/linux-2.6.20rtai /usr/src/linux
#リンクを貼っておかないとmake menuconfigがとおらなかった
make menuconfig
#そのままの設定で、saveして出る
make
make install
rtaiがハングアップなので異常終了した場合、rebootすると
/dev/rtf*が消えてしまう場合がある。
これに対応するために、/etc/rc.d/rc.localの最尾に
以下のスクリプトを加える (README.INSTALLより)
emacs -nw /etc/rc.d/rc.local
#### for RTAI (added by Motohara 2007/09/13)
if test \! -c /dev/rtai_shm; then
mknod -m 666 /dev/rtai_shm c 10 254
fi
for n in `seq 0 9`; do
f=/dev/rtf$n
if test \! -c $f; then
mknod -m 666 $f c 150 $n
fi
done
#### for RTAI ends here
- パッチの用意
http://www.feise.com/~jfeise/Downloads/zr36120/より
kernel2.6.20用のbigphysareaパッチをdownload
cd /usr/src/linux2.6.20+RTAI3.5/linux-2.6.20rtai
wget http://www.feise.com/~jfeise/Downloads/zr36120/bigphysarea-2.6.20.diff
patch -p1 < bigphysarea-2.6.20.diff
Hunk #1 succeeded at 663 (offset 2 lines).
patching file include/linux/bigphysarea.h
patching file kernel/kallsyms.c
patching file mm/Makefile
patching file mm/bigphysarea.c
patching file Documentation/bigphysarea.txt
- カーネルをmake
make menuconfig
bigphysareaを有効に
Processor type and features --->
[*] Support for big physical area reservation
そのほかの設定もちょっといじっていらないものを捨てる。
Processor type and features --->
< > Toshiba Laptop support
< > Dell laptop support
Power management options (ACPI, APM) --->
[ ] Software Suspend
APM (Advanced Power Management) BIOS Support --->
< > APM (Advanced Power Management) BIOS support
Networking --->
< > IrDA (infrared) subsystem support --->
< > Bluetooth subsystem support --->
Device Drivers ---> ISDN subsystem --->
< > ISDN support
Multi-device support (RAID and LVM) --->
[ ] Multiple devices driver support (RAID and LVM)
Input device support --->
< > Joystick interface
[ ] Joysticks --->
[ ] Touchscreens --->
Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
[ ] ISA support
PCCARD (PCMCIA/CardBus) support --->
< > PCCard (PCMCIA/CardBus) support
make
- カーネルイメージを確認
ls -la vmlinux
-rwxr-xr-x 1 root root 4896587 9月13日 15:18 vmlinux*
- カーネルのインストール
make install
確認。System.mapとvmlinuzが/bootにコピーされている。OK!
ls -la /boot/ | grep 9月13日
-rw-r--r-- 1 root root 886918 9月13日 17:27 System.map
-rw-r--r-- 1 root root 1784520 9月13日 17:27 vmlinuz
- モジュールのインストール
make modules_install
- initrd の作成
/sbin/mkinitrd initrd-2.6.20rtai-0v002.img 2.6.20
mv ./initrd-2.6.20rtai-0v002.img /boot/
- カーネルイメージなどの名前をわかりやすくかえる
mv /boot/vmlinuz /boot/vmlinuz-2.6.20rtai-0v002
mv /boot/System.map /boot/System.map-2.6.20rtai-0v002
cp .config /boot/config-2.6.20rtai-0v002
- GRUBを設定+reboot
GRUBを編集
emacs -nw /boot/grub/menu.lst
default=0
timeout=5
title Kernel 2.6.20 + RTAI + bigphysarea
root (hd0,0)
kernel /vmlinuz-2.6.20rtai-0v002 ro root=LABEL=/ vga=0x314 acpi=off bigphysarea=36000
initrd /initrd-2.6.20rtai-0v002.img
title Kernel 2.6.20 + RTAI
root (hd0,0)
kernel /vmlinuz-2.6.20rtai-0v001 ro root=LABEL=/ vga=0x314 acpi=off
initrd /initrd-2.6.20rtai-0v001.img
title Kernel 2.6.16 (Vine Linux 4.1 Original)
root (hd0,0)
kernel /vmlinuz-2.6.16-0vl68 ro root=LABEL=/ resume2=swap:/dev/hda3 vga=0x314
initrd /initrd-2.6.16-0vl68.img
再起動
reboot
- 再起動を確認
bigphysareaがうまく設定されているかを確認
cat /proc/bigphysarea
Big physical area, size 144000 kB
free list: used list:
number of blocks: 1 0
size of largest block: 144000 kB 0 kB
total: 144000 kB 0 kB
OK!!!!