System Startup

To begin the boot, a special hardware circuit raises the logical value of the RESET pin of the CPU. After RESET is asserted, some registers of the processor (including cs and eip) are set to fixed values, and the code found at physical address 0xfffffff0 is executed. This address is mapped by Read-Only Memory (ROM). The set of programs stored in ROM is called the Basic Input/Output System (BIOS) . The BIOS performs the following four operations:

  1. Power-On Self-Test (POST).
  2. Initializes the hardware devices.  At the end of this phase, a table of installed PCI devices is displayed.
  3. Searches for an operating system to boot.
  4. As soon as a valid device is found, it copies the contents of its first sector into RAM, starting from physical address 0x00007c00, and then jumps into that address and executes the code just loaded

The first sector of the hard disk, named the Master Boot Record (MBR), includes the partition table and a small program, which loads the first sector of the partition containing the operating system to be started. Linux replaces the rudimentary program included in the MBR with a sophisticated program—the “boot loader” (LILO).

Actually, the LILO boot loader is too large to fit into a single sector, thus it is broken into two parts. The MBR or the partition boot sector includes a small boot loader, which is loaded into RAM starting from address 0x00007c00 by the BIOS. This small program moves itself to the address 0x00096a00, sets up the Real Mode stack (ranging from 0x00098000 to 0x000969ff), loads the second part of the LILO boot loader into RAM starting from address 0x00096c00, and jumps into it

  1. Invokes a BIOS procedure to load an initial portion of the kernel image from disk: the first 512 bytes of the kernel image are put in RAM at address 0x00090000, while the code of the setup( ) function is put in RAM starting from address 0x00090200.
  2. Invokes a BIOS procedure to load the rest of the kernel image from disk and puts the image in RAM starting from either low address 0x00010000 (for small kernel  images compiled with make zImage) or high address 0x00100000 (for big kernel images compiled with make bzImage).
  3. Jumps to the setup( ) code.

The code of the setup( ) assembly language function has been placed by the linker at offset 0x200 of the kernel image file. The boot loader can therefore easily locate the
code and copy it into RAM, starting from physical address 0x00090200.

  1. initial 
  2. Jumps to the startup_32( ) assembly language function

There are two different startup_32( ) functions; the one we refer to here is coded in the arch/i386/boot/compressed/head.S. After setup( ) terminates, the function has been moved either to physical address 0x00100000 or to physical address 0x00001000, depending on whether the kernel image was loaded high or low in RAM.

  1. Initializes
  2. decompress the kernel image,  The decompressed image is then moved into its final position, which starts at physical address 0x00100000
  3. Jumps to physical address 0x00100000.

The second startup_32( ) function sets up the execution environment for the first Linux process (process 0). The function performs the following operations:

  1. Initializes
  2. Jumps to the start_kernel( ) function.

setuparch/i386/boot/setup.S
startup_32arch/i386/boot/compressed/head.S
startup_32arch/i386/kernel/head.S
start_kernelinit/main.c

这段代码是关于系统启动时的一些信息,具体解析如下: 1. emmc boot table board switch:0x00000007:表示系统选择的引导设备为emmc。 2. boot table version:V0.3:表示引导表的版本号为V0.3。 3. boot table build time:2023/05/12 15:58:27:表示引导表的构建时间为2023年5月12日15点58分27秒。 4. boot table file name:Hi3519DV500-DMEB_6L_T_DDR4_2666M-2GB_16bitx2-A55_1G.xlsm:表示引导表的文件名为Hi3519DV500-DMEB_6L_T_DDR4_2666M-2GB_16bitx2-A55_1G.xlsm。 5. System startup Uncompress Ok!:表示系统启动,并且解压缩成功。 6. U-Boot 2022.07 (May 12 2023 - 15:58:35 +0800)hi3519dv500:表示使用的启动加载器版本号为U-Boot 2022.07,启动时间为2023年5月12日15点58分35秒,使用的处理器型号为hi3519dv500。 7. DRAM: Relocation Offset is: 17745000 Relocating to 5ff45000, new gd at 5fb04de0, sp at 5fb04dd0:表示系统正在进行DRAM的重定位操作,新的地址为5ff45000,新的全局数据指针为5fb04de0,新的栈指针为5fb04dd0。 8. Core: 1 devices, 1 uclasses:表示系统核心有1个设备和1个类别。 9. MMC: mmc->ocr_from_bootrom 0x00000000:表示MMC设备OCR寄存器值为0x00000000。 10. MMC/SD Card: MID: 0x90 Read Block: 512 Bytes Write Block: 512 Bytes Chip Size: 7456M Bytes (High Capacity) Name: "H8G4a" Chip Type: MMC Version: 5.1 Speed: 150000000Hz Bus Width: 8bit Mode: HS400ES Boot Mode: normal(), 86 ms bsp-sdhci: 0 (eMMC):表示MMC/SD卡的详细信息,包括厂商ID、读写块大小、芯片容量、芯片类型、版本号、速度、总线宽度、模式和引导模式等。 11. Loading Environment from MMC... OK:表示从MMC设备中加载环境变量成功。 12. In: serial Out: serial Err: serial:表示标准输入输出错误都使用串口进行传输。 13. Net: gmac0 Error: gmac0 address not set.:表示网络设备gmac0的地址未设置,可能需要在系统中进行配置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值