stm32mp135d u-boot 引导流程

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

本文主要是介绍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

相关文章

基于 Cursor 开发 Spring Boot 项目详细攻略

《基于Cursor开发SpringBoot项目详细攻略》Cursor是集成GPT4、Claude3.5等LLM的VSCode类AI编程工具,支持SpringBoot项目开发全流程,涵盖环境配... 目录cursor是什么?基于 Cursor 开发 Spring Boot 项目完整指南1. 环境准备2. 创建

通过Docker容器部署Python环境的全流程

《通过Docker容器部署Python环境的全流程》在现代化开发流程中,Docker因其轻量化、环境隔离和跨平台一致性的特性,已成为部署Python应用的标准工具,本文将详细演示如何通过Docker容... 目录引言一、docker与python的协同优势二、核心步骤详解三、进阶配置技巧四、生产环境最佳实践

MyBatis分页查询实战案例完整流程

《MyBatis分页查询实战案例完整流程》MyBatis是一个强大的Java持久层框架,支持自定义SQL和高级映射,本案例以员工工资信息管理为例,详细讲解如何在IDEA中使用MyBatis结合Page... 目录1. MyBATis框架简介2. 分页查询原理与应用场景2.1 分页查询的基本原理2.1.1 分

redis-sentinel基础概念及部署流程

《redis-sentinel基础概念及部署流程》RedisSentinel是Redis的高可用解决方案,通过监控主从节点、自动故障转移、通知机制及配置提供,实现集群故障恢复与服务持续可用,核心组件包... 目录一. 引言二. 核心功能三. 核心组件四. 故障转移流程五. 服务部署六. sentinel部署

SpringBoot集成XXL-JOB实现任务管理全流程

《SpringBoot集成XXL-JOB实现任务管理全流程》XXL-JOB是一款轻量级分布式任务调度平台,功能丰富、界面简洁、易于扩展,本文介绍如何通过SpringBoot项目,使用RestTempl... 目录一、前言二、项目结构简述三、Maven 依赖四、Controller 代码详解五、Service

Spring Boot 整合 SSE(Server-Sent Events)实战案例(全网最全)

《SpringBoot整合SSE(Server-SentEvents)实战案例(全网最全)》本文通过实战案例讲解SpringBoot整合SSE技术,涵盖实现原理、代码配置、异常处理及前端交互,... 目录Spring Boot 整合 SSE(Server-Sent Events)1、简述SSE与其他技术的对

MyBatis-Plus 与 Spring Boot 集成原理实战示例

《MyBatis-Plus与SpringBoot集成原理实战示例》MyBatis-Plus通过自动配置与核心组件集成SpringBoot实现零配置,提供分页、逻辑删除等插件化功能,增强MyBa... 目录 一、MyBATis-Plus 简介 二、集成方式(Spring Boot)1. 引入依赖 三、核心机制

MySQL 临时表与复制表操作全流程案例

《MySQL临时表与复制表操作全流程案例》本文介绍MySQL临时表与复制表的区别与使用,涵盖生命周期、存储机制、操作限制、创建方法及常见问题,本文结合实例代码给大家介绍的非常详细,感兴趣的朋友跟随小... 目录一、mysql 临时表(一)核心特性拓展(二)操作全流程案例1. 复杂查询中的临时表应用2. 临时

Spring Boot项目如何使用外部application.yml配置文件启动JAR包

《SpringBoot项目如何使用外部application.yml配置文件启动JAR包》文章介绍了SpringBoot项目通过指定外部application.yml配置文件启动JAR包的方法,包括... 目录Spring Boot项目中使用外部application.yml配置文件启动JAR包一、基本原理

在 Spring Boot 中连接 MySQL 数据库的详细步骤

《在SpringBoot中连接MySQL数据库的详细步骤》本文介绍了SpringBoot连接MySQL数据库的流程,添加依赖、配置连接信息、创建实体类与仓库接口,通过自动配置实现数据库操作,... 目录一、添加依赖二、配置数据库连接三、创建实体类四、创建仓库接口五、创建服务类六、创建控制器七、运行应用程序八