HOW-TO compile the Linux kernel

There are common three reasons for a recompile a kernel.

1. You have some new hardware that your current kernel of linux distributuion could not detect it.
(You want to add kernel module of the new hardware)
2. You may have come across some kind of bug which is fixed in a revision of the operating system.
3. You may have some new software which requires a newer version of the operating system.

*****************
1. We can download the new kernel source and new patches from the Linux kernel archive web site. Web : http://www.kernel.org

2. Check the current kernel packages:

# rpm -qa | grep kernel*
Or
# uname -a

3. Preparing for Kernel update
Before build new kernel, you need to install Qt, Qt-devel and Qt-config which are used "make xconfig". If you do not need to use xconfig, do not to do this step.
# rpm -ivh qt*.rpm
or
(If you use Redhat distribution, you can use up2date command.)
# up2date qt
# up2date qt-config
# up2date qt-devel

To check installed QT packages
# rpm -qa | grep qt
qt-devel-xxxx
qt-config-xxxx
qt-xxxx

****************
Compile the Linux kernel (from RPM package)

4. Obtain the kernel source "kernel-.src.rpm" file from one of the following sources:
- The SRPMS directory on the appropriate SRPMS CD iso image.
- The FTP site where you got the kernel package.
- By running the command "up2date" (if you use redhat linux)

# up2date --get-source kernel

5. Install kernel source (kernel-.src.rpm) using the command "rpm".
# rpm -Uvh kernel-.src.rpm

This writes the RPM contents into "/usr/src/redhat/SOURCES" and "/usr/src/redhat/SPECS".

6. Prepare the kernel sources using the command "rpmbuild".
# cd /usr/src/redhat/SPECS
# rpmbuild -bp --target $(arch) kernel-2.6.spec
Here :
--target $(arch) - current system architecture (exm: i386, etc.)

The kernel source tree will be located in the "/usr/src/redhat/BUILD/kernel-" directory.
To move the resulting "linux-" directory to the "/usr/src" tree.
# cd /usr/src/redhat/BUILD/
# mv linux- /usr/src/
# cd /usr/src
# ln -s ./linux- linux
# cd /usr/src/linux

7. The configurations for the specific kernels find from the "configs/" directory.
For example, the i386 SMP configuration file is named "configs/kernel--i386-smp.config".
Issue the following command to place the desired configuration file in the proper place for building:

# cp configs/xxxxx .config
We can also find the ".config" file that matches current kernel configuration in the "/lib/modules//build/.config" file.

8. Every kernel gets a name based on its version number which displayed the output of command "uname ?r".
The kernel name is defined by the first four lines of the kernel Makefile.
You have to edit the kernel Makefile.
Example, If command "uname -r" returns the string "2.6.9-5", we changed the EXTRAVERSION definition from this:
EXTRAVERSION = -pre
to this:
EXTRAVERSION = -5_NEW

9. Change old kernel configuration (.config) to new configuration.
# make oldconfig
"oldconfig" which is read the defaults from an existing .config and rewrite necessary links and files.
Note that oldconfig will only work within the same major version of the kernel.
# make xconfig

"xconfig" is an X Window based frontend. It requires the Tcl/Tk, QT development tools and X libraries to work.

10. To configure and build the kernel
# make all

11. Build modules
# make modules_install
# make install

Note: The command "make install", it will create following files in the "/boot" folder and configure the boot loader configuration file.
"vmlinuz-",
"initrd-.img",
"System.map-"

****************
Compile the Linux kernel (from TAR package)

4. Obtain the kernel source "kernel-.tar.gz" file from Linux Kernel archives or other Kernel mirror site.
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.13-5.tar.gz

5. Unpack the kernel source file (kernel-xxx.tar.gz or kernel-xxx.tar.bz2) using the command "tar".
# tar -xvfz kernel-xxx.tar.gz
# tar -xvfj kernel-xxx.tar.bz2

6. To move the result "linux-" directory to the "/usr/src" tree.
# mv linux- /usr/src
# cd /usr/src/
# ln -s ./linux- linux
# cd /usr/src/linux

7. The configurations for the specific kernels find from the "configs/" directory.
For example, the i386 SMP configuration file is named "configs/kernel--i386-smp.config".
Issue the following command to place the desired configuration file in the proper place for building:

# cp configs/xxx .config
We can also find the ".config" file that matches current kernel configuration in the "/lib/modules//build/.config" file.

8. Every kernel gets a name based on its version number which displayed the output of command "uname ?r".
The kernel name is defined by the first four lines of the kernel Makefile.
You have to edit the kernel Makefile.
Example, If command "uname -r" returns the string "2.6.9-5", we changed the EXTRAVERSION definition from this:
EXTRAVERSION = -pre
to this:
EXTRAVERSION = -5_NEW

9. Change old kernel configuration (.config) to new configuration.
# make oldconfig

