|
|
Linux Kernel Compilation HowTo
...in general and in regard to RTAI Real Time Linux
Steps to compile the fresh vanilla kernel:
| Kernel 2.4 | Kernel 2.6 |
# make [oldconfig|menuconfig|xconfig]
# make dep
# make bzImage
# make modules
# make modules_install
|
# make [oldconfig|menuconfig|xconfig]
# make
# make modules_install install
|
Modify your bootloader (GRUB) and you're ready to rumble!
If you compile your own kernel, you usually know the hardware where it will be deployed, so it is
a good idea to compile in all needed stuff for booting. General purpose kernels, which come with the major
distributions, usually have an initrd (initial ramdisk) used for booting. This initial ramdisk
contains all sort of kernel modules (drivers) for all sort of hardware needed for the boot process.
We know our hardware and requirements or can at least narrow down those to certain limits and thus
we can compile drivers directly into the kernel. These are for example IDE drivers, filesystem
support etc...
I compiled in ATA/IDE support into the kernel by selecting:
ATA/IDE/MFM/RLL support ---> [*] ATA/IDE/MFM/RLL support
IDE, ATA and ATAPI Block devices --->
<*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
<*> Include IDE/ATA-2 DISK support
Furthermore I compiled in the Intel PIIX IDE driver. Look at the "dmesg" or "boot.log" when booting
your machine with an existing kernel or live CD. I did so and found:
PIIX4: IDE controller at PCI slot 00:04.1
PIIX4: chipset revision 1
Filesystems: Most folks just use EXT2 or EXT3, but if you use REISERFS or XFS make sure you compile
those into the kernel too. Otherwise your system can't boot and will result in a:
cramfs: wrong magic
Kernel panic: VFS: Unable to mount root fs on 03:01
Make sure you have set the correct CPU type! When compiling a kernel with RTAI, make sure you set
it to >= 486. I had problems with 486, but >= i686 always worked.
If you use "make menuconfig" make sure you don't have SMP enabled if you are on a UP (uni-processor) machine.
When I reused the existing debian sarge .config, "make menuconfig" automatically set SMP and the number of CPU's to 32,
which resulted in a working kernel, but RTAI failed by freezing the system.
For RTAI:
* you should disable ACPI and APM: they are real-time killers.
* APIC for UP should be disabled unless you actually have one. In any
case, APIC is not used on UP machines by LXRT.
Check /proc/cpuinfo if you have "TSC":
# cat /proc/cpuinfo
processor : 0
[...]
model name : Pentium III (Katmai)
[...]
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse
[...]
If you don't have TSC, say yes "Y" to the option
Processor type and features ---> [ ] Unsynced TSC support
( CONFIG_X86_TSC_DISABLE )
If you have TSC, say NO "N" to this option. TSC is available on Pentium Classic (586tsc) or above.
As soon as you have compiled and installed RTAI, you can verify if RTAI
really uses the TSC: if RTAI detects the correct CPU frequency, it uses tsc,
when it detects a CPU frequency about 1MHz, it emulates TSC.
Look at:
# cat /proc/rtai/scheduler
Update 18-DEC-2004: If the kernel examples in testsuite/ work for you, but not the user space examples, especially with 2.6 kernels,
disable the REGPARM option in the kernel (Processor type and features -> 'Use register arguments').
If you get this error:
RTAI[hal]: ERROR, LOCAL APIC CONFIGURED BUT NOT AVAILABLE/ENABLED
pass "lapic" to the kernel in grub. e.g.:
title RTAI 3.2 kernel 2.6.10
root (hd0,0)
kernel /boot/vmlinuz-2.6.10-adeos root=/dev/hda1 ro lapic
savedefault
boot
Last-Modified: Sat, 04 Feb 2006 16:13:12 GMT
|
|