Upgrade the kernel to use the file system reiser4

Source: Internet
Author: User
Tags apm
Upgrade the kernel using the file system reiser4-general Linux technology-Linux programming and kernel information. The following is a detailed description. [Root @ myas5 ~] # Uname-
Linux myas5.happyboy.net.cn 2.6.18-8. el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux
Upgrade the kernel and try to use the new file system reiser4

The compiling kernel contains two main items: Configuring the kernel and compiling the kernel. You need to frequently view the kernel Documentation for these two tasks. You must at least view the Changes files in the Readme file and Documentation directory. They describe the kernel,

For example, problems that may occur during kernel upgrade and kernel version requirements for tools in the system

Download kernel http://www.kernel.org/pub/linux/kernel/
Linux-2.6.22.tar.gz

Reiser4's inner complement reiser4-for-2.6.22.patch.gz
Ftp://ftp.namesys.com/pub/reiser4-for-2.6/2.6.22/
Reiser4 components:
Ftp://ftp.namesys.com/pub/reiser4progs/libaal-1.0.5.tar.gz
Ftp://ftp.namesys.com/pub/reiser4progs/reiser4progs-1.0.6.tar.gz
The installation of components can refer to the ftp://ftp.namesys.com/pub/reiser4progs/README
The downloaded file is stored in the/usr/src directory.

1. Install the reiser4 component

[Root @ happyboy src] # tar-xvzf libaal-1.0.5.tar.gz
[Root @ happyboy src] # cd libaal-1.0.5
[Root @ happyboy libaal-1.0.5] #./configure -- prefix =/usr
[Root @ happyboy libaal-1.0.5] # make
[Root @ happyboy libaal-1.0.5] # make install // This operation installs the library file to the/usr/lib directory
[Root @ happyboy libaal-1.0.5] #/sbin/ldconfig // add/usr/local/lib to/etc/ld. so. conf if not already there
Generally, you do not need to execute it manually. It is automatically executed during make install. check/etc/ld. so. cache, the system version varies slightly with files, usually/etc/ld. so. *

[Root @ happyboy src] # tar-xvzf reiser4progs-1.0.6.tar.gz
[Root @ happyboy src] # cd reiser4progs-1.0.6
[Root @ happyboy reiser4progs-1.0.6] #./configure -- prefix =/usr
[Root @ happyboy reiser4progs-1.0.6] # make
[Root @ happyboy reiser4progs-1.0.6] # make install
[Root @ happyboy reiser4progs-1.0.6] #/sbin/ldconfig

2. Unzip the kernel creation link and install patches.

[Root @ happyboy src] # tar-xvzf linux-2.6.22.tar.gz
[Root @ happyboy src] # ln-s linux-2.6.22 linux
[Root @ happyboy src] # cd linux
[Root @ happyboy linux] # pwd
/Usr/src/linux
[Root @ happyboy linux] # gzip-cd ../reiser4-for-2.6.22.patch.gz | patch-p1 // patch Package released to/usr/src/linux/fs/reiser4

3. Configure the kernel
With the kernel to be compiled and configured, we will first introduce how to configure the kernel. The specific steps are as follows:
1. Before starting to configure the kernel, run the following command to clear all the temporary files, middleware, and configuration files. For a kernel just downloaded from the internet, it must be clean. But this is a good habit and there will be no bad results.

[Root @ happyboy linux] # make mrproper

2. Then you need to know the hardware configuration of your system, such as the CPU type, host chip, video card and sound card model.
3. Run the following command to configure the kernel options:

# Make

Used Include:
◆ Config is based on the interactive text configuration interface. Each question appears in a linear format and is answered one by one. Once an answer is made, it cannot be modified.
◆ Oldconfig is similar to config, but the original configuration file is used, and only questions about new kernel features are asked, which is convenient for Kernel upgrade.
◆ Menuconfig: a text mode and menu driver configuration interface.
◆ Xconfig is based on the X graphical configuration interface of Tcl/Tk.
Now start to configure the kernel. The tool used is menuconfig. Run the following command in command line mode:

[Root @ happyboy linux] # make menuconfig

The interface appears after several lines of text are flashed.

Remember to select the following
Code maturity level options
---> Prompt for development and/or incomplete code/drivers
Then make sure that 4 k stacks is not selected
Kernel hacking ---> Use 4Kb for kernel stacks instead of 8Kb
Remember to select the reiser4 option.
File system ---> select all related reiser4
Perform other operations based on your hardware configuration.
Select Save an Alternate Configuration File and press enter to Save the File. Select Exit

