Linux System Quick Start scenario

Source: Internet
Author: User
Tags compact

========================= Basic Knowledge =========================

Linux System Basic startup process:

1, the CPU from ROM(if any) of the 0x0 address start reading code, execute loader;

2. Loader initialize Ram, copy uboot or kernel from ROM The image to the specified address of RAM and execute;

3, Uboot(if any) copy kernel image and dtb file to the specified address of Ram , and run kernel;

4, set Bootargs will be overwritten,kernel start;

5, Kernel self-extracting;

6, Kernel initialization;

7, Kernel load the built-in driver, start the hardware device;

8. load file system, read and execute /etc/inittab.

========================= Quick Start principle =========================

First, the basic principle

1, hardware IO time;

2, streamline the process;

3, the kernel is streamlined;

Second, the start-up process analysis

1, 0x0, a level loader, configuration Ram; à must;

2. copy uboot or kernel and dtb to Ram; à must, from ROM Read value,IO time;

3, Uboot(if any) copy kernel and dtb; à can be removed, skip directly;

4, set Bootargs,kernel start; à non-required, does not account for IO time;

5, Kernel self - extracting , à can be streamlined, but will be extended 2 IO time;

6, Kernel initialization; à must;

7, Kernel load the built-in driver, start the hardware device; à can be streamlined, accounting for a large amount of IO time;

8, scanning ROM; à can be removed;

9, mount the file system; à must, but for 8, can be adjusted to 2;

10, Read and execute /etc/inittab. à must;

Three, the basic idea

1, Loader

    1. The purpose of Loader existence is to guide the system;
    2. unless necessary, loader is not required to drive the hardware, otherwise there is no need for Linux ;

2, Kernel

    1. the necessary common sense: Kernel Start-up is only related to CPU and Ram ;
    2. Kernel Embedded driver is designed to deal with hardware IO operations that must be done before the firmware is mounted ;

3. File system

  1. Kernel Boot, the file system does not have to be read from rom or read in Ram ;
  2. Rom in the loader has been able to use, you can take advantage of the need to read out at once, there is no need to occupy the valuable time of kernel startup;
  3. in order to speed up the loader loading file system, the file system can be divided into the general part (<3mb), firmware part, by kernel Cramfs driver loads the boot file system, completes the boot task first, then loads the rom device driver from the boot file system, then loads the firmware file system;

Four, after the adjustment of the start-up process

1, 0x0, one-level loader, configuration Ram;

2, copy kernel(compact),dtb, file system image (compact) to Ram;

3, set Bootargs,kernel start;

4, Kernel self-extracting;

5, Kernel initialization;

6, Kernel load the necessary driver preparation;

7, mount the Universal file system;

8, Read and execute /etc/inittab;

9. mount the firmware, including driver, additional application software and LIB;

========================= Quick Start configuration =========================

First, streamline Loader


1, The purpose of Loader is to prepare the condition for the kernel to start;

2, Loader Skip ready to run the environment step, directly load the kernel can;


Note: Major manufacturers of bootloader vary widely, can only introduce the approximate method

1, If the official project has skipped uboot method, then direct use of this method;

2, if 1 is not advisable, then the deletion of uboot Code, in the uboot, after the end of the hardware initialization, do not uboot Initialization of user environment, direct use of source code loading and boot mirroring;

effect:The bootloader process takes less time,bootloader volume shrinks;

Second, streamline kernel

idea: Only to keep the necessary drivers for startup, such as Cramfs read-write driver, audio driver (boot music), the rest of the drive into a ko file, put into the file system;


1, make Arch=arm menuconfig, cut off the drive that will not be used;

2, the startup is not required, but the application needs the driver, set to module, stripped from the kernel;

3, Busybox must provide insmod function;

Effect: The core volume is reduced, the time of Loadder loading kernel is shortened,thekernel decompression time is shortened,kernel time to boot to mount file system is shortened;

Streamline Rootfs(that is, make the general part)


reserved: 1 busybox 2 /etc config file; 3 Drivers required to load the firmware ( rom 4 5 package, volume approx. 2.4MB

Effect: The file system can be run directly in Ram , can delay loading rom drive;

Iv. Production of firmware

1. all remaining files are encapsulated in the firmware system (EXT4 format or ubi format);

2, but note that the firmware/etc need to have a rc.local file, when the rootfs in the custom task is completed, Call the file to start the firmware task;

3, in order to maintain the normal operation of the system, the rcS file in the original /etc after mounting the firmware, to add additional operations:

# Mount firmware


# Use the firmware etc to cover the general etc, application firmware configuration and restore Write permission


# Use the var of the firmware to overwrite the general varand restore read and Write permissions


# Extended lib search range to firmware /lib and /usr/libtoensure proper operation of the program

Export Ld_library_path= $LD _library_path:/mnt/lib:/mnt/usr/lib

# Boot configuration script for executing firmware


Linux System Quick Start scenario

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: 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.