博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
sunxi:[0]全志SoC启动过程
阅读量:4193 次
发布时间:2019-05-26

本文共 4963 字,大约阅读时间需要 16 分钟。

sunxi学习:[0]全志SoC启动过程分析

参考:


启动流程:Boot ROM→SPL→U-boot(→Kernel→RootFileSystem)

一、BROM阶段

全志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执行。

将u-boot烧录进SD卡

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

二、U-boot SPL阶段

SPL(Secondary Program Loader)程序流程如下:

  • 初始化ARM处理器
  • 初始化串口控制台
  • 配置时钟和最基础的分频
  • 初始化SDRAM
  • 配置引脚多路复用功能
  • 启动设备初始化(即上面选择的启动设备)
  • 加载完整的u-boot/kernel程序并转交控制权

使用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

三、U-boot

由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 $

  • 我的个人主页:
  • 我的个人站点博客:
  • 我的CSDN博客:
  • 我的简书:
  • 我的GitHub:
    欢迎相互follow~

转载地址:http://dnloi.baihongyu.com/

你可能感兴趣的文章
iPhone 12 Pro系列变贵的原因在这儿!
查看>>
刘慈欣、Netflix联手!《三体》系列将拍摄剧集,但编剧被网友疯狂吐槽
查看>>
2198元买真全面屏手机!网友:笑而不语...
查看>>
官宣!《花木兰》内地定档
查看>>
钱准备好!苹果官方账号泄密:iPhone 12明晚发布有戏
查看>>
LG电子发布旋转双屏5G手机Wing 售价约6800元
查看>>
苹果iOS 14正式发布!一大波新功能集体上线,必升!
查看>>
阿里发布手掌大小云电脑“无影”,价格是传统PC一半
查看>>
做中国女人难,做中国女装更难
查看>>
特斯拉召回部分进口Model S、Model X电动汽车
查看>>
小米折叠屏手机设计专利曝光:向内折叠 正面无开孔
查看>>
iPhone 12开启5G续航锐减 苹果官方回应了!
查看>>
靠疯狂卖吊牌年赚13亿,南极人的暴利模式你永远不懂!
查看>>
“你在哪里上班?”“呵呵呵!”
查看>>
消息称高通可供货华为:麒麟处理器真将绝版?
查看>>
索尼PS5游戏主机炒到8000元以上:相比之下iPhone 12不值一提
查看>>
被母婴品牌“盯上”的拼多多,史努比两天“拼掉”一个月货
查看>>
贾跃亭时隔四个月再发声 这次还是为了法拉第未来
查看>>
站在李雪琴背后的男人
查看>>
4399元!苹果2020年终极新品上市就遇麻烦:付款3个月才能到货
查看>>