Start Linux with initramfs together with cainiao

Source: Internet
Author: User

About initramfs

Initramfs is compiled at the same time and connected to the kernel into a file. It is linked to address _ initramfs_start and loaded to Ram at the same time as the kernel. The space occupied by the original cpio package (compressed or non-compressed) after initramfs is parsed (& __ initramfs_start-& __ initramfs_end) is directly stored in the system as part of the system, will not be released.

Because initramfs uses the cpio package format, it is easy to compile a single file, directory, and node to the system. This is very easy to use in the system, you do not need to mount another file system.

However, the cpio package is actually a Language Pack for describing files, directories, and nodes. To describe a file, directory, and node, a lot of additional overhead of description text is required, especially for directories and nodes, the cpio package is much larger than the corresponding image file.

 

About Kernel configuration and compilation

Kernel configuration: Make menuconfig to enter the configuration

EnterGeneral setup --->

Select kernel compression to lzma Compression

Kernelcompression mode (lzma) --->

Then select

[*] Initial Ram filesystem and RAM disk (initramfs/initrd) Support
(/Rootfs_dir) initramfs source file (s)

Rootfs_dir is the path of the rootfs to be compressed.

 

1. Modify the storage location of the compressed package in the memory: (MIPs chip)

In ARCH/MIPS/boot/compressed/calc_vmlinuz_load_addr.c

Vmlinuz_load_addr = 0x81a00000; (this address can be adjusted as needed)

 

2. Modify the busybox link of rootfs and run the following command in the rootfs directory:

Ln-sbin/busybox init

3. Modify cmdline:

"Console = ttysac0, 115200 init/init RW kgdbttysac0, 115200 kgdboc = ttysac0
Mem = 32m"

4. Make Compilation

Make vmlinuz. Bin

The vmlinuz. Bin compressed package will be generated in the current directory.

5. compilation may fail. In this case, the root permission is granted to rootfs and the user group is root. You need to modify the user group before compiling.

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.