当前位置:网站首页>树莓派的启动流程
树莓派的启动流程
2022-07-29 07:02:00 【嵌入式悦翔园】
一、背景分析
在进一步研究学习 linux 嵌入开发之前,先来了解一下树莓派的启动过程。
树莓派具有一款博通的 BCM2835 系统芯片, 当启动时,CPU 会处于复位状态,由 GPU 核心负责启动系统。
主要研究如下过程:树莓派上电 --> bootloader --> linux 内核
关于Linux启动的详细过程,请看—>Linux启动过程详解
二、过程记录
1) 树莓派上电启动
树莓派上电后,SoC 中的 第一启动程序 首先被执行,其作用是挂载 SD 卡上的 FAT32 分区,从而加载下一阶段的 bootloader。这部分程序被固化在 SoC 的 ROM 中,用户无法进行修改。
4B 在芯片内部增加了一块 EEPROM 来规避风险(由于 4B 硬件升级,导致启动过程较为复杂,如果将代码都写到 ROM 中,会增加复杂度以及引入可能的 BUG ),4B 上电运行 SPI 连接的 EEPROM 中的 bootloader 代码。
2) 树莓派执行 bootloader
在这个阶段,树莓派会加载 SD 卡上的 bootcode.bin(bootloader) 文件作为第二阶段的启动程序。bootloader会启动GPU并加载第三阶段的启动器start.elf。
需要注意,4B 上不使用 bootcode.bin,因为它已由板载 EEPROM 中的启动代码替换。
3) 树莓派启动内核
start.elf 读取存放系统配置的文件 config.txt,根据其内容设置 CPU 运行参数及内存分配情况,随后将用户代码加载至内存,启动 CPU;
CPU 启动后,加载内核进行启动。
系统会先搜寻 config.txt 中参数 kernel=xxx 指定的文件作为接下来接受系统控制权的对象,树莓派默认该文件是 linux 内核,我们可以替换为用 uboot 作为新一个 bootloader 然后之后再去启动 linux 内核。
如果 config.txt 里没指定 kernel 参数,则默认是先后搜寻 kernel8.img、kernel8-32.img、kernel7.img、kernel.img,分别对应 ARMv8-aarch64、ARMv8-aarch32、ARMv7 和之前版本的。
树莓派启动注意事项
SD 卡里的 boot 需要包含如下文件:
- overlays:存放设备树,必须有
- bcm2711-rpi-4-b:设备树文件
- bootcode.bin:第二阶段的bootloader,必须存在(4B除外)
- fixup*.dat :链接器文件,与 start*.elf 文件匹配
- start*.elf :GPU基本固件,第三阶段启动器
- kernel.img :linux内核镜像,也可以为uboot,然后再进一步启动内核
- config.txt :该文件是启动过程第三阶段用来读取参数的。
- cmdline.txt :是树莓派原生系统启动时传给内核的参数
边栏推荐
- MySQL advanced (Advanced) SQL statement (I)
- Ansible中的变量及加密
- 接口测试实战项目03:执行测试用例
- Explanation of suffix automata (SAM) + Luogu p3804 [template] suffix automata (SAM)
- QT basic day 2 (2) QT basic components: button class, layout class, output class, input class, container and other individual examples
- Excel文件读写(创建与解析)
- Redis Basics
- MySQL 使用客户端以及SELECT 方式查看 BLOB 类型字段内容总结
- After three years of outsourcing, the salary of automatic testing after job hopping is twice that of the original. The secret is
- mysql 单表最多能存多少数据?
猜你喜欢

3-全局异常处理

leetcode力扣经典问题——4.寻找两个正序数组的中位数

Full process flow of CMOS chip manufacturing

QT专题:基础部件(按钮类,布局类,输出类,输入类,容器类)

MySQL 高级(进阶) SQL 语句 (一)

Paper reading (62):pointer networks

Synchronous / asynchronous, blocking / non blocking and IO

2-unified return class dto object

Vite3.0都发布了,你还能卷得动吗(新特性一览)
Scala higher order (IX): pattern matching in Scala
随机推荐
MySQL如何把行转换为列?
计算程序运行时间 demo
如何与斯堪尼亚SCANIA建立EDI连接?
请问flink支持sqlServer数据库么?获取sqlServer数据库的变化
MySQL 高级(进阶) SQL 语句 (一)
7-2 calculate the area and perimeter of a regular pentagon (25 points)
力扣(LeetCode)209. 长度最小的子数组(2022.07.28)
CAN&CANFD综合测试分析软件LKMaster与PCAN-Explorer 6分析软件的优势对比
微服务远程调用
Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
Kubernetes (五) ---------部署 Kubernetes Dashboard
Comparison of advantages between can & canfd integrated test analysis software lkmaster and PCA Explorer 6 analysis software
能在SQL 语句中 指定 内存参数吗?
LevelFilter简介说明
在线问题反馈模块实战(十七):实现excel模板在线下载功能
Practice of online problem feedback module (XVII): realize the online download function of excel template
反射reflect
How does MySQL convert rows to columns?
Synchronous / asynchronous, blocking / non blocking and IO
When NPM is installed, it is stuck. There are five solutions