Linux general technology-Linux programming and kernel information-a fully transplanted 2.6-core application. The following is a detailed description. We have introduced the changes related to the 2.6 kernel, explained the compilation process of the new hardware driver, and discussed the impact of new features of the 2.6 kernel on existing hardware drivers. Here we will mainly describe how to port existing drivers, development systems, application software, and customized Linux configurations to the 2.6 kernel.
Because the 2.6 kernel has added many new features, especially in terms of hardware drivers and system software, management tools need to be changed accordingly. A system based on the 2.6 kernel requires a new startup program. The program must be able to recognize new module naming rules and use the new setting file and new 2.6 kernel features. For example, the sysfs file system is a virtual file system. It can generate a hierarchical view of all system hardware, similar to the proc file system that provides process and status information. The sysfs file system is mainly used inside the Linux system. 2.6 The kernel has begun to provide integration support for new file systems that store user information. New log file systems such as JSF and XFS and new network file systems such as OpenAFS require the latest tools for specific file systems.
You only need to install tools related to the new features of the 2.6 kernel. If you do not need them, you can temporarily skip them. For example, if you are not using a JFS file system, you can reduce the space occupied by the kernel by disabling JFS support. Similarly, JFS-related tools can be cleared to reduce the space occupied by the root file system. If you are not using a 2.6 kernel-based Linux system, you need to determine whether the installed Linux system package has all the features required by the 2.6 kernel.
Verify and upgrade important software packages
A software package is a collection of tools and software that meet different needs. These software can be installed together into the system as a whole. For software packages and subordinate management software provided by different Linux systems, first check whether other software on which they depend is installed, and the software versions must be new enough. Managers of these software packages often maintain databases throughout the system. The database stores the names and versions of all installed applications. The most common software Package formats are RPM (Red Hat Package Manager, also used for Fedora, Mandrake, SuSE, and TurboLinux) and DEB (Debian Linux, also used for Knoppix and Xandros. Other software packages are in the TGZ format of the standard compressed program file. They are mainly used in Slackware Linux and do not include any subordinate information.
(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // tech.ccidnet.com/pub/attachment/2004/12/368095.jpg'); ">
Table 1 lists different Linux software packages. Most of these kits are available in 2.4-kernel-based Linux systems and can be installed in all the Desktop Linux systems used for software development. Specialized systems such as embedded computing may not be indispensable. However, if a user is upgrading a specialized system, it is very important to know where the software package needs to be upgraded.
If you are upgrading a Desktop Linux system to the 2.6 kernel, the only place to upgrade and verify the package in table 1 is your desktop system. If you are porting a specialized system such as an embedded Linux system, you must first upgrade all the cross-compiling programs and the software in use to produce software for the embedded system. Then, you can upgrade all the software packages used in the file system of the embedded system.
When preparing to use the 2.6 kernel in an existing system, you must verify all versions of the software package installed on the original system and listed in Table 1. If the version is lower than the minimum version limit in the table, you must upgrade it. You only need to execute the command in the third column to check the software package version.
If you plan to use a specific file system, hardware device, or management system, you may need to upgrade other software packages in addition to the software packages listed in Table 1.
Special Handling for upgrading the built-in Module
If you want to enable 2.6/2.4 dual-kernel boot, you also need to perform special processing on the built-in module tool set software listed in Table 1. The software package with built-in module tools provides the module loading (insmod and modprobe), offload (rmmod), list (lsmod), and depmod functions for system application software. Because the module naming and loading rules of the new kernel have changed, you cannot simply overwrite the existing versions of these tools. Otherwise, the 2.4 kernel module cannot be properly managed. Therefore, the upgrade process of the built-in module tool package includes first renaming the tool software under the 2.4 kernel, such as utility. old. In this way, you can retain the software package version required by the 2.4 kernel. If the built-in module tool package supports backward compatibility after compilation, the tool software in the suite can automatically execute the old versions of these tools. In this way, the user can achieve the goal of Dual-kernel startup without any modification.
If you use a kit such as DEB or RPM to upgrade the built-in module tool, and still require dual-kernel startup, before installing the new version, check whether the kit contains a pre-installed applet. This program can rename the binary commands of related modules. A simpler method is to create a set of built-in module tools for the user's system from the source code. One of the goals of the "make" command is moveold, it can copy binary commands of related modules so that they will not be lost when the new version is installed. The following describes how to set, set up, and install the software package with built-in module tools:
#./Configure -- prefix =/
# Make moveold
# Make
# Make install
In the code above, the first line of the command sets the software package of the built-in module tool so that it is installed in the same location as the original kit. The second line of command rename the existing BINARY command. The third line of the command is to create the application software in the software package of the built-in module tool. The fourth line is to install the software.
Of course, building and installing these packages from the source code will not upgrade any databases with installed application software. These databases are usually maintained by the Suite Manager.
The last step to install the new built-in module tool package is to run a shell software. The software can set the file logon port for the module used by the 2.4 kernel and convert it to the same 2.6 kernel (/etc/modprobe. conf ). The shell software name is the generate-modprobe.conf program, there is only one parameter, is the path name of the existing modules. conf file. After running, you need to check the new file and upgrade it according to the hardware name changes in the two versions.
Other software packages to be upgraded
(400) {this. resized = true; this. width = 400; this. alt = 'click here to open new window';} "onmouseover =" if (this. resized) this. style. cursor = 'hand'; "onclick =" window. open ('HTTP: // tech.ccidnet.com/pub/attachment/2004/12/368097.jpg'); ">
In addition to the software packages listed in Table 1, if the features you use happen to be supported by other software packages, you may need to upgrade other software kits. Table 2 lists some software packages that may need to be upgraded. These packages do not exist by default in all Linux suites and they have special significance for some subsystems or drivers. For example, ISDN, PCMCIA card, kernel profile analysis, quota file system, special network or Log File System (nfs-utils, jfsutils, reiserfsprogs, and xfsprogs ).
Application advanced Linux sound architecture
If the system audio function is not limited to built-in speakers and related sound units, a major change to the 2.6 kernel is that it uses an advanced Linux sound architecture (ALSA ). ALSA is currently the default Digital Audio architecture for playing and managing audio recording and playback. ALSA used to replace the open voice system (OSS) on the Linux platform a long time ago. Although ALSA can provide an OSS simulation mode to support the old application software in the 2.6 kernel, ALSA is a long-term solution to upgrade the system.
TimeSys found it wise to use ALSA before upgrading the kernel. In this way, you can reduce multiple uncertainties when upgrading the kernel and ensure that ALSA works properly with the hardware. In addition, you can avoid some difficulties encountered during kernel upgrade and make sure that the ALSA module setting Command already exists in the/etc/modules. conf file.
The ALSA upgrade procedure is as follows:
◆ Get the latest ALSA drivers, libraries, and tools from the prepared software package. Although the 2.6 kernel source code contains the ALSA driver, it is recommended that you prepare the ALSA suite in advance. In this way, you can upgrade the system to ALSA before upgrading the kernel. If you want to use the OSS simulation mode of ALSA, you also need to obtain its source code and install the ALSA suite.
◆ Configure, compile, and build ALSA suites, or install binary commands in the system.
◆ Use the Alsaconf application software to configure the ALSA software. This software allows you to search for sound software installed by users, generate loading information for the current module, and selectively upgrade the/etc/modules. conf file.
◆ Use the alsamixer application to activate ALSA. The software can enable the ALSA settings (ALSA was originally disabled ).
◆ Connect the/etc/rc. d/init. d/alsasound Startup file with the command file executed during system startup.
◆ Run the generate-modprobe.conf program to port the ALSA Module Settings to the/etc/modprobe. conf file. It can work with the module tools required by the 2.6 kernel.
ALSA has many advantages over OSS. ALSA supports more audio ports, sound cards, and modular drivers. Because the kernel is separated from the user space, the process of writing and maintaining the driver and audio application software can be simplified.
Upgrade system settings file
In addition to the software package, you usually need to manually upgrade some system boot and setup programs to install and use the new file system and support the module naming rules used by the 2.6 kernel.
During kernel upgrade, you must add a line of commands to the sysfs File System in the/etc/fstab directory to create an entry. The entry command is in the following format:
None/sys sysfs noauto 0 0
This portal provides information for your system to identify and install the sysfs file system. If you only want to start from the 2.6 kernel, you only need to specify the ults Installation option, instead of noauto. In this way, the system automatically installs the sysfs file system whenever you execute the "mount-a" command.
If the system can be started with either the 2.4 or 2.6 kernel, The noauto Installation option will disable automatic sysfs file system installation when the system is started with the 2.4 kernel.
Upgrade the system to start and close the program
As mentioned above, changes related to the 2.6 kernel, such as different file names, module names, and new features, enable users to upgrade the system startup program when adding the 2.6 kernel startup option.
The files to be changed depend on the user's system startup sequence and the startup and Shutdown Programs executed by the system. Different Linux suites use different files during startup, although most software packages are based on SysVinit and initscripts. Enhanced edition software packages that support both the 2.4 kernel and 2.6 kernel startup processes can be provided directly by manufacturers supporting Linux systems. If you cannot obtain the software package, the following describes the changes you need to make.
If you want to build a dual-kernel boot system, but the Linux manufacturer cannot provide the startup or shutdown programs after the upgrade, it is a good solution to set the conditions for the startup program based on the selected startup kernel. The simplest method is to set an environment variable based on the identification of the running kernel. The example is as follows:
# VERSION = 'uname-a | sed-e's;. * \ (2 \. 6 \). *; \ 1 ;''
Next, you can check the value of this variable and execute commands that are compatible with the kernel version, for example:
If ["x $ VERSION" = "x"]; then
VERSION = "2.4"
Fi
If ["x $ VERSION" = "x2.6"]; then
Action $ "Mounting sysfs filesystem:" mount-n-t sysfs/sys
Fi
When using the 2.6 kernel, The first modification you need to make to the Startup Program is to add the command line for installing the sysfs file system. One of your system startup programs, maybe/etc/rc. sysint or/etc/rc. d/rc. sysinit, contains an entry for installing the proc system. You can install the proc file system in the/Proc directory when the system is started.
You also need to add a similar portal for sysfs file system installation at the installation point/sys (which can be created by using the "mkdir/sys" command. The location of this entry in the file is similar to that of the/proc file system.
Similarly, in the 2.6 kernel, the file name of the proc file system that contains the kernel symbol information also changes. To ensure that the startup program can find the kernel symbol, You need to convert all the examples of/proc/ksyms in the System Startup File into/proc/kallsyms. The latter file name can be used by the Linux2.6 kernel.
To cater to the features of the 2.6 kernel, some files in the proc file system for the 2.4 kernel have been transplanted to the sysfs file system. For example, the USB hardware list is stored in the/proc/bus/usb/devices file in the 2.4 kernel, the 2.6 kernel is stored in the/sys/bus/usb/devices file.
In addition, you must modify all programs called during system shutdown. For example, in the Red Hat system, disabling a process will call the/etc/init. d/halt program. The program references the proc file system rather than the equivalent sysfs file system.
A Simple Method for Kernel Compilation
In the first article, I introduced the Linux 2.6 kernel settings in detail. If you are installing the 2.6 kernel for an existing system and setting the kernel yourself, the easiest way is to re-use the kernel setting file in the existing system. You can use the "make oldconfig" command to set the target. It is a text-based interface that calls up existing settings files and sorts all the setting variables found in the kernel source code.
In order to smoothly port the existing system to the 2.6 kernel, you should also note that you should modify as few as possible at the same time. The preceding section describes the modifications to the software package, system settings file, and Startup Program. However, if you want to add ALSA support for the system and upgrade the system to ALSA before porting to the 2.6 kernel as recommended above, before confirming that the 2.6 kernel system works properly, do not change the features that ALSA supports as A loadable kernel module. In this way, even if the kernel cannot work normally, You can reset the kernel based on the integration of ALSA support.
If you want to port a commercial Linux package to the 2.6 kernel, you may not have to worry about the details of the system hardware. One of the advantages of commercial Linux suites such as Red Hat and SuSE is that they have many integrated or loaded kernel modules that can support a variety of PC or embedded hardware devices.
If you are porting a commercial Linux system and have its source code and kernel settings files, you can first follow the instructions above to port the settings file to the 2.6 kernel, it can also activate various functions and support that users are interested in, such as ALSA. Then, you can install and set the 2.6 kernel and various related modules, restart and test the system. If you do not have a system setting file, you can run the "make defconfig" command in the 2.6 kernel source code directory to create a default setting file. Different system architectures and processors have different kernel setting variables. You can specify the target in the command line to see the setting variables in different architectures. Taking the PowerPC (PPC) system as an example, specify the command as follows:
# Make defconfig ARCH = ppc
After the default 2.6 kernel setting file is generated, you must set the kernel to provide the driver required by the system hardware.
Hardware identification solutions for all platforms cannot be described here, but in most Linux suites, the two most commonly used hardware identification tools are Lspci and Lsusb. The Lspci tool displays all PCI bus information and lists the hardware devices connected to them. Lspci is especially useful for X86 boards that integrate sound cards and video cards because it can identify the exact chip used in the motherboard's PCI circuit. Lsusb provides similar information about the USB bus and connecting devices.
Other hardware information required by the user also includes the CPU model during the creation of the kernel settings file. You can use xconfig to set the Processor or Processor type and features panel in the Compilation Program.
You can also find information about the processor model from the/proc/cpuinfo file, as long as you run the "cat/proc/cpuinfo" command.
Finally, you need to modify the new kernel settings file based on the kernel features customized by the system. For example, you need to view the file systems supported or used by the kernel. Run the "cat/proc/filesystems" command to obtain information about the file system type from the/proc/filesystems file. For example, the root file system used by SuSE Linux is the Reiserfs file system, but the default status of the Reiserfs File System in the 2.6 kernel is not activated. Similarly, in the 2.6 kernel, the initial RAM cannot be used by default, and SMB and CIFS file systems cannot be accessed. These parameters must be set in advance.
Summary
If you have transplanted or created a kernel setting file and set it according to the method described here, you can start to build and install the kernel and the required modules. You can run the "make" command in the source code directory of the top-level kernel to build the kernel. After the "make" command is successfully executed, how to install the kernel and modules depends on the system type. If you want to upgrade a desktop x86 system, you can use the "make install" and "make modules_install" commands to install the kernel and related modules. If the user is compiling the 2.6 kernel for an embedded system, the "make" command should be determined based on the installation location and method of the binary kernel command.
To sum up, porting a desktop system to the 2.6 kernel requires many steps, but these steps are not difficult for a novice. The process of porting a special Linux system is much more complicated. TimeSys's TimeStorm Linux development kit makes porting specialized systems to new kernels and new hardware very easy.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service