forked from ShabbyX/RTAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.INSTALL
213 lines (148 loc) · 8.25 KB
/
README.INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
Basic introduction to RTAI
================================
RTAI uses the world's fastest Real-time + Linux combination, featuring
real-time interrupts that are dispatched immediately.
An exclusive feature to the x86 32-bit architecture is that it has the
potential of completely avoiding the dispatching of critical
internal timers and interprocessor scheduling interrupts by vectoring them
directly to their handlers. This option heavily increases
real-time performances on a variety of machines and comes by default,
however it can easily be disabled using the ncurses menuconfig interface.
In order to use the above features, you must be already running an
RTAI (Real-time Application Interface) patched Linux kernel with
IPIPE (Interrupt Pileline) enabled.
Please note that only x86-based (32-bit and x86_64) architectures
have been tested with this branch. x86_64 support is still a work in progress
with the 3.x kernel series, but is a high priority.
This README.INSTALL file was written for x86-based architectures only.
If you are using ARM or any other architecture, YMMV (Your mileage may vary.)
How to build RTAI (Written by Alec Ari / NTULINUX)
================================
To build, compile, and install RTAI, follow the steps below carefully.
Please note: If you are not using the 3.4.55 kernel, replace ALL references to that version,
to the version of the kernel source you downloaded.
If you are a highly experienced Linux poweruser, you can ignore 99% of this, but do not
file a bug report if you have not built the kernel and RTAI userspace in correlation to this
very README.INSTALL file.
Tip:
$ signs are commands that are meant to be run as your regular user,
i.e. without elevated root privileges.
# signs are meant to be run as root or with root privileges,
using sudo, or su -c 'command here>
1.) Download the RTAI source code using git:
$ cd ~/ && mkdir -p devel && cd devel
$ git clone https://github.com/ShabbyX/RTAI.git
2.) Download, patch, and install your RTAI-enabled kernel.
Please note: For quite awhile, all the commands are run as root until you reach near the bottom
so feel free to just run "su - root" (without quotes) now.
In this example, we use the 3.4.55 kernel:
# cd /usr/src
# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.4.55.tar.xz
# tar xf linux-3.4.55.tar.xz
# ln -sfv linux-3.4.55 linux
# cd linux
# make mrproper
Please note: Replace <your user> with your actual NON-ROOT user account name. If unsure,
running the following command may help, especially if you are on a single user machine:
$ ls /home
# cp -prvL /home/<your user>/devel/RTAI/base/arch/x86/patches/hal-linux-3.4.55-x86-1.patch /usr/src/
# patch -p1 < ../hal-linux-3.4.55-x86-1.patch
Please note: Is it necessary to know your CPU architecture before proceeding.
Run the following command to determine if you are on a 64-bit or 32-bit Linux distribution:
$ uname -m
Copy the kernel config corresponding to your architecture (32-bit or 64-bit)
to the root of your kernel source directory:
Please note: Replace <your user> with your NON-ROOT user account name.
(2) Replace <insert_arch> with either "32" or "64" (without quotes)
# cp -prvL /home/<your user>/devel/RTAI/base/arch/x86/configs/rtai_<insert_arch>_defconfig /usr/src/linux/
# make menuconfig
Load the RTAI-optimized kernel config by selecting
"Load an Alternate Configuration File" and type in either
"rtai_32_defconfig" or "rtai_64_defconfig" (without quotes)
depending on which config file you copied over that corresponded to your architecture.
3.) Configure the kernel for RTAI.
Configuring the kernel here is mandatory, but should not take long at all, especially
if you are familar with configuring custom kernels. If not, do not worry. The kernel
you have previously copied is a great baseline for RTAI, but a few options need to be
manually configured in order for it to boot.
*IMPORTANT: IT IS GUARANTEED THAT THE RTAI KERNEL CONFIG AS-IS WILL NOT WORK ON ANY SYSTEM!*
*IMPORTANT: DO NOT MODIFY ANY OTHER SETTINGS MENTIONED HERE
UNLESS YOU ARE SURE YOU KNOW EXACTLY WHAT YOU ARE DOING!*
*IMPORTANT: DO NOT COMPILE ANY NEW OPTIONS AS MODULES (M) AS IT CAN
BE VERY DANGEROUS, ESPECIALLY WHEN DEALING WITH SCSI CONTROLLER SUPPORT!
IT IS HIGHLY RECOMMENDED, SUGGESTED, AND ENCOURAGED TO COMPILE ALL NEW OPTIONS
INTO (Y) THE KERNEL! A "*" SIGN IS GOOD, AN "M" SIGN IS BAD!*
To determining your basic hardware, open up a new tab in the terminal or a new
terminal window and run the following command. Note that some systems require
root access to execute "lspci" so to be safe, we suggest it here:
# lspci -k | grep "driver in use"
Enabling netork support for your ethernet controller:
Device drivers ->
Network device support ->
Ethernet driver support
For example, for the Realtek 8169 controller (r8169) commonly found on many modern
AMD motherboards such as the 785/880/970-990, scroll down to "Realtek devices" using the
arrow keys on your keyboard, and enabling "Realtek 8169 gigabit ethernet support" by
pressing "Y" on the highlighted option to compile the driver into the kernel.
Enabling I2C device support for your hardware:
Device drivers ->
I2C support ->
I2C Hardware Bus support
Enabling SATA / PATA / SCSI / Hard drive support for your hardware:
Please note: If your hard drive controller module is not in the
"Serial ATA and Parallel ATA drivers" section at all, look in
"ATA/ATAPI/MFM/RLL support (DEPRECATED)"
Device drivers ->
Serial ATA and Parallel ATA drivers
Please note: If you specifically use AHCI for your Solid State Drive (SSD)
or Hard Disk Drive (HDD) then you do not need to enable ATA SFF support.
ATA SFF support simply shows more possible drivers. It is recommended to
turn on support for any and ALL drive controllers mentioned in the lspci -k command.
After you are done, press tab or use the right arrow key and toggle back to the
main kernel configuration screen. At the bottom you should see an option that says
"Save an Alternate Configuration File." Highlight the option and press enter,
and make sure the contents in the field box says ".config" (without quotes.)
Press enter again, and proceed with compiling the kernel.
4.) Compiling and installing the kernel:
Tip: The following "make" command automatically detects the number of CPU cores
and compiles the kernel with however many jobs that number might be. This speeds up
compiling times on SMP systems.
# make -j$(cat /proc/cpuinfo | grep processor | wc -l)
# make modules_install
# cp -prvL arch/x86/boot/bzImage /boot/vmlinuz-3.4.55-RTAI
# cp -prvL System.map /boot/System.map-3.4.55-RTAI
# cp -prvL .config /boot/config-3.4.55-RTAI
5.) Update your boot loader. If you are an experienced GRUB user, it is recommended to
modify the grub.cfg or menu.lst file by hand, to remove unncessary bloat from the file,
as grub2-mkconfig -o /boot/grub2/grub.cfg (or whatever you use to automatically generate it)
can cause serious pollution and in rare cases, impact RTAI performance.
Depending on your Linux distribution, one of these commands would do it for you:
# grub2-mkconfig -o /boot/grub2/grub.cfg
# grub2-mkconfig -o /boot/grub/grub.cfg
# update-grub
If you're a minimalist like me, run something like this as root:
--------------------cut here--------------------
cat > /boot/grub2/grub.cfg << EOF
set default=0
set timeout=3
menuentry "Linux 3.4.55 RTAI" {
set root=(hd0,1)
linux /boot/vmlinuz-3.4.55-RTAI root=/dev/sda1 ro consoleblank=0
}
EOF
--------------------cut here--------------------
6.) Reboot into your new kernel and be sure you select it at boot time!
7.) Compile RTAI userland / userspace:
$ cd ~/devel/RTAI
$ ./autogen.sh
$ make menuconfig
*IMPORTANT: IF YOU ARE USING A MULTI-CORE SMP SYSTEM, IT IS REQUIRED
TO ENTER IN THE EXACT NUMBER OF CPU CORES YOUR SYSTEM HAS! To do this,
go to "Machine (x86 / x86_64)" and select "Number of CPUs (SMP-only)"
then enter the number of CPU cores you have into the field box.*
$ make
8.) Install RTAI (default is /usr/realtime)
# make install
RTAI is now fully installed! If you have any questions, comments, complaints, or issues,
feel free to contact the author of this file directly at <[email protected]>
or leave a comment somewhere on the github repository and I will assist you the best I can.