Welcome to the tutorial guide. The guide will provide a user with information on determining the hardware.
Please note that after you have determined that your hardware and software meet the minimum requirements for the kernel build, we will need to collect more detailed information about the system. This is needed during the configuration process when we decide which hardware will be supported under our new kernel. The information that we will gather include: Processor, Drive type and Controller (SCSI, IDE), Ethernet devices, Graphics and Sound Cards, USB HUB.
Let’s start by running the /sbin/lspci utility to print information about our hardware by running following command:
$ /sbin/lspci
00:00.0 Host bridge: Silicon Integrated Systems [SiS] 735 Host (rev 01)
00:01.0 PCI bridge: Silicon Integrated Systems [SiS] 5591/5592 AGP
00:02.0 ISA bridge: Silicon Integrated Systems [SiS] 85C503/5513
00:02.2 USB Controller: Silicon Integrated Systems [SiS] 7001 (rev 07)
00:02.3 USB Controller: Silicon Integrated Systems [SiS] 7001 (rev 07)
00:02.5 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev d0)
00:02.7 Multimedia audio controller: SiS7012 PCI Audio Accelerator (rev a0)
00:03.0 Ethernet controller: [SiS] SiS900 10/100 Ethernet (rev 90)
01:00.0 VGA compatible controller: ATI Technologies Inc Rage 128 RF/SG AGP
If we don’t know about our processor then it is a good idea to determine the processor type As some Linux systems contain a /proc filesystem that allows a user to view raw information about the system. If /proc exists please run following command to get the processors’ information:
$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 6
model : 6
model name : AMD Athlon(tm) XP 1800+
stepping : 2
cpu MHz : 1526.870
cache size : 256 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 sep mtrr pge
bogomips : 3047.42
If you are interested in acquiring the Linux kernel sources, then please note following. If you are using a packaged distribution then most likely the distributor will bundle a kernel source package. These are installable via the package installation method, whether RPM, apt, YAST, portage, etc..
The other option is to use the pristine sources, either the official sources one of the regularly maintained trees. Please note that these sources are full of new features and untested code.
Untested code
This is a feature of the distributed development model of Linux and Open Source (??) in general. The traditional model of a software release is somewhat antithetical to this model, as new code must be released to allow all developers to test and improve the code. However, because Linux is used in production environments throughout world it is necessary to separate the unstable development tree from the tested, stable tree. This is done through the version number of the kernel. There are three main numbers associated with the kernel — the Major, Minor, and PatchLevel fields. The Major number rarely changes, and then only when/if the entire architecture is revamped. The Minor number changes more frequently, perhaps once every couple years. Kernels with an odd Minor number are considered unstable, testing branches. Kernels with an even Minor number are generally rock solid. The PatchLevel is updated frequently, sometimes more than once a week in extreme cases.
To recap, you can build either from your distribution’s modified kernel sources or from the stable or unstable branch of the offical sources. If you are making minor modifications to the configuration, it is perhaps safest to install your distributor’s version. These kernels usually include stability and feature patches that may be missing from the stock kernels. For example, some distributors will include low-latency or security patches and do the more difficult work of integrating these into their system. The downside is that the distributors tend to lag behind the bleeding-edge kernels. If you would like to test features that are available in the newest tree then you will likely need to build from the “pristine” source from Linus or the tree maintainer of your choice.
Download the Source
Please note that you will see several links to /pub/linux on the mirror site. You can select the kernel directory, then the kernel version that you would like to install. Once you select a kernel version you will see several files such as following:
ChangeLog-2.6.0-test9 25-Oct-2003 14:51 41k
LATEST-IS-2.6.0-test9 25-Oct-2003 14:51 0k
linux-2.6.0-test9.tar.bz2.sign 25-Oct-2003 15:14 1k
linux-2.6.0-test9.tar.gz 25-Oct-2003 15:14 39.7M
linux-2.6.0-test9.tar.gz.sign 25-Oct-2003 15:14 1k
linux-2.6.0-test9.tar.sign 25-Oct-2003 15:14 1k
patch-2.6.0-test9.bz2.sign 25-Oct-2003 15:14 1k
patch-2.6.0-test9.gz 25-Oct-2003 15:14 123k
patch-2.6.0-test9.gz.sign 25-Oct-2003 15:14 1k
patch-2.6.0-test9.sign 25-Oct-2003 15:14 1k
The Changelog files detail the differences between versions. The linux- files are the compressed sources for the entire Linux kernel. Please note that most sites will contain both gzip and bzip packages. The bzip packages tend to be smaller than the GZIP versions, so they are usually the best option since all modern Linux distributions contain BZIP utilities.
The patch files are a list of differences between versions of the kernel. If you have previously downloaded an earlier source package, you will only need to download the much smaller patch file to bring those up to date. We will discuss patch application in the next section.
There are also some .sign files that contain GPG checksum information which are useful for verifying that the sources you downloaded have not been corrupted or maliciously modified.
Extract and Patch
Please note that once you have retrieved the kernel sources and patches, you will need to extract them and apply the patches. The pristine 2.4.x and 2.6.x sources can be built as a regular, unprivileged user and this is recommended. Let’s start by creating a directory to hold all the source tarballs and patches, then proceed to extract the sources. For these examples we will assume that you have previously downloaded an earlier release of the kernel and will now need to patch to bring it up to the current version.
$ mkdir src
$ cd src
If your Linux sources are in BZIP compressed format then please use the following command:
$ tar xfvj /path/to/linux-2.6.0-test7.tar.bz2
Otherwise, use the options for GZIP compressed data:
$ tar xfvz /path/to/linux-2.6.0-test7.tar.gz
You should see a list of filenames scroll by as they are being extracted. Verify that the new kernel source directory is created:
$ ls -l
total 4
drwxr-xr-x 18 kwan users 4096 Oct 8 15:24 linux-2.6.0-test7
-rw-r–r– 1 kwan users 276260 Nov 15 02:05 patch-2.6.0-test8.gz
-rw-r–r– 1 kwan users 126184 Nov 15 02:07 patch-2.6.0-test9.gz
Next we must apply the patches in order. Patch files are created by the diff program, and can selectively modify one or more files by adding, deleting, or modifying lines in the source code. Because they contain only the differences between files it is usually a lot faster (and better for the Internet in general) if you patch to the current release. (TBF unclear). Appendix TBF shows a typical patch file. Like the kernel sources, the patch files are also compressed.
$ gunzip patch-2.6.0-test8.gz
$ gunzip patch-2.6.0-test9.gz
$ ls -l
-rw-r–r– 1 kwan users 1072806 Nov 15 02:05 patch-2.6.0-test8
-rw-r–r– 1 kwan users 486902 Nov 15 02:07 patch-2.6.0-test9
Once the patches are uncompressed we can apply them to the kernel sources. Remember that it is important to apply them in order.
$ cd linux-2.6.0-test7
$ patch -p1 <../patch-2.6.0.test8
$ patch -p1 <../patch-2.6.0.test9
If it is successful you will see messages similar to the following scroll by:
patching file Documentation/filesystems/jfs.txt
patching file Documentation/filesystems/xfs.txt
patching file Documentation/ia64/fsys.txt
patching file Documentation/ide.txt
patching file Documentation/x86_64/boot-options.txt
patching file Makefile
If unsuccessful you will get a warning and be prompted for a file to patch. If this occurs, press Ctrl-C to break out of the patch utility and verify that you are using the correct patch and applying them in the correct order.
Once all the patches are applied you might consider backing up the directory.
$ cd ..
$ mv linux-2.6.0-test7 linux-2.6.0-test9
$ tar cfvj linux-2.6.0-test9.tar.bz2 linux-2.6.0-test9
If you followed advise and guidance as provided in this tutorial guide then you would have successfully determined the hardware.