【Linux】4. BootLoader: Introduction to UBoot | BIOS and BMC

insert image description here

1. Bootloader

reference

When Windows is turned on, it will first load the bios, then the system kernel, and finally the startup is complete. Then the bootloader is equivalent to the bios of the mobile phone. It initializes the hardware according to the baseband when the mobile phone starts, and then guides the system kernel until the system starts.

Bootloader is the first piece of code that an embedded system executes after power-on. Through this small program, perform hardware initialization, obtain memory size information, etc., and adjust the mobile phone to the adaptation state. After it completes the initialization of the CPU and related hardware, it installs the operating system image or the solidified embedded application program in the memory, then jumps to the space where the operating system is located, and starts the operating system to run.

For embedded systems, Bootloader is implemented based on a specific hardware platform. Therefore, it is almost impossible to establish a common Bootloader for all embedded systems, and different processor architectures have different Bootloaders. Bootloader not only depends on the architecture of the CPU, but also depends on the configuration of the embedded system board-level equipment. For two different embedded boards, even if they use the same processor, if the Bootloader program running on one board can also run on the other board, it is generally necessary to modify the source program of the Bootloader.

Conversely, most Bootloaders still have many common features, and some Bootloaders can also support embedded systems with multiple architectures. For example, U-Boot supports architectures such as PowerPC, ARM, MIPS, and X86 at the same time, and there are hundreds of supported boards. Typically, they all automatically boot from storage media, all boot the operating system, and most support serial and Ethernet interfaces.

Competing products are compared as follows:

  • UBoot: In embedded (small server, few cores) scenarios
  • GRUB: It is the GNU Project, and it is popular for Linux: In the server (multi-core) scenario, use BIOS+GRUB to boot

1.1 uboot

uboot (universal bootloader) is a BootLoader program that can be used for various embedded CPUs. In other words, uboot is a subset of bootloader. Essentially a bare metal program.

1. Hardware management uboot must be able to perform Soc-level (Soc internal peripherals) and board-level (Soc external peripherals) hardware management. A part of the hardware control capability is implemented in uboot (a part of the hardware is initialized in uboot), because uboot must make these hardware work in order to complete some tasks. For example, uboot must be able to drive iNand to implement flashing. For example, uboot must be able to drive LCD if it wants to display a progress bar on LCD when flashing. For example, uboot must drive the serial port to provide an operation interface through the serial port. For example, if uboot wants to realize the network function, it must drive the network card chip. 2. To be able to complete the image burning (flashing) uboot must be able to be used to complete the flashing operation. Refer to the steps of flashing the SD card:

a. Burn uboot to SD card. There are 2 burning methods: one is to use the swiping tool to make a bootable SD card in windows; the other is to use the dd command in linux. After making SD, insert the SD card into the development board, and then turn on the device to enter the uboot interface.

b. Use the fastboot command of uboot, and use the fastboot software in the PC to complete the burning of images including uboot, kernel, rootfs, etc. It can be seen from the above that flashing relies on the fastboot command of uboot to write the image into the corresponding FLASH.

3. The "life cycle" of uboot The entry of uboot is to start automatically when booting, and the only exit of uboot is to start the kernel. Uboot can also perform many other tasks (such as burning the system), but after other tasks are executed, you can return to the uboot command line to continue executing the uboot command, and once the boot kernel command is executed, you cannot return.

4. uboot should provide command-style shell interface shell is the meaning of user operation interface. Shells include command-line shells, such as cmd under windows, such as terminals under linux; there are also GUI-style shells, such as the commonly used various interfaces under windows. The shell is an interface left after encapsulation, and uboot also has such an interface.

The principle of the shell is: an infinite loop consisting of message receiving, parsing, and execution.

The uboot shell also uses line buffering mode. That is, the Enter key (line feed key) is used as the end of a command input. Other corresponding buffering modes include unbuffered and full buffered: unbuffered means inputting a character and treating it as a command; full buffering means no matter what is input, it will be buffered until the buffer is full before processing.

2. BIOS

BIOS (Basic Input Output System), that is, the basic input and output system, is an immutable startup program engraved on the ROM chip of the motherboard. The first program after the computer system starts. Because it cannot be tampered with, the program is stored in the ROM chip, and the original settings can still be maintained after power off.

The main function of BIOS is to control the basic programs after the computer is started, including hard disk drive (such as DVD or USB boot disk is preferred during installation), keyboard settings, floppy disk drive, memory and related devices.

CMOS (short for complementary metal-oxide-semiconductor) is a term commonly used to describe the small amount of memory on a computer motherboard that stores BIOS settings. CMOS is sometimes called real-time clock (RTC), CMOS RAM, non-volatile RAM (NVRAM), non-volatile BIOS memory, or complementary symmetric metal-oxide-semiconductor (COS-MOS). The picture below shows the CMOS battery on the computer motherboard:

insert image description here

When resetting the BIOS to the factory settings, the CMOS will be rewritten, and the CMOS will not be lost after power off:
insert image description here

2.1 grub

GRUB is an acronym for GRand Unified Bootloader. If you've ever used a Linux desktop, you've seen this screen. This is called the GRUB screen.

insert image description here

GRUB is a complete program for loading and managing system startup. It is the most common bootloader found in Linux distributions. A bootloader is the first piece of software that runs when a computer starts up. It loads the operating system's kernel, which in turn initializes the rest of the operating system (including the shell, display manager, desktop environment, and so on).

Any changes you make to GRUB in the menu interface are temporary. If you want to make some permanent changes to GRUB, such as changing the default timeout, you can modify the GRUB configuration file after the Linux system boots.