"oldconfig" which is read the defaults from an existing .config and rewrite necessary links and files.
Note that oldconfig will only work within the same major version of the kernel.
# make xconfig

"xconfig" is an X Window based frontend. It requires the Tcl/Tk, QT development tools and X libraries to work.

10. To configure and build the kernel
# make all

11. Build modules
# make modules_install
# make install

Note: The command "make install", it will create following files in the "/boot" folder and configure the boot loader configuration file.
"vmlinuz-",
"initrd-.img",
"System.map-"

Enjoy youtube video : "How to compile linux kernel"


Note: Using this manual, I compiled following Linux distribution/Kernel :
- Redhat 9 , kernel 2.4.20 -> 2.4.20
- RHEL 4 , kernel 2.6.9-5 -> 2.6.(10,11,12,13,14,15,16,17)
- SUSE Linux 10.0 , kernel 2.6.13 - 2.6.13
- Fedora 4/5/6 , kernel 2.6.X -> 2.6.X

XINE free video player
(GNU and for Linux, FreeBSD, Solaris, Windows, ... )

Линукс үйлдлийн систем дээр нээх асуудал үүсгээд байхгүйгээр суугаад, ажлаад байдаг, бас тэгээд ихэнх видео форматуудыг дэмждэг гайгүй сайн видео тоглуулагчийн нэг бол XINE юм.

Web : http://xinehq.de/

1. XINE болон сангуудыг суулгах

# cd xine-lib 1.1.4
# ./configure
# make
# make install

( skinned xlib-based gui )
# cd xine-ui 0/99.4
# ./configure
# make
# make install

2. Mozilla Firefox веб хөтлөгчийн XINE plugin "xine-plugin" суулгах:
# cd xine-plugin 1.0
# ./configure
# make
# make install
# cp ~/.mozilla/plugins/xineplugin.* /usr/lib/mozilla/plugins/
(Note: "/usr/lib/" - зөвхөн миний тохиолдолд)

3. Програмыг эхлүүлэх
# xine
# xine 'http://URL/sumo.wmv'
# xine 'file://file-path/sumo.wmv'
# xine 'DVD://VTS_01_1.VOB'

XINE media player

(Note: Энэхүү суулгах аргыг хэрэглэсэн систем:
RHEL4 and SUSE 10.0 linux.)

HOW-TO Install Madwifi, Linux device driver for wireless LAN chipsets from Atheros

Madwifi is project provides a Linux kernel device driver for Atheros chipset based Wireless LAN device. We have Madwifi-old, Madwifi-ng and official release Madwifi-0.9.x drivers.
Web :
http://www.madwifi.org/
http://www.madwifi.net/

-----------------------------------------
My system :
- RHEL 4 with kernel 2.6.9-5 and 2.6.13-5
- SUSE Linux 10.0 with kernel 2.6.13
Wireless driver : Madwifi-ng , Madwifi-old , Madwifi-0.9.2
Wireless device : ATERM WL54AG
-----------------------------------------

Зайлшгүй шаардагдах нөхцөл:
- GCC compiler collection
- Ашиглаж буй системийн цөм (kernel)-ийн эх код ("source -> /usr/src/linux-XXXXX" байдлаар холбоос үүссэн байх.)
- Ашиглаж буй системийн цөмд "Wireless Extensions" дэмжигдсэн байх.

1. Download the Madwifi wireless driverCheckout current Madwifi driver (madwifi-ng) from madwifi.org with subversion
# cd /usr/local/src
# svn list http://svn.madwifi.org/trunk
# svn checkout http://svn.madwifi.org/trunk madwifi-0.9.2
or
# svn checkout http://svn.madwifi.org/branches/madwifi-old

2. Compile Madwifi driver
# cd madwifi-ng
# make
# make install

3. After compile, Madwifi drivers are loaded at: /lib/modules/`uname -r`/net
# ls -ls /lib/modules/`uname -r`/net
ath_hal.ko
ath_pci.ko
ath_rate_sample.ko
wlan_acl.ko
wlan_ccmp.ko
wlan.ko
wlan_scan_ap.ko
wlan_scan_sta.ko
wlan_tkip.ko
wlan_wep.ko
wlan_xauth.ko

4. Installing Madwifi modules
We need to use the countrycode option (exm: Japan = 392) when loading the madwifi driver.
# modprobe ath_pci countrycode=392
# lsmod
. . . . . . . . .
ath_pci 110628 0
ath_rate_sample 13056 1 ath_pci
wlan 199004 6 wlan_scan_sta,ath_pci,ath_rate_sample
ath_hal 189008 5 ath_pci,ath_rate_sample
. . . . . . . . .

5. To make this happen during boot, add the following to modprobe config file “/etc/modprobe.conf”.
options ath_pci countrycode=392 (Japan:392)

6. Configuring device (athX) interface
- Wireless network interface name : "ath0"
- Operation mode = master/station/adhoc
- Channel = between 1 and 14
- ESSID = "TEST"

