stm32mp135d u-boot 引导流程

2024-05-01 14:36
文章标签 stm32mp135d boot 流程 引导

本文主要是介绍stm32mp135d u-boot 引导流程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

stm32mp135d u-boot 引导流程

  • 一、U-Boot启动流程
    • 1. bootcmd_stm32mp 确定当前设备
    • 2. distro_bootcmd 进入当前设备启动
    • 3. bootcmd_mmc1 设置当前设备号
    • 4. mmc_boot 设置当前设备类型
    • 5. scan_dev_for_boot_part 扫描设备分区
    • 6. scan_dev_for_boot 扫描指定分区
    • 7. scan_dev_for_extlinux 查找指定分区的配置文件
    • 8. boot_extlinux 准备启动
    • 9. sysboot 启动内核
  • 二、direct boot cmd 手动配置直接启动
  • 三、other cmd 其他辅助命令
    • 1. read config 读取
    • 2. env_check 环境检查
    • 3. scan_m4fw 检查是否有M4 固件
    • 4. scan_overlays 检查 overlays 配置文件

此文描述了u-boot是通过什么样的过程进入linux内核启动的

一、U-Boot启动流程

boot -> bootcmd_stm32mp -> distro_bootcmd -> bootcmd_mmc1 -> mmc_boot -> scan_dev_for_boot_part -> scan_dev_for_boot -> scan_dev_for_extlinux -> boot_extlinux -> sysboot -> do_sysboot(sysboot.c)

1. bootcmd_stm32mp 确定当前设备

  1. 打印当前启动设备
  2. 判断设备启动类型后(烧录usb|serial,启动emmc|nand|nor),设置环境变量boot_targets
  3. 执行 distro_bootcmd
    env_check
echo "Boot over ${boot_device}${boot_instance}!"
if test ${boot_device} = serial || test ${boot_device} =usb; thenstm32prog ${boot_device} ${boot_instance}
elserun env_checkif test ${boot_device} = mmc; thenenv set boot_targets "mmc${boot_instance}"fiif test ${boot_device} = nand || test ${boot_device} = spi-nand; thenenv set boot_targets ubifs0fiif test ${boot_device} = nor; thenenv set boot_targets mmc0firun distro_bootcmd
fi

2. distro_bootcmd 进入当前设备启动

1.当前使用的emmc,执行bootcmd_mmc1

for target in ${boot_targets}; dorun bootcmd_${target}
done

3. bootcmd_mmc1 设置当前设备号

bootcmd_mmc1=devnum=1
run mmc_boot

4. mmc_boot 设置当前设备类型

if mmc dev ${devnum}; thendevtype=mmcrun scan_dev_for_boot_part
fi

5. scan_dev_for_boot_part 扫描设备分区

    1. 检查可引导的设备分区
    1. fstype 检查分区的文件系统类型,默认ext4
    1. 执行 scan_dev_for_boot
part list ${devtype} ${devnum} -bootable devplist;
env exists devplist || setenv devplist 1;
for distro_bootpart in ${devplist}; doif fstype ${devtype} ${devnum}:${distro_bootpart} bootfstypethenrun scan_dev_for_bootfi
done
setenv devplist

6. scan_dev_for_boot 扫描指定分区

  • 1.选择 uboot 启动图像
  • 2.执行 scan_dev_for_extlinux
run select_lcd_id;
echo Scanning ${devtype} ${devnum}:${distro_bootpart}...
for prefix in ${boot_prefixes}; dorun scan_dev_for_extlinuxrun scan_dev_for_scripts
done
run scan_dev_for_efi

7. scan_dev_for_extlinux 查找指定分区的配置文件

    1. 查找配置文件
    1. prefix的值 /mmc1_
    1. ${prefix}${boot_syslinux_conf} -> /mmc1_extlinux/stm32mp135d-aaron_extlinux.conf
if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; thenecho Found ${prefix}${boot_syslinux_conf}run boot_extlinuxecho SCRIPT FAILED: continuing...
fi

8. boot_extlinux 准备启动

scan_m4fw
scan_overlays

run scan_m4fw;
run scan_overlays;
sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}

9. sysboot 启动内核

sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}

二、direct boot cmd 手动配置直接启动

prefix=/mmc1_
devtype=mmc
devnum=1
distro_bootpart=4
scriptaddr=0xc4100000
boot_syslinux_conf=extlinux/stm32mp135d-aaron_extlinux.conf

确定所有配置后,直接运行:

sysboot mmc 1:4 any 0xc4100000 /mmc1_extlinux/stm32mp135d-aaron_extlinux.conf

三、other cmd 其他辅助命令

1. read config 读取

ext4load mmc 1:4 c4100000 /mmc1_extlinux/stm32mp135d-aaron_extlinux.confmd c4100000
md.b c4100000 288

2. env_check 环境检查

env_check 的作用是在引导过程中检查环境变量是否被修改,并在需要时将其保存到持久存储中,以确保修改的环境变量在下次引导时仍然有效
-p: 显示环境变量的名称和值。
-d: 显示默认环境变量的名称和值。
-q: 静默模式,即不显示不必要的信息。

