Build LINUX [Kernel updates and materials] from scratch, and start linux from scratch

Source: Internet
Author: User

Build LINUX [Kernel updates and materials] from scratch, and start linux from scratch

After understanding the content of LFS, as for the kernel update is clear at a glance the http://www.cnblogs.com/2018/p/3979305.html http://www.cnblogs.com/2018/p/3981399.html

However, some materials are not available on LFS. The following is a summary of the relevant information.

 

Kernel update

Http://jingyan.baidu.com/article/08b6a591f187ff14a809228a.html

1. Run the uname-r command to view the operating system information. Run the r command to view the kernel version)

2. Upgrade procedure

L download the internal source code package linux-2.6.38.8.tar.bz2

L create a directory cd/mkdir linux-2.6.38.8 under the root directory

L copy source code to the directory cp linux-2.6.38.8.tar.bz2 linux-2.6.38.8/linux-2.6.38.8/

L unzip the source package tar xjvf linux-2.6.38.8.tar.bz2

L enter the decompressed directory cd linux-2.6.38.8

L execute make menuconfig to configure the kernel and save it. Pay attention to the CPU selection.

L execute the kernel make command

L compile the kernel module make modules

L install the kernel module make modules_install

L install the kernel make install

L restart the computer reboot

3. Upgrade script install_new_core

#! /Bin/sh

Cd/

Mkdir linux-2.6.38.8

Cp linux-2.6.38.8.tar.bz2 linux-2.6.38.8

Cd linux-2.6.38.8

Tar xjvf linux-2.6.38.8.tar.bz2

Cd linux-2.6.38.8

Make menuconfig

Make

Make modules

Make modules_install

Make install

Reboot

Finally create the initrd file: mkinitramfs-o/boot/initrd. img-linux-3.2.12

4. Modify the script permission and execute the script chmod u + x install_new_core./install_new_core

Http://blog.csdn.net/jinble03/article/details/7070982

Some linux versions will automatically generate initd. img and modify the bootstrap file grub. cfg after make install, but ubuntu10.04 won't, so we have to do it ourselves.

First, generate initrd. img.

Mkinitramfs 2.6.38.8-o/boot/initrd. img-2.6.38.8

If the system prompts that mkinitramfs is not installed, apt-get install mkinitramfs

Then modify the boot program file grub. cfg.

Update-grub2

 

. Preparations
Switch to administrator permission. Enter the user password in sudo-I to enter the root permission.
Apt-get install build-essential kernel-package libncurses5-dev libqt3-headers
Build-essential (basic programming library (gcc, make, etc)
Kernel-package (some configuration files and tools for generating kernel-image in the Debian system)
Libncurses5-dev (meke menuconfig the one to call)

Libqt3-headers (make xconfig to call)

 

After make install, the system automatically updates the startup item, which can be cat/boot/grub. cfg. the previous boot item cannot be deleted. If the kernel compilation fails and the previous boot item disappears, your system will be paralyzed.

 

Linux kernel update

Http://www.zhukun.net/archives/6172

Linux Kernel Ramdisk (initrd) Mechanism

Http://blog.csdn.net/ruixj/article/details/3772752

In earlier Linux systems, only a floppy disk or hard disk was used as the Linux root file system. Therefore, it is easy to integrate the drivers of these devices into the kernel. However, the root file system may be stored on a variety of storage devices, including SCSI, SATA, and USB flash disks. Therefore, it is inconvenient to compile all these device drivers into the kernel. In the introduction to the automatic loading mechanism of Linux kernel modules, we can see that udevd can be used to automatically load kernel modules. Therefore, we hope that the device driver of the root file system can also be automatically loaded. However, there is a conflict. udevd is an executable file. Before the root file system is mounted, udevd cannot be executed. However, if udevd is not started, then, the root Driver Based on the system device cannot be automatically loaded, and the corresponding device node cannot be created in the/dev directory. To understand this conflict, initrd (boot loader initialized RAM disk) emerged ). Initrd is a compressed small root directory that contains the necessary driver modules, executable files, and startup scripts in the startup phase. Including the udevd mentioned above, when the system starts, booload will read the initrd file into the memory, and then tell the kernel the starting address of initrd. During the running process, the kernel will decompress initrd, Mount initrd to the root directory, and then execute the/initrc script in the root directory. You can run the udevd in initrd in this script, let it automatically load the device driver and create necessary device nodes in the/dev directory. After udevd automatically loads the disk driver, you can mount the real root directory and switch to the root directory.