The following describes how to configure and use the Text Graphics Tool:
Use the arrow keys to move between options. Use the "Enter" key to Enter the next menu. The highlighted letters on each option are keyboard shortcuts, you can use it to quickly get to the menu items you want to set. Press "y" in brackets to set the project

Compile it into the kernel and press "m" to compile it as a module, press "n" for no selection (you can also switch between compiling into the kernel, compiling as a module, and not compiling by pressing the Space key ), press "h" to display the help information for this option. Press "Esc" to return to the upper menu.
Note: If the "make menuconfig" command fails, it is likely that the ncurses library is not installed.
There are many Kernel configuration options. Here we will briefly describe the main options so that you can customize the kernel according to your own situation. If you are unsure of some items, you can refer to the documentation/Configure. help file, or search the entire system and check the files in which the related options appear. The following describes the configuration of an option.
◆ Loadable module support (supported modules can be loaded ). The "Enable loadable module support" option allows the kernel to support modules. The "Module unloading" option allows you to detach modules that are no longer in use. If you do not select this option, you cannot detach any modules. (Note, some modules cannot be detached Once loaded, regardless of whether this option is selected.) The "Module versioning support (EXPERIMENTAL)" option allows users to use the modules compiled in other versions of the kernel, but it is not reliable, so it is generally not selected; the "Automatic kernel module loading" option allows the kernel to automatically call the "modprobe" command to load the required module.
A module is a small piece of code. After compilation, it can be dynamically added to the kernel during system kernel running, so as to add some features to the kernel or support certain hardware. Generally, some commonly used drivers or features can be compiled as modules to reduce the size of the kernel. You can run the "modprobe" command to load the module to the kernel (you can uninstall it when you don't need it ).
◆ Set version infomation on all symbols for modules (CONFIG_MODVERSIONS) is an option for kernel module version control. If you want to develop the kernel module code (including any module code other than the current kernel source code tree), enable this setting. Generally, you can disable it.
◆ (Pentium-III/celon (Coppermine) Processor family is used to select the CPU type. It allows the kernel to use special commands inside the advanced processor. Of course, if the user's CPU is 80386, there is no need to select P4. However, if you do not know how to choose, select 386. In this case, if you use an advanced CPU, the kernel runs slowly than it should, but at least it can run. We recommend that you use Help and/proc/cpuinfo for more Help.
◆ High Memory Support (CONFIG_NOHIGHMEM) enables the kernel to Support large Memory. Generally, the kernel only supports 1 GB of memory (the actual situation is 896 MB, which is related to the implementation of vmalloc (), which is beyond our scope of discussion ). If the user's memory size exceeds 896 MB, select 4 GB memory support for the kernel, or even 64 GB memory support.
◆ Using Ric multi-processing support (CONFIG_SMP) enables the kernel to support multi-processor. If you have more than one CPU, You must select this one.
◆ Maximum number of CPUs (2-32) is used to select the number of processors. It makes no sense to select the number of CPU users.
◆ General setup indicates General configuration. Here, we can set Kernel support for virtual memory and provide a communication mechanism for System V processes. Some core parameters and variables can be dynamically changed using the "Sysctl support" option, you do not need to restart the system.
◆ File systems (File System ). There is a lot of content here. We recommend that you modify the content based on the default value. Generally, dos fat (FAT16, FAT32), VFAT, EXT3, NTFS, and ISO9660 (file system used on the standard CD) are required.
This section describes the main options of these kernel configurations. After you configure the kernel as required, you need to compile the kernel.
◆ Power management options (ACPI, APM) is an advanced Power management service. Note that ACPI and APM cannot be used at the same time. If both are configured, APM is disabled and ACPI is loaded if a working ACPI device is found during system startup.
If you want Linux to support advanced Power Management, such as soft shutdown and System sleep, you need to select the "Power Management support" option; "Software Suspend (EXPERIMENTAL) "option can be used to suspend a computer (similar to sleep in Windows XP), which does not require support for advanced power management. The" Processor "option allows the Processor to save power during idle time and should be selected; when the system temperature is too high, the "Thermal Zone" option promptly adjusts the operating status of the system to protect the CPU (hardware support is required ).
◆ Bus options (PCI, PCMCIA, EISA, MCA, and ISA) are used to set the system Bus. Choose your own Based on the motherboard parameters. The "PCI support" option is available for the PCI bus, and the ISA and EISA sub-items are listed below, which are generally required. The "Support for hot-pluggable devices" option is for hot swapping devices; the "PCMCIA/carw.support" option supports PCMCIA.
◆ Executable file formats indicates the format of the Executable file, which should be selected in general.
◆ Device Drivers is used to select the Device driver. Choose sound cards, graphics cards, NICS, and video cards. Among them, the "Plug and Play support" option supports Plug-and-Play; the "Block devices" option supports Block devices; and the "SCSI device support" option supports SCSI devices; the "Multi-device support (RAID and LVM)" option supports RAID and logical volumes; the "Networking support" option supports networks, including network protocols and network devices, the protocol must be set to "TCP/IP" and select the corresponding device based on the network adapter. The "ISDN subsystem" option must be selected for ISDN Internet access. The "Sound" option is a Sound card driver, there are two options: ALSA drive
One is the Open Sound System driver. Select the one that supports your own Sound card and compile it into the kernel. The "USB Support" option is very important, USB flash drives are usually used. for USB, at least "Support for USB", "USB device filesystem", and "echi hcd (USB 2.0) are required) support, most Intel and VIA support, USB Audio support, usb midi support, and USB Mass Storage support options.
After "make" is executed, the system will generate an autoconf. h file in the include/linux directory. For example, when you configure the kernel option to support the NTFS file system and compile it into the kernel. "CONFIG_NTFS_FS = y" will be generated in config, corresponding to include/linux/autoconf. "# define CONFIG_NTFS_FS 1" is generated in h. Therefore, all C source files related to the NTFS file system will contain the include/config/ntfs/fs. h header file.
Two GUI configuration tools are added to the new 2.6.0 kernel. To use xconfig, you must first install the Qt Library (usually available on the CD-Rom of the release version). To use gconfig, you must first install the Gtk library.
When the configuration tool is started, the 2.6.0 kernel reads the current system configuration to maintain the same options as the current configuration. This feature is convenient for future upgrades. When the kernel features do not change much, it can be directly based on the current options, saving the trouble of configuration item by item. There are two ways to enable the configuration tool with the default options in the 2.6.0 kernel, one is to delete the current configuration file/boot/config-XXX; the other is to execute the "make defconfig" command before executing the Configuration tool.
In addition, several new options are added for make, including allyesconfig, allnoconfig, and allmodconfig. They are prepared for Kernel developers and testers.
After you configure the kernel according to your requirements, compile the kernel.

4. Compile the kernel
The software environment for compiling the kernel is the kbuild system. It refers to all the resources required to build a complete and runable Linux kernel. These resources include build programs, scripts, middleware, configuration files, and makefiles. The following describes how to compile the kernel:
1. "make dep" or "make depend"
Kbuild calls the middleware scripts/mkdep to generate a list of. H files (the vast majority) that describe the dependency with the relevant core files. This list is saved in. depend. Even if you do not perform this step, kbuild will automatically execute it. I have not executed it manually to make it run automatically.

2. The command to build the kernel image is:
# Make
The parameters are as follows:
◆ ZImage: Build a small kernel image.
◆ Compressed is the same as zImage.
◆ BzImage: Build a large kernel image.
◆ Zdisk uses zImage to generate a boot floppy disk.
◆ Bzdisk uses bzImage to generate a boot floppy disk
◆ Zlilo uses lilo as the zImage guide.
◆ Bzlilo uses lilo as the guide for bzImage.
Select the kernel image type based on the actual situation, and select "make bzImage" in most cases ".
The kbuild system of the 2.6.0 kernel differs from 2.4.23, but the vast majority of functions are similar. The command parameters for building the kernel image are added as follows:
◆ Create a m boot floppy disk using fdimage
◆ Fdimage144 and fdimage
◆ Fdimage288 prepare a 2.88M boot floppy disk

[Root @ happyboy linux] # make bzImage

3. Run the following command to install the kernel:

# Make install

If you use LILO, it puts the kernel image in the correct position and modifies the LILO configuration, you can avoid manual operations. If you use another Bootstrap (such as GRUB), do not use this command. The manual modification of grub. conf requires interactive editing, which may lead to unpredictable errors. Therefore, you need to perform some manual operations after compilation (see step 1 below ).
In 2. 6. * "make install" is more intelligent. It uses arch/i386/boot/bzImage, System. map copies to/boot/vmlinuz-2.6. *,/boot/System. map-2.6. *, and create a vmlinuz-2.6. * Soft links vmlinuz and System. map-2.6. * Soft link System. map. Kbuild also automatically creates/boot/initrd-2.6. *. img and modifies grub. conf, which was previously done manually. For example, "2.4.x is semi-automated, while 2.6.x is fully automatic ."

4. Use the following command to compile all kernel components configured as modules:

[Root @ myas5 linux] # make modules

5. Copy all compiled kernel modules to the/lib/modules/2.6.22/directory according to the function. Run the following command:

[Root @ myas5 linux] # make modules_install

6. Create a startup Image File

[Root @ myas5 linux] # mkinitrd/boot/initrd-2.6.22.EL.img 2.6.22

Mkinitrd is a script (cat/sbin/mkinitrd | more) used to create a startup image. It can automatically load modules and initialize the system.
It requires Kernel support for loopback sending devices, ramdisk, initrd, and tmpfs. Pay attention to these conditions when compiling the kernel.
In addition, the installation script for Kernel 2.6.x will call the installkernel script of fedora to automatically generate initrd (if you select initrd when compiling the kernel, you do not need to manually create it yourself. Copy the kernel image file to the/boot partition.

[Root @ myas5 linux] # cp arch/i386/boot/bzImage/boot/bzImage-2.6.22
[Root @ myas5 linux] # cp System. map/boot/System. map-2.6.22

This step is not required, but it is best to form a good habit.
Then modify the settings of LILO or GRUB. The following uses grub. conf as an example:

[Root @ myas5 ~] # More/etc/grub. conf
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a/boot partition. This means that
# All kernel and initrd paths are relative to/boot/, eg.
# Root (hd0, 0)
# Kernel/vmlinuz-version ro root =/dev/VolGroup00/LogVol00
# Initrd-version.img/initrd
# Boot =/dev/hda
Default = 0
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title Red Hat Enterprise Linux AS (2.6.22.EL)
Root (hd0, 0)
Kernel/bzImage-2.6.22 ro root =/dev/VolGroup00/LogVol00
Initrd/initrd-2.6.22.EL.img
Title Red Hat Enterprise Linux Server (2.6.18-8. el5)
Root (hd0, 0)
Kernel/vmlinuz-2.6.18-8.el5 ro root =/dev/VolGroup00/LogVol00
Initrd/initrd-2.6.18-8.el5.img

Note: For kernels earlier than 2.4.23, the LABEL parameter is usually set. The 2.6.0 Kernel Parameter has been deprecated and the root file system location is specified using the root parameter.
If the "kernel panic" error occurs after the restart or the "init" information should be modified, the preceding kernel statements are basically incorrect.
The GRUB configuration files are usually stored in/etc/grub. conf,/boot/grub/menu. lst, or/boot/grub. conf.
At the beginning, I modified grub. conf by mistake. The prompt "kernel panic not syncing attempted to kill init" appears, because the default partition is selected at that time.

[Root @ myas5 ~] # Uname-

Linux myas5.happyboy.net.cn 2.6.22 #1 SMP Fri Dec 28 09:48:27 CST 2007 i686 i686 i386 GNU/Linux
We can see that the kernel has been upgraded to 2.6.22l.

7. Finally, the junk files in the compilation process will be cleared. The command is as follows:

# Make clean

8. Test

[Root @ myas5 usr] # mkfs.
Mkfs. cramfs mkfs. ext2 mkfs. ext3 mkfs. msdos mkfs. reiser4 mkfs. vfat
[Root @ myas5 usr] # mkfs. reiser4/dev/hdb1
Creating reiser4 on/dev/hdb1... done
[Root @ myas5 usr] # mkdir/mnt/hdb1
[Root @ myas5 usr] # mount/dev/hdb1/mnt/hdb1
[Root @ myas5 usr] # more/etc/mtab
/Dev/mapper/VolGroup00-LogVol00/ext3 rw 0 0
Proc/proc rw 0 0
Sysfs/sys sysfs rw 0 0
Devpts/dev/pts devpts rw, gid = 5, mode = 620 0 0
/Dev/hda1/boot ext3 rw 0 0
Tmpfs/dev/shm tmpfs rw 0 0
None/proc/sys/fs/binfmt_misc rw 0 0
Sunrpc/var/lib/nfs/rpc_pipefs rw 0 0
/Dev/hdb1/mnt/hdb1 reiser4 rw 0 0
[Root @ myas5 src] # pwd
/Usr/src
[Root @ myas5 src] # du-sh reiser4progs-1.0.6
18 M reiser4progs-1.0.6
[Root @ myas5 src] # cp reiser4progs-1.0.6/mnt/hdb1/-R
[Root @ myas5 src] # du-sh/mnt/hdb1/reiser4progs-1.0.6/
13 Mbps/mnt/hdb1/reiser4progs-1.0.6/
Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.