当前位置:网站首页>Introduce the overall process of bootloader, PM, kernel and system startup

Introduce the overall process of bootloader, PM, kernel and system startup

2022-06-24 21:44:00 Sweet galier

One 、 Overall startup process

 Insert picture description here

Two 、 Related subsystems

bootloader: Boot loader for embedded systems , Used for hardware device initialization
PM: Low power power management program , Standby and wake-up support
recovery:android Repair subsystem of , Reset and system upgrade support
kernel:linux kernel , Hardware maintenance , Underlying support .
Android: be based on linux Open source system , Framework and application layer .

3、 ... and 、 What has been done in each link

 Insert picture description here

Four 、bootloader Introduction to

In an embedded operating system ,BootLoader It runs before the operating system kernel runs . Hardware devices can be initialized 、 Create a memory space map , In this way, the software and hardware environment of the system will be brought to a suitable state , In order to prepare the right environment for the final call to the operating system kernel .

1、 frequently-used bootloader:uboot

choice uboot The reason of :

  • Support a variety of embedded operating system kernel , Such as Linux、NetBSD, VxWorks, QNX, RTEMS, ARTOS, LynxOS, android;
  • Support multiple processor families , Such as PowerPC、ARM、x86、MIPS;
  • High reliability and stability ;
  • Highly flexible function settings , fit U-Boot debugging 、 Different boot requirements of the operating system 、 Product release, etc ;
  • Rich device driver source code , Such as serial port 、 Ethernet 、SDRAM、FLASH、LCD、NVRAM、EEPROM、RTC、 Keyboard, etc ;
  • Rich development and debugging documents and strong network technical support ;

2、uboot What to do

 Insert picture description here
Hardware initialization ( Set processor mode 、 Turn off the watchdog 、 Mask interrupt 、 initialization sdram、 Set the stack 、 Set the clock 、 from flash Boot the kernel into memory )
Power on judgment :
AC/DC Turn it on :
AC,Alternating Current, Alternating current (ac) , We usually refer to hard power on
DC,Direct Current, Direct current , We usually refer to soft boot
Startup basis bootmode Judge the power on and startup 、 Power on for standby 、 Power on memory

3、U Disk upgrade

 Insert picture description here

4、AB Zoning and recovery

 Insert picture description here

5、uboot Of ab Partition

  • Verify integrity (flash)
  • Determine the partition active
  • Start loading as needed active Partition data

6、bootcmd and bootargs

uboot Two environment variables of
uboot Environment variables of : It is essentially an array of characters , stay uboot Is actually used as a global variable in reading and writing . You can use the serial port to boot Of shell Window pass setenv,printenv,savenv Etc , Commonly used for debugging . uboot Runtime slave flash Load into DDR Use in . After modification , Use saveenv, Will be able to DDR The environment variables in are updated to flash in . Be careful ,saveenv In fact, the entire environment variable is saved once , Instead of just saving the changes .

  • bootargs: Is the startup parameter of the system , adopt cmdline To pass on to kernel. Common debugging items such as loglevel,selinux Switches and so on pass through bootargs from boot Pass to kernel Realization .
  • bootcmd: Are some commands executed by default when starting automatically , So you can define different configurations in the current environment , Parameter settings for different environments , Then set the bootcmd For the kind of parameter you often use .

5、 ... and 、PM( Low power power management program )

1、PM Mainly responsible for

  • Standby power management
  • Trigger wake-up

2、PM Reflected in the code

One main Function initialization , Then enter vTask, An endless loop waits to wake up .
 Insert picture description here

3、 Common wake-up methods

IR Wake up the 、 Press the key to wake up 、CEC Wake up the 、RS232 Wake up the 、 Wake up on the Internet 、IO Wake up, etc

4、PM Notes for debugging and development

  • PM Can be controlled by IO Co., LTD. , Most of the IO stay PM I can't control , Electronic design needs to consider , For standby control IO The mouth needs to be used PM mouth , Such as LED The lamp .
  • PM Program space is limited , Cannot achieve multiple / Complex functions . Extreme cases require functional trade-offs .

6、 ... and 、kernel

system kernel ,Android Cornerstone

  • Management process 、 Threads , Decide which process 、 Thread usage CPU, That is, the ability of process scheduling ;
  • Manage memory , Determine the allocation and recycling of memory , The ability of memory management ;
  • Managing hardware devices , Provides communication capabilities between processes and hardware devices , That's hardware communication capability ;
  • Provide system calls , If the application wants to run a service with higher permissions , Then you need to have system calls , It's the interface between the user program and the operating system .
     Insert picture description here

1、kernel Start-up phase

  • Kernel boot phase . It is usually written in assembly language , It mainly checks whether the kernel matches the current hardware . This part is also related to the hardware architecture . The code related to the kernel boot phase is mainly located in kernel /arch/arm/kernel/head.S and kernel /arch/arm/kernel/head-common.S.
  • Kernel boot phase . Before the end of the boot phase , Will call start_kernel() Enter the kernel boot phase . The code related to the kernel startup phase is mainly located in kernel/init/main.c.

2、init process

Android The core process of the system ,kernel After starting , Start in user space init process , Re pass init process , To read init.rc Related configuration in , So as to start other related processes and other operations .Init The process connects the preceding and the following , yes Android Start the core process .

原网站

版权声明
本文为[Sweet galier]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241446383117.html