Embedded Bootloader technology insider
Embedded BootLoader Insider (a) Author: Zhan Rong open (zhanrk@sohu.com) This article taken from: IBM DW 2003 December 30 Japanese paper describes in detail the boot loader based embedded system OS - Boot Loader's Concept, software design's main tasks and structural frameworks. 1. Introduction In the dedicated embedded board, the GNU / Linux system has become more and more popular. A embedded Linux system can usually be divided into four levels from the perspective of software: 1. Boot loader. Includes Boot code (optional) cured in firmware, and two parts of Boot Loader. 2. Linux kernel. The custom kernel of the embedded plate and the startup parameters of the kernel. 3. File system. Includes root file system and file system based on Flash memory devices. Usually used as RAM Disk as root fs. 4. User application. User-specific applications. Sometimes there may be an embedded graphical user interface between the user application and the kernel layer. Common embedded GUIs are: MicroWindows and Minigui understand. The boot loader is the first software code running after the system is powered up. Recalling the architecture of the PC. We can know that the boot loader in the PC consists of BIOS (which is a firmware program) and Osboot Loader located in the hard disk MBR. After completing hardware detection and resource allocation, Boot Loader in the hard disk MBR is read in the system's RAM, and then the control is handed over to OS Boot Loader. Boot Loader's main running task is to read the kernel image from the hard disk to the RAM, then jump to the entry point of the kernel to run, which will start the operating system. In the embedded system, there is usually no firmware program like the BIOS (note, some embedded CPUs also embed a short start program), so the load start tasks of the entire system are completely completed by the boot loader. For example, in an embedded system based on ARM7TDMI Core, the system is usually started from the address 0x00000000 when power-on or reset, and it is usually the Boot Loader program of the system at this address. This article discusses the Boot Loader of the embedded system from the four aspects of the Boot Loader's concept, Boot Loader's main task, Boot Loader's framework and Boot Loader installation. Second, Boot Loader's conceptually said that Boot Loader is a small program that runs before the operating system kernel runs. Through this small program, we can initialize the hardware device to create a mapping map of memory space, bringing the software hardware and software environment to a suitable state to prepare the correct environment for the final call operating system kernel. Typically, Boot Loader is severely relying on hardware, especially in embedded world. Therefore, it is almost impossible to establish a general Boot Loader in the embedded world. Despite this, we can still summarize some general concepts to Boot Loader to guide users specific Boot Loader design and implementation. 1. The CPU and embedded boards supported by Boot Loader have different CPU architectures with different Boot Loader. Some boot loaders also support a variety of architectural CPUs, such as U-Boot, support the ARM architecture and MIPS architecture. In addition to the architecture that relies on the CPU, Boot Loader actually depends on the configuration of the specific embedded plate-based device.
That is to say, for two different embedded panels, even if they are constructed based on the same CPU, if they want to run the Boot loader program running on a plate on another board, usually also Need to modify the source program of Boot Loader. 2. The installation medium of the Boot Loader is powered or reset, all CPUs usually take instructions from a certain address pre-scheduled by the CPU manufacturer. For example, the CPU based on ARM7TDMI CORE is typically taken from the address 0x00000000 from the address 0x00000000 when reset. CPU-based embedded systems typically have some type of solid state storage device (such as ROM, EEPROM or FLASH, etc.) being mapped to this pre-arranged address. Therefore, after the system is powered up, the CPU will first execute the Boot Loader program. The following is a typical spatial allocation structural diagram of a Solid Storage Device that simultaneously contains a boot loader, a kernel's startup parameter, a kernel image, and a root file system image. Http://tech.ccidnet.com/pub/attachm...3/12/267984.gif Figure 1 Typical spatial allocation structure of solid state storage devices 3. Device or mechanism host and target machine for controlling Boot Loader Generally, the connection is established by serial port, and the Boot Loader software will usually perform I / O through the serial port when executed, such as: Output print information to the serial port, read user control character from the serial port. 4. The boot loader startup process is a single stage or multi-stage usually multi-stage Boot Loader provides more complex features, as well as better portability. Most boot loaders starting from solid state storage devices are 2-stage startup process, i.e., the startup process can be divided into two parts and STAGE 2. As for the specific completion of Stage 1 and STAGE 2, it will be discussed below. 5. Operation Mode Mode Most Boot Loader contains two different operating modes: "Launch Load" mode and "Download" mode, this difference is only for developers. However, from the perspective of end users, the role of Boot Loader is to load the operating system, and there is no distinction between the so-called start-load mode and the download mode. Boot loading mode: This mode is also called "autonomous) mode. That is, Boot Loader loads the operating system into the RAM from a certain solid storage device on the target, and the entire process does not intervene. This mode is the normal working mode of Boot Loader, so the boot loader must work in this mode when the embedded product is released. Download (Downloading) Mode: In this mode, Boot Loader on the target will download files from the host (Host) through communication means such as serial connections or network connectivity, such as downloading kernel images and root file system images. The files downloaded from the host typically be saved in the RAM of the target machine by Boot Loader, and then written by Boot Loader to the Flash Category Solid Storage Device on the Tall. This mode of Boot Loader is usually used when the first installation kernel is used when the root file system is installed; in addition, the future system update will use the work mode of Boot Loader.