- Destroy madwifi device which detected automaticly
# wlanconfig ath0 destroy

- Create new madwifi-ng driver
# wlanconfig ath0 create wlandev wifi0 wlanmode ap

- ESSID , channel, ... setup
# iwconfig ath0 essid CAP11 channel 3

- Network IP, Netmask, ... setup
# ifconfig ath0 192.168.61.1 broadcast 192.168.61.255 netmask 255.255.255.0 up

7. Display wireless network Interface configuration

Display network interface configuration
# ifconfig ath0

Display wireless network interface configuration
# iwconfig ath0

8. Some usefull commands to display wireless information
# cardctl ident
Socket 0:product info: "NEC AccessTechnica, Ltd.", "AtermWL54AG(PA-WL/54AG)", "1.0", " "manfid: 0x0010, 0x0012function: 6 (network)

# lspci
...........
05:02.0 CardBus bridge: Ricoh Co Ltd RL5c475 (rev 80)06:00.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)

HOW-TO Install Host AP driver for Intersil Prism2/2.5/3

Host AP is a Linux driver for Intersil Prism 2/2.5/3 chipset based wireless network card. More information and current version of Host AP driver and hostap-utils can be acquiring following site: http://hostap.epitest.fi/

------------------------------------
My system :
- RHEL 4 with kernel 2.6.9-5 and 2.6.13-5
- SUSE Linux 10.0 with kernel 2.6.13
Wireless driver : Hostap-driver-0.4.7.tar.gz
Hostap-Util : Hostap-utils-0.4.7.tar.gz
Wireless card : PLANEX GW-CF11X
------------------------------------

1. Building Host AP driver.

# tar -zxvf hostap-driver-0.4.7.tar.gz
# cd hostap-driver-0.4.7

We have to change Makefile before compile Host AP driver. Edit the kernel path “KERNEL_PATH” in Makefile to math current system. Our case, we compiled kernel from the path “/usr/src/linux (KERNEL_PATH=/usr/src/linux).
# make
# make install

2. Add hostap modules to kernel.
# modprobe hostap_pci
or
# modprobe hostap
# modprobe hostap_cs

3. Check the kernel modules list.
# lsmod grep hostap
hostap_pci 67609 0
hostap 121096 1 hostap_pci
or
# lsmod grep hostap
hostap_cs 75288 3
hostap 141192 1 hostap_cs
pcmcia 42548 9 hostap_cs

4. After load the Host AP modules, we need to add wireless network PCMCIA card model information into config file (/etc/pcmcia/hostap_cs.conf). Identify the current plugged wireless card.
# cardctl ident
Socket 0: product info: "PLANEX COMMUNICATIONS INC.", "PLANEX GW-CF11X Wireless CF Card", "", ""
manfid: 0xd601, 0x0010
function: 6 (network)

5. Add following string into config file "/etc/pcmcia/hostap_cs.conf".
card "PLANEX GW-CF11X Wireless CF Card"
manfid 0xd601, 0x0010
bind "hostap_cs"

6. Installing Hostap-utils
Unpack the package and run the “make all” to build Hostap-utils.
# tar -zxvf hostap-utils-0.4.7.tar.gz
# cd hostap-utils-0.4.7
# make all

Copy following files to "/usr/bin" folder after built Hostap-utils.
- hostap_crypt_conf
- hostap_diag
- hostap_fw_load
- hostap_io_debug
- hostap_rid
- prism2_param

7. Check the wireless card
# iwconfig wlan0

Wifi0 IEEE 802.11b ESSID:""
Mode: Managed . . . . . .

wlan0 IEEE 802.11b ESSID:""
Mode: Managed . . . . .

8. THE END

HOW-TO install Orinoco wireless driver

The Linux Orinoco Driver supports a wide range of wireless network interface cards implementing 802.11b standard.

---------------------------------------------
My system :
- Redhat 9 Linux with kernel 2.4.20
- Wireless card :“BUFFALO WLI-CF-S11G”.

---------------------------------------------

1. Download and compile "orinoco" wireless PCMCIA card driver.
Download site : http://sourceforge.net/projects/orinoco

# tar xvfz orinoco-0.15rc2.tar.gz
# cd orinoco-0.15rc2
# make all
# make install

# /etc/init.d/pcmcia restart

2. Check the card type.
# cardctl ident
Socket 0: product info: "BUFFALO", "WLI-CF-S11G", "", ""
manfid: 0x026f, 0x030b
function: 6 (network)

3. Add following string inside the config file "/etc/pcmcia/config".
card "Buffalo WLI-CF-S11G"
manfid 0x026f, 0x030b
bind "orinoco_cs"

4. Restart PCMCIA
# /etc/init.d/pcmcia restart

5. Check the list of installed modules, command : "lsmod" You can see module column "orinoco*"
# lsmod
....
orinoco_cs .........

6. THE END