Vmlinuz, Initrd, and system. map

Http://blog.csdn.net/powersaven/article/details/4107544

Install Linux on a USB flash drive

Http://www.cnblogs.com/geekard/archive/2012/05/06/2486464.html

LiveCD

Can be directly guided to the available Linux system CD

Http://blog.csdn.net/taochenchang/article/details/7622762

Http://www.ibm.com/developerworks/cn/linux/l-fedora-livecd/index.html

GRUB2

Http://linux-wiki.cn/wiki/Grub2%E9%85%8D%E7%BD% AE

 

 


Who is responsible for Linux kernel update?

1. For more information about Kernel developers around the world, see the documentation of the kernel source code. Which of the following has submitted the source code. The volume is not small. The development and management of the kernel is at the Linux Foundation.
2. Why not update it? New hardware, new functions, new algorithms, and writing errors of Old Code do not need to be added or improved? Are you still using windows 95?
3. centos is an enterprise-level operating system that focuses on stability and security. Its kernel is tested by alcohol. This stable and secure test process is very long and it takes time to check the source code. Therefore, such a stable and secure system will always choose a software version that has not been found for a long time. So the centos kernel you saw is still in the 2.6 status.

You will be able to learn these questions from Linux. It doesn't make any sense to ask these questions, but it affects your interest in learning.

How to Upgrade Linux Kernel

Download Kernel
If you only want to compile a new version of the kernel that you have installed (for example, SMP support), you do not need to download any code-skip this part to continue the next screen.
You can find the kernel code on www.kernel.org/pub/linux/kernel. When you enter, you will find that the source code of the kernel is organized into multiple directories by kernel version (v2.2, v2.3, and so on. In each directory, you will find files labeled "linux-x.y.z.tar.gz" and "linux-x.y.z.tar.bz2 ". These are the source code of the Linux kernel. You will also see the document with "patch-x.y.z.gz" and "patch-x.y.z.bz2. These are patch packages used to update the complete kernel source code. If you want to compile a new kernel version, you need to download one of these "linux" files.
Kernel unpacking
If you have downloaded a new kernel from kernel.org, it is time to unpack it. First, cd/usr/src. If there is a "linux" directory, change it to "linux. old" ("mv linux. old" with root permission ).
Now, you can unlock the new kernel package. Still in the/usr/src directory, enter tar xzvf/path/to/my/kernel-x.y.z.tar.gz or cat/path/to/my/kernel-x.y.z.tar.bz2 | bzip2-d | tar xvf -, the downloaded source code is compressed using gzip or bzip2. After entering this command, the downloaded kernel source code will be released to a new "linux" directory. Note-the full set of kernel source code usually occupies more than 50 MB space on the hard disk!
Discuss configuration issues
Before you compile the kernel, You need to configure it. configuration is an opportunity for you to precisely control which kernel functions are enabled (disabled) in the new kernel. You will also control which binary images will be compiled to the kernel (loaded at startup) and which will be compiled to the kernel module files that need to be loaded.
The old-fashioned Kernel configuration method is extremely painful and involves entering the/usr/src/linux directory and entering the make config command. Discard this Kernel configuration method unless you want to answer hundreds of questions on the command line (correct! Hundreds of) "yes/no" problems.
New configuration path
We are modern humans. Instead of entering make config, we enter make menuconfig or make xconfig. If you want to configure your kernel, use one of the above options. If you enter make menuconfig, you will use a beautiful text-based color dish... the remaining full text>

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.