if env info -p -d -q; then env save; fi

3. scan_m4fw 检查是否有M4 固件

    1. 扫描设备上是否存在 M4 固件(Firmware)
if test -e ${devtype} ${devnum}:${distro_bootpart} ${m4fw_name}; thenecho Found M4 FW $m4fw_nameif load ${devtype} ${devnum}:${distro_bootpart} ${m4fw_addr} ${m4fw_name}; thenrun boot_m4fwfi
fi

4. scan_overlays 检查 overlays 配置文件

    1. 设置配置文件
iftest -e ${devtype} ${devnum}:${distro_bootpart} /overlays/overlays.txt && load ${devtype} ${devnum}:${distro_bootpart} ${loadaddr} /overlays/overlays.txt && env import -t ${loadaddr} ${filesize}
thenecho loaded overlay.txt: ${overlay}run ov_initrun ov_apply
fi

能力一般,水平有限,知识浅薄,如果能帮到您,那我感到很荣幸

这篇关于stm32mp135d u-boot 引导流程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/951946

相关文章

4-Springboot集成FLOWABLE之流程驳回

目录标题 演示地址效果功能后端代码补充 演示地址 效果 功能 默认驳回到上一节点 后端代码 flowable自带驳回功能, 在源码ProcessInstanceResource.class下已有该功能,不需要自己额外去写 @ApiOperation(value = "Change the state a process instance", tags = { "Pr

spring boot中数据验证validated的使用

前言 spring-boot中在Controller层里面可以用@validated来校验数据再进入业务逻辑层,如果数据异常则会统一抛出异常,方便异常中心统一处理。 比如,我们判断一个输入的用户名长度限制以及密码的正则验证. 使用流程 1.Controller层数据使用@validated注解 @PostMapping("/userLogin")@ResponseBodypublic

Spring Boot构建应用开发规范

1.规范的意义和作用 •编码规范可以最大限度的提高团队开发的合作效率 •编码规范可以尽可能的减少一个软件的维护成本 , 并且几乎没有任何一个软件,在其整个生命周期中,均由最初的开发人员来维护 •编码规范可以改善软件的可读性,可以让开发人员尽快而彻底地理解新的代码 •规范性编码还可以让开发人员养成好的编码习惯,甚至锻炼出更加严谨的思维 2.代码仓库规范 2.1公共组件 •公共组件通常指

spring boot 启动FreeMarkerAutoConfiguration报错

问题呈现 搭建好springboot项目后启动,启动过程中出现如下报错: Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplat

Spring Boot 多模块项目创建

一.前言 maven多模块项目通常由一个父模块和若干个子模块构成,每个模块都对应着一个pom.xml。它们之间通过继承和聚合(也称作多模块)相互关联。多模块适用于一些比较大的项目,通过合理的模块拆分,实现代码的复用,便于维护和管理。例如Dubbo项目的多模块创建 二.创建项目 1.创建父级项目 一、在界面左上角选择File->New->Project后,选择Spring Initializ

MYSQL的流程控制语句

一、准备数据 create database ifTest;use ifTest;create table test(id int primary key auto_increment,typeId int not null comment '产品类型:1-普通商品 2-礼品卡 3-非卖品',productName varchar(50) not null comment '产品名称');

Win端交叉编译鸿蒙Ohos Native层第三方库流程

1. 概述 鸿蒙端SDK开发需要依赖使用到的三方库(如OpenCV、其他C++库等),以下为Windows端交叉编译Ohos端三方库流程 2. 准备工作 与Android NDK交叉编译相类似,我们首先需要下载OpenHarmony NDK(包含在OpenHarmony SDK中),这里笔者使用IDE中自带NDK进行操作。 DevEco Studio下载地址: https://develo

Spring Boot代码案例(计算器、登录、留言板)

文章目录 一、计算器二、登录2.1 判断账号密码是否正确2.2 根据不同的用户作出不同反应 三、留言板3.1 提交数据3.2 展示所有数据 四、Lombok 工具包4.1 场景介绍4.2 如何使用 五、Edit Starters插件六、项目如何Debug七、项目命名规范 一、计算器 导入前端文件后端代码: @RestController@RequestMapping("/ca

PFX证书颁发流程

PFX证书颁发流程 PFX证书(也称为PKCS#12证书)的生成流程通常涉及以下步骤1. 生成RSA密钥对:2. 生成证书签名请求(CSR):3. 向证书颁发机构(CA)申请证书:4. 接收并安装公钥证书:5. 生成PFX文件:6. 验证PFX文件: PFX证书(也称为PKCS#12证书)的生成流程通常涉及以下步骤 1. 生成RSA密钥对: 使用OpenSSL或其他加密库,生

Day 33 流程控制

一:条件测试 1.语法格式 格式1: test 条件表达式格式2: [ 条件表达式 ]格式3: [[ 条件表达式 ]] // 条件表达式中有&&,||和;时使用 2.文件测试 [ -e dir|file ] //根据返回值判断,目录或文件是否存在[ -d dir ] //根据返回值判断,目录是否存在[ -f file ] //根据返回值判断,文件是否存在[ -r