uboot启动流程 && MMC分区
因为厂家并没有提供逻辑的USB下载程序,而是希望我们使用SD卡启动uboot,那么也可以将SD卡的内容写入到eMMC中,通过eMMC来启动uboot,后续将SD卡作为一个移动硬盘多一个文件接入的方式
uboot的启动方式:
CPU参数:Exynos 4412:
- rom:64KB
- sram:256KB
- 板载外扩EMMC:8GB
- 板载外扩DRAM(DDR3):1GB

1.iROM is placed in internal 64 KB ROM. It initializes basic system functions such as clock and stack.
2.iROM loads BL1 image from a specific booting device to internal 256 KB SRAM. The booting device is selected by Operating Mode (OM) pins. According to the secure boot key values, iROM may do an integrity check on BL1 image.
3.BL1 initializes system clock, and DRAM controller. After initializing DRAM controller, it loads OS image from the booting device to DRAM. According to the secure boot key values, BL1 can do an integrity check on the OS image.
4.After the booting completes, BL1 jumps to the operating system.
others:iROM reads the OM pins to find the booting device. The OM register provides the OM pin and other information required for booting. Refer to Section 4, "Chip ID" for more information on OM register.
The OM pin decides the booting devices such as NAND, MoviNAND, and iNAND.
USB booting is provided for system debugging and flash reprogramming, not for normal booting
1.三星exynos4412 官方的手册说的很清楚:iROM是内部的一个ROM,它被用于初始化系统等基本功能的函数等一些基本功能,比如始终和栈引导
2.iROM在启动的过程中负责从特定的启动设备上加载BL1镜像到内部的256KB的RAM中,这个操作是由OM(操作系统模式的引脚)决定的(也就是板载的BOOT引脚),并且会根据一段key值来确定BL1的镜像和完整性(也就是之前官方提供的SD_FUSING.sh中BL2制作的时候,对BL1进行了和校验,并写在了BL2文件的结尾),这一个过程确保了系统安全启动
3.BL1会初始化系统时钟和DRAM,在初始化完DRAM之后,BL1会从启动的设备(SD / eMMC)中加载系统的镜像,其中在BL1引导的时候会对系统镜像进行完整性检查
4.在完成boot引导的时候,BL1引导程序将会跳转到操作系统
总之,说人话就是:exynos4412内部的ram只有64KB,rom只有256KB,这两个只够加载BL1(BL1由芯片引脚的OM_PIN决定,也就是板载的boot引脚),而在之前官方提供的sd烧写脚本中,一共有bl1,bl2,uboot,和tzsw这四个bin文件,BL1只负责在芯片内部加载,用于一些系统的基本功能初始化,和芯片验证等,在验证完成之后,将会读取bl2,而bl2通过官方烧写工具可以得知,就是bl1的14KB - 4个字节的内容加上4个字节存储的和校验数据,在验证完成BL2之后,将会引导外扩内存初始化,并且将uboot拷贝到这个外扩内存中,完成之后将PC指针指向外扩内存的首地址来启动uboot
如果只是想要从eMMC启动uboot,只需要使用uboot从SD卡里面将bl1.bin \ bl2.bin \ uboot.bin \ tasw.bin写入eMMC的特定地址就好了,再将boot选择从eMMC启动就可以了
movi命令集:
在uboot命令中,有一个movi命令,这是一个操作存储设备的命令集,厂家在适配板载的时候已经适配完成了,主要涉及到iNand、SD卡、EMMC 等)和内存(DDR)之间的传输。
通过movi指令将SD卡中的bl1、bl2、uboot、tzsw都挨个读取到内存中,然后依次写入到eMMC中去,后续就不用通过SD卡来启动了
TINY4412 # ? movi
movi - movi - sd/mmc r/w sub system for SMDK board
Usage:
movi init - Initialize moviNAND and show card info
movi read zero {fwbl1 | u-boot} {device_number} {addr} - Read data from sd/mmc
movi write zero {fwbl1 | u-boot} {device_number} {addr} - Read data from sd/mmc
movi read {u-boot | kernel} {device_number} {addr} - Read data from sd/mmc
movi write {fwbl1 | u-boot | kernel} {device_number} {addr} - Write data to sd/mmc
movi read rootfs {device_number} {addr} [bytes(hex)] - Read rootfs data from sd/mmc by size
movi write rootfs {device_number} {addr} [bytes(hex)] - Write rootfs data to sd/mmc by size
movi read {sector#} {device_number} {bytes(hex)} {addr} - instead of this, you can use "mmc read"
movi write {sector#} {device_number} {bytes(hex)} {addr} - instead of this, you can use "mmc write"
#使用下列操作可以将bl1、bl2、uboot、tzsw、zimage都写入MMC中
movi r f 0 40008000;emmc open 1;movi w z f 1 40008000;emmc close 1;
movi r b 0 40008000;emmc open 1;movi w z b 1 40008000;emmc close 1;
movi r u 0 40008000;emmc open 1;movi w z u 1 40008000;emmc close 1;
movi r t 0 40008000;emmc open 1;movi w z t 1 40008000;emmc close 1;
movi r k 0 40008000;movi w k 1 40008000;
磁盘&&扇区
1.磁盘分区
在windows下我们可以给磁盘进行分区,例如将一个32GB的磁盘分为4个8GB的磁盘,每个磁盘里面都包含有分区格式表,这些格式表用来记录每个分区的起始位置、大小和类型等信息
对于一般的SD卡或者是eMMC使用MBR分区表格式,这种格式会占用到第一块扇区,也就是512字节,所以三星提供的sd烧写脚本都是从第一个扇区开始写入的,而不是从第0个扇区,目的就是为了不破坏原本的分区表
2.uboot启动时的磁盘映射
- 从SD卡启动

当我们使用fdisk对EMMC进行分区的时候,可以看到直接越过了bl1+bl2+uboot+tzsw+zimage一共1 - 134344个分区

越过了bl1+bl2+uboot+tzsw+zimage一共1 - 134344个分区
[外链图片转存中…(img-e6MtnvXp-1733404313944)]
2344




被折叠的 条评论
为什么被折叠?



