Files
luban-lite-t3e-pro/doc/topics/sdk/boot/fitImage_2.html
2025-01-23 16:37:00 +08:00

229 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" data-whc_version="26.0">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="description" content="ArtInChip 项目中,将 Kernel Image 改为使用 FIT Image 的原因: 快速启动的需要 减少分区的需要 安全启动的需要 支持 RISCV 的需要 快速启动 D21x 的快速启动eMMC 的方案使用未压缩的 Image 速度最快SPINOR/SPINAND 使用压缩的 zImage 比较合适。 同时 U-Boot 加载 Kernel 最好只读取 Kernel Image ..."/><meta name="DC.rights.owner" content="(C) 版权 2025"/><meta name="copyright" content="(C) 版权 2025"/><meta name="generator" content="DITA-OT"/><meta name="DC.type" content="concept"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-05-28"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="fitImage_2"/><meta name="DC.language" content="zh-CN"/><title>使用 FIT Image</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/boot/fitImage_2.dita"/><meta name="wh-out-relpath" content="topics/sdk/boot/fitImage_2.html"/>
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/commons.css?buildId=2023110923"/>
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/topic.css?buildId=2023110923"/>
<script src="../../../webhelp/app/options/properties.js?buildId=20250121171154"></script>
<script src="../../../webhelp/app/localization/strings.js?buildId=2023110923"></script>
<script src="../../../webhelp/app/search/index/keywords.js?buildId=20250121171154"></script>
<script defer="defer" src="../../../webhelp/app/commons.js?buildId=2023110923"></script>
<script defer="defer" src="../../../webhelp/app/topic.js?buildId=2023110923"></script>
<link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-styles-web.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/notes.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-common.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-images.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/footnote.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-web-watermark.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/topic-body-list.css?buildId=2023110923"/></head>
<body id="fitImage_2" class="wh_topic_page frmBody">
<a href="#wh_topic_body" class="sr-only sr-only-focusable">
跳转到主要内容
</a>
<header class="navbar navbar-default wh_header">
<div class="container-fluid">
<div class="wh_header_flex_container navbar-nav navbar-expand-md navbar-dark">
<div class="wh_logo_and_publication_title_container">
<div class="wh_logo_and_publication_title">
<a href="http://www.artinchip.com" class=" wh_logo d-none d-sm-block "><img src="../../../company-logo-white.png" alt="RTOS SDK 使用指南SDK 指南文件"/></a>
<div class=" wh_publication_title "><a href="../../../index.html"><span class="booktitle"><span class="ph mainbooktitle">RTOS SDK 使用指南</span><span class="ph booktitlealt">SDK 指南文件</span></span></a></div>
</div>
</div>
<div class="wh_top_menu_and_indexterms_link collapse navbar-collapse" id="wh_top_menu_and_indexterms_link">
</div>
</div>
</div>
</header>
<div class=" wh_search_input navbar-form wh_topic_page_search search " role="form">
<form id="searchForm" method="get" role="search" action="../../../search.html"><div><input type="search" placeholder="搜索 " class="wh_search_textfield" id="textToSearch" name="searchQuery" aria-label="搜索查询" required="required"/><button type="submit" class="wh_search_button" aria-label="搜索"><span class="search_input_text">搜索</span></button></div></form>
</div>
<div class="container-fluid" id="wh_topic_container">
<div class="row">
<nav class="wh_tools d-print-none navbar-expand-md" aria-label="Tools">
<div data-tooltip-position="bottom" class=" wh_breadcrumb "></div>
<div class="wh_right_tools">
<button class="wh_hide_highlight" aria-label="切换搜索突出显示" title="切换搜索突出显示"></button>
<button class="webhelp_expand_collapse_sections" data-next-state="collapsed" aria-label="折叠截面" title="折叠截面"></button>
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="打印此页" aria-label="打印此页"></button></div>
</div>
</nav>
</div>
<div class="wh_content_area">
<div class="row">
<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12" id="wh_topic_body">
<button id="wh_close_topic_toc_button" class="close-toc-button d-none" aria-label="Toggle topic table of content" aria-controls="wh_topic_toc" aria-expanded="true">
<span class="close-toc-icon-container">
<span class="close-toc-icon"></span>
</span>
</button>
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic concept/concept topic concept" role="article" aria-labelledby="ariaid-title1"><span class="edit-link" style="font-size:12px; opacity:0.6; text-align:right; vertical-align:middle"><a target="_blank" href="http://172.16.35.88/tasks/jdssno1uvvbf2mltu9kb9v3if05d5gopuakboe8hlud18rma/edit/F:/aicdita/aicdita-cn/topics/sdk/boot/fitImage_2.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">使用 FIT Image</h1><div class="date inPage">28 May 2024</div><div style="color: gray;">
Read time: 2 minute(s)
</div><div class="- topic/body concept/conbody body conbody"><p class="- topic/p p" data-ofbid="d152701e22__20250121171612">ArtInChip 项目中,将 Kernel Image 改为使用 FIT Image 的原因:</p><ul class="- topic/ul ul" id="fitImage_2__ul_ebm_zdh_bzb" data-ofbid="fitImage_2__ul_ebm_zdh_bzb"><li class="- topic/li li" data-ofbid="d152701e25__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e27__20250121171612">快速启动的需要</p>
</li><li class="- topic/li li" data-ofbid="d152701e30__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e32__20250121171612">减少分区的需要</p>
</li><li class="- topic/li li" data-ofbid="d152701e35__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e37__20250121171612">安全启动的需要</p>
</li><li class="- topic/li li" data-ofbid="d152701e40__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e42__20250121171612">支持 RISCV 的需要</p>
</li></ul><section class="- topic/section section" id="fitImage_2__section_d5k_wpy_nbc" data-ofbid="fitImage_2__section_d5k_wpy_nbc"><h2 class="- topic/title title sectiontitle">快速启动</h2>
<p class="- topic/p p" data-ofbid="d152701e50__20250121171612">D21x 的快速启动eMMC 的方案使用未压缩的 Image 速度最快SPINOR/SPINAND 使用压缩的 zImage 比较合适。</p>
<p class="- topic/p p" data-ofbid="d152701e53__20250121171612">同时 U-Boot 加载 Kernel 最好只读取 Kernel Image 实际大小的数据,避免过多读取无关数据, 才能节省启动时间。</p>
<p class="- topic/p p" data-ofbid="d152701e56__20250121171612">U-Boot 加载 Kernel 时,无论 Image 还是 zImage都没有头信息因此即读取 Kernel Image
的大小需要根据实际编译生成的镜像大小进行修改。</p>
<p class="- topic/p p" data-ofbid="d152701e59__20250121171612">如果采用 FIT Image 则可以避免上述问题。</p>
<p class="- topic/p p" data-ofbid="d152701e63__20250121171612">生成的 FIT Image 有一个信息头U-Boot 可以先读取信息头的数据,得到 Image 大小,然后按照实际大小读取 剩下的 Kernel Image
数据:</p>
<ol class="- topic/ol ol" id="fitImage_2__ol_alx_zdh_bzb" data-ofbid="fitImage_2__ol_alx_zdh_bzb"><li class="- topic/li li" data-ofbid="d152701e67__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e69__20250121171612">从存储介质读取的数据可以做到尽可能的少</p>
</li><li class="- topic/li li" data-ofbid="d152701e72__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e74__20250121171612">开发者不需要手动修改读取的数据大小</p>
</li></ol>
<p class="- topic/p p" data-ofbid="d152701e78__20250121171612">当然是用了 FIT Image 之后,无论是使用压缩的 zImage/Image.gz 还是使用未压缩的 Image对启动流程/启动命令 都没有影响,开发者仅需修改
ITS 文件配置即可。</p>
</section><section class="- topic/section section" id="fitImage_2__section_gfv_xpy_nbc" data-ofbid="fitImage_2__section_gfv_xpy_nbc"><h2 class="- topic/title title sectiontitle">减少分区</h2>
<p class="- topic/p p" data-ofbid="d152701e86__20250121171612">在使用 FIT Image 之前Kernel 启动所需的 DTB 保存在一个独立的分区中。</p>
<p class="- topic/p p" data-ofbid="d152701e89__20250121171612">DTB 使用一个独立的分区保存对于 SPINOR/SPINAND 的方案而言是一种比较浪费空间的方式。</p>
<p class="- topic/p p" data-ofbid="d152701e92__20250121171612">对于 SPINOR 而言,一般存储空间都比较小,但是分区必须按照一个擦写单元进行,一般是 64KB 而 DTB 绝大多数在 32KB 以内。</p>
<p class="- topic/p p" data-ofbid="d152701e95__20250121171612">对于 SPINAND 而言,分区同样必须按照一个擦写块进行,一般是 128KB 或者 256KB 同时要考虑坏块的情况,需要多分配几个块进行备份。</p>
<p class="- topic/p p" data-ofbid="d152701e99__20250121171612">使用 FIT ImageKernel 所使用的 DTB 与 Kernel 一起进行打包,存放到同一个分区, 有利于提高存储空间的利用效率,同时分区划分更简单。</p>
</section><section class="- topic/section section" id="fitImage_2__section_ctn_ypy_nbc" data-ofbid="fitImage_2__section_ctn_ypy_nbc"><h2 class="- topic/title title sectiontitle">安全启动</h2>
<p class="- topic/p p" data-ofbid="d152701e107__20250121171612">在安全启动方案中,安全信任链的校验过程如下:</p>
<p class="- topic/p p" data-ofbid="d152701e110__20250121171612"><span class="+ topic/ph ui-d/menucascade ph menucascade"><span class="+ topic/ph ui-d/uicontrol ph uicontrol">BROM</span><abbr> &gt; </abbr><span class="+ topic/ph ui-d/uicontrol ph uicontrol">SPL</span><abbr> &gt; </abbr><span class="+ topic/ph ui-d/uicontrol ph uicontrol">U-Boot</span><abbr> &gt; </abbr><span class="+ topic/ph ui-d/uicontrol ph uicontrol">Kernel</span><abbr> &gt; </abbr><span class="+ topic/ph ui-d/uicontrol ph uicontrol">RootFS</span></span></p>
<p class="- topic/p p" data-ofbid="d152701e123__20250121171612">按照上述顺序逐级进行安全校验。</p>
<p class="- topic/p p" data-ofbid="d152701e126__20250121171612">在 SPL 校验 U-Boot 和 U-Boot 校验 Kernel 的阶段,如果使用 FIT Image则已经有成熟的安全校验方案
并且启动处理流程与非安全方案基本一致。不采用 FIT Image则安全方案和非安全方案所采用的启动流程 差异性比较大,不利于方案的开发和维护。</p>
</section><section class="- topic/section section" id="fitImage_2__section_mkl_zpy_nbc" data-ofbid="fitImage_2__section_mkl_zpy_nbc"><h2 class="- topic/title title sectiontitle">支持 RISCV</h2>
<p class="- topic/p p" data-ofbid="d152701e134__20250121171612">RISCV 需要 OpenSBI 协助进行启动OpenSBI 运行在 U-Boot 之前。</p>
<p class="- topic/p p" data-ofbid="d152701e137__20250121171612">启动流程:<span class="+ topic/ph ui-d/menucascade ph menucascade"><span class="+ topic/ph ui-d/uicontrol ph uicontrol">BROM</span><abbr> &gt; </abbr><span class="+ topic/ph ui-d/uicontrol ph uicontrol">SPL</span><abbr> &gt; </abbr><span class="+ topic/ph ui-d/uicontrol ph uicontrol">OpenSBI</span><abbr> &gt; </abbr><span class="+ topic/ph ui-d/uicontrol ph uicontrol">U-Boot</span><abbr> &gt; </abbr><span class="+ topic/ph ui-d/uicontrol ph uicontrol">Kernel</span></span></p>
<p class="- topic/p p" data-ofbid="d152701e151__20250121171612">RISCV 版本的 SPL 在加载运行 OpenSBI 和 U-Boot 时,仅支持使用 FIT Image 即需要将下列几个数据打包为一个 ITB
文件(uboot.itb)</p>
<ul class="- topic/ul ul" id="fitImage_2__ul_ncj_b2h_bzb" data-ofbid="fitImage_2__ul_ncj_b2h_bzb"><li class="- topic/li li" data-ofbid="d152701e155__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e157__20250121171612">OpenSBI</p>
</li><li class="- topic/li li" data-ofbid="d152701e160__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e162__20250121171612">U-Boot</p>
</li><li class="- topic/li li" data-ofbid="d152701e165__20250121171612">
<p class="- topic/p p" data-ofbid="d152701e167__20250121171612">DTB</p>
</li></ul>
<p class="- topic/p p" data-ofbid="d152701e172__20250121171612">SPL 加载 uboot.itb读取 DTB 和 U-Boot 到对应的位置,然后运行 OpenSBI通过 OpenSBI 跳转到 U-Boot。启动的 DTB 是
OpenSBI 和 U-Boot 共用。</p>
<p class="- topic/p p" data-ofbid="d152701e175__20250121171612">Kernel 也使用 FIT Image可以简化 Image 的种类。</p>
</section></div></article></main></div>
</div>
<nav role="navigation" id="wh_topic_toc" aria-label="On this page" class="col-lg-2 d-none d-lg-block navbar d-print-none">
<div id="wh_topic_toc_content">
<div class=" wh_topic_toc "><div class="wh_topic_label">在本页上</div><ul><li class="section-item"><div class="section-title"><a href="#fitImage_2__section_d5k_wpy_nbc" data-tocid="fitImage_2__section_d5k_wpy_nbc">快速启动</a></div></li><li class="section-item"><div class="section-title"><a href="#fitImage_2__section_gfv_xpy_nbc" data-tocid="fitImage_2__section_gfv_xpy_nbc">减少分区</a></div></li><li class="section-item"><div class="section-title"><a href="#fitImage_2__section_ctn_ypy_nbc" data-tocid="fitImage_2__section_ctn_ypy_nbc">安全启动</a></div></li><li class="section-item"><div class="section-title"><a href="#fitImage_2__section_mkl_zpy_nbc" data-tocid="fitImage_2__section_mkl_zpy_nbc">支持 RISCV</a></div></li></ul></div>
</div>
</nav>
</div>
</div>
</div>
<footer class="navbar navbar-default wh_footer">
<div class=" footer-container mx-auto ">
<title>footer def</title>
<style><!--
.p1 {
font-family: FangZhengShuSong, Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
.p3 {
font-family: "Lucida Console", "Courier New", monospace;
}
--></style>
<div class="webhelp.fragment.footer">
<p class="p1">Copyright © 2019-2024 广东匠芯创科技有限公司. All rights reserved.</p>
</div><div>
<div class="generation_time">
Update Time: 2025-01-21
</div>
</div>
</div>
</footer>
<div id="go2top" class="d-print-none">
<span class="oxy-icon oxy-icon-up"></span>
</div>
<div id="modal_img_large" class="modal">
<span class="close oxy-icon oxy-icon-remove"></span>
<div id="modal_img_container"></div>
<div id="caption"></div>
</div>
<script src="${pd}/publishing/publishing-styles-AIC-template/js/custom.js" defer="defer"></script>
</body>
</html>