本文共 4963 字,大约阅读时间需要 16 分钟。
参考:
启动流程:Boot ROM→SPL→U-boot(→Kernel→RootFileSystem)
全志SoC有一个非常具体的启动过程。首先,它执行一个微小的片上 Boot ROM(BROM),然后检查按钮的FEL模式,然后开始检查各种存储选项的有效的引导签名在正确的位置。
上电后,SoC开始从BROM所在的地址0xffff0000获取指令。BROM分为两部分:第一部分(0xffff0000)是FEL模式,第二部分是eGON.BRM(位于0xffff4000)。
FEL:FEL是包含在Allwinner设备上的BootROM中的低级子例程。它用于使用USB的设备的初始编程和恢复。所以,全志平台一般不会砖,就是有这个FEL。
一般来说,BROM首先检查SD卡(SD/MMC)启动可用性,其次再检查Nand Flash是否可以启动,然后再检查SPI Nor Flash的启动可用性,如果都无法启动则进入 FEL 模式。当程序初始化启动介质成功后,就从固定位置读入bootloader的Boot0到SRAM,然后跳到SRAM执行。
SD Card Layout:
start | size | usage |
---|---|---|
0 | 8KB | Unused, available for partition table etc. |
8 | 24KB | Initial SPL loader |
32 | 512KB | U-Boot |
544 | 128KB | environment |
672 | 352KB | reserved |
1024 | - | Free for partitions |
根据SD Card Layout表,使用dd将u-boot烧录进SD卡:
sudo dd if=u-boot-sunxi-with-spl.bin of=${card} bs=1024 seek=8
SPL(Secondary Program Loader)程序流程如下:
使用FEL/USBBoot启动spl
sudo ./sunxi-fel uboot u-boot-sunxi-with-spl.bin
U-Boot SPL 2017.03-rc2-gc7a25b3-dirty (Mar 11 2017 - 17:09:43)DRAM: 256 MiBTrying to boot from FEL
由SPL引导进入的U-boot:
U-Boot 2017.03-rc2-gc7a25b3-dirty (Mar 11 2017 - 17:09:43 +0800) Allwinner TechnologyCPU: Allwinner H3 (SUN8I 1680)Model: Xunlong Orange Pi ZeroDRAM: 256 MiBMMC: SUNXI SD/MMC: 0MMC: no card presentmmc_init: -123, time 1*** Warning - MMC init failed, using default environmentIn: serialOut: serialErr: serialNet: phy interface0eth0: ethernet@1c30000starting USB...USB0: USB EHCI 1.00USB1: USB OHCI 1.0scanning bus 0 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) foundHit any key to stop autoboot: 0 u-boot@sun8i $ ?? - alias for 'help'base - print or set address offsetbdinfo - print Board Info structureboot - boot default, i.e., run 'bootcmd'bootd - boot default, i.e., run 'bootcmd'bootefi - Boots an EFI payload from memorybootelf - Boot from an ELF image in memorybootm - boot application image from memorybootp - boot image via network using BOOTP/TFTP protocolbootvx - Boot vxWorks from an ELF imagebootz - boot Linux zImage image from memorycmp - memory compareconinfo - print console devices and informationcp - memory copycrc32 - checksum calculationdhcp - boot image via network using DHCP/TFTP protocoldm - Driver model low level accessecho - echo args to consoleeditenv - edit environment variableenv - environment handling commandsexit - exit scriptext2load- load binary file from a Ext2 filesystemext2ls - list files in a directory (default /)ext4load- load binary file from a Ext4 filesystemext4ls - list files in a directory (default /)ext4size- determine a file's sizefalse - do nothing, unsuccessfullyfatinfo - print information about filesystemfatload - load binary file from a dos filesystemfatls - list files in a directory (default /)fatsize - determine a file's sizefatwrite- write file into a dos filesystemfdt - flattened device tree utility commandsfstype - Look up a filesystem typego - start application at address 'addr'gpio - query and control gpio pinshelp - print command description/usageiminfo - print header information for application imageimxtract- extract a part of a multi-imageitest - return true/false on integer compareload - load binary file from a filesystemloadb - load binary file over serial line (kermit mode)loads - load S-Record file over serial lineloadx - load binary file over serial line (xmodem mode)loady - load binary file over serial line (ymodem mode)loop - infinite loop on address rangels - list files in a directory (default /)md - memory displaymdio - MDIO utility commandsmii - MII utility commandsmm - memory modify (auto-incrementing address)mmc - MMC sub systemmmcinfo - display MMC infomw - memory write (fill)nfs - boot image via network using NFS protocolnm - memory modify (constant address)part - disk partition related commandsping - send ICMP ECHO_REQUEST to network hostprintenv- print environment variablespxe - commands to get and boot from pxe filesreset - Perform RESET of the CPUrun - run commands in an environment variablesave - save file to a filesystemsaveenv - save environment variables to persistent storagesetenv - set environment variablessetexpr - set environment variable as the result of eval expressionshowvar - print local hushshell variablessize - determine a file's sizesleep - delay execution for some timesource - run script from memorysysboot - command to get and boot from syslinux filestest - minimal test like /bin/shtftpboot- boot image via network using TFTP protocoltrue - do nothing, successfullyusb - USB sub-systemusbboot - boot from USB deviceversion - print monitor, compiler and linker versionu-boot@sun8i $
转载地址:http://dnloi.baihongyu.com/