The default GRUB configuration file is /etc/default/grub. There is also a /etc/default/grub.d directory, which also stores some configurations. You can edit the /etc/default/grub file directly, but I recommend doing additional modifications by adding configuration files (.cfg files) in this directory.

insert image description here

3. BMC

BMC (Baseboard Management Controller) is used to manage the hardware on the server (management, monitoring, installation, restart, etc.).

3.1 Principle

​ BMC is a software that runs immediately after the server AC is powered on. It runs on a separate ARM chip on the server. This ARM chip is the CPU of the BMC software. At the same time, it will configure its own RAM, Flash and other devices around the chip. , as long as the server is plugged into the power cord, the BMC software will run quickly. At this time, it is possible that the OS on the x86 server side in our usual sense has not been installed yet. BMC is the big housekeeper of the entire server. It is mainly used to detect the temperature and voltage of each component of the server (CPU, memory, hard disk, fan, frame, etc.) There is no overheating, and the control of the overall power consumption cannot be too high. If there is any abnormality in the single board components, the information will be reported to the upper network management in time through SNMP protocol, SMTP protocol, Redfish protocol and other common industry standards, so that the operation and maintenance personnel Timely processing to ensure that the business is not damaged.

For example, when we operate a server, we usually use ssh to connect remotely. Log in to ssh, we need to change the address of the network card, command service network restart, after a while we find that we can't connect. It may be that the configuration is wrong and it cannot be accessed. So what to do? At this time, you need to reconfigure and restart the service. Huchihuchi asked the network administrator for the access control card, then ran to the computer room, and then found the target machine among the piles of servers, and then operated and corrected it locally.

If you use BMC, you can solve this problem, which provides the function of remote management hardware. It can change the BIOS, change the media boot order, change the fan speed, count power consumption information and so on. It also provides a set of management commands, such as ipmicmd ipmievd ipmilan ipmish ipmi_sim ipmitool ipmi_ui etc.

3.2 Usage Scenarios

BMC is a small operating system independent of the server system. It is a chip integrated on the motherboard or plugged into the motherboard through PCIE and other forms. The external form is only a standard RJ45 network port and a firmware system with independent IP.

BMC enjoys greater authority than the host server, which effectively ensures the separation of business nodes and management nodes, ensuring that business nodes will not interfere with management nodes, and management nodes can manage and monitor business nodes in real time.
insert image description here

The function is as follows:

  • Abnormality reporting: When the system actually fails, the BMC needs to capture the abnormality as soon as possible to realize real-time alarm and log upload. The operation and maintenance personnel can lock the faulty component in time and complete the replacement to ensure stable and uninterrupted business.
  • Management network: monitor operating status, upgrade machine firmware, remotely deploy OS in batches, and spontaneously correct serious events.
  • Support setting BIOS
  • Autonomous monitoring: temperature, voltage, fan status, power status, etc. of components (such as CPU, memory, chipset, environment, components, etc.)
  • Log record: When an error occurs in the detection system (such as a device temperature is too high, the server blue screen is down), generate relevant logs and save them
  • Recovery control: When a serious error is detected (such as the CPU core temperature exceeds the threshold, and the power consumption of the whole machine exceeds the power consumption range of the power supply), the server can be powered off for protection
  • Web Server: Provides a web interface, users can access the web and view the system status
  • Remote control: remote power on/off/reset server, vKVM, vMedia
  • Fan speed control, mainly used for system heat dissipation optimization
  • Alarm function: LED indicator light, SNMP Trap, email notification, etc.

3.3 IPMI specification

IPMI (Intelligent Platform Management Interface): intelligent platform management interface, is a set of interactive standard management specifications, jointly proposed by Intel, HP, Dell and NEC on September 16, 1998, mainly used for server system cluster autonomy, monitoring The physical health characteristics of the server, such as temperature, voltage, fan working status, power supply status, etc. At the same time, IPMI is also responsible for recording various hardware information and log records, which are used to prompt users and locate subsequent problems. Currently, IPMI is supported by more than 200 computer vendors.

IPMI is an on-board component that is independent of the host system CPU, BIOS/UEFI and OS and can run independently, and its core component is BMC. In other words, BMC interacts with other components such as BIOS/UEFI, CPU, etc., all through IPMI. With the assistance of IPMI, users can remotely start, reinstall, and mount ISO images on closed servers.

insert image description here

3.4 Configuration and use

There are two network ports on the back of the server, one for shared network and the other for private network. The shared network refers to the network we use normally, and the private network is used to access the BMC.

insert image description here

After each server leaves the factory, just like a router, it comes with a management system. This system exists independently of the server operation and manages its hardware, such as power supplies, fans, storage, CPU, and so on.

insert image description here

3.4.1 Set BMC IP via ipmitool

So how do we log in to this management system?

A command ipmitool is used here.

ipmitool lan is used to configure network information,

ipmitool lan print 1 can view the current BMC ip, we can access the management interface through this IP.

Modify the command ipmitool lan set 1 ipaddr xxxx

(here 1 refers to the channel number)

insert image description here

Next, confirm that the private network is connected, that is, connect the private network port to the switch with a network cable. In this way we can access the BMC remotely.

3.4.2 Set BMC IP through BIOS

For example, power on, press F2 to enter BIOS, enter Server Mgmt:

insert image description here

Enter configuration (static on next reset), configure ip:

insert image description here

Guess you like

Origin blog.csdn.net/jiaoyangwm/article/details/131403956