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

539 lines
57 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="SPINAND OTA 主要涉及以下参数配置,以 d211_demo128_nand 的配置流程为例: 主系统 :配置文件 d211_demo128_nand_defconfig 。 1. target //demo128_nand/image_cfg.json //分区配置和烧录 2. target //common/env.txt //U-Boot 环境变量 3. target ..."/><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="topic"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-12-04"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><title>SPINAND OTA 参数配置</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/ota/ota_spinand_config_guide.dita"/><meta name="wh-out-relpath" content="topics/sdk/ota/ota_spinand_config_guide.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="id" 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 topic" 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/ota/ota_spinand_config_guide.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">SPINAND OTA 参数配置</h1><div class="date inPage">4 Dec 2024</div><div style="color: gray;">
Read time: 9 minute(s)
</div><div class="- topic/body body"><div class="- topic/p p" data-ofbid="d91176e17__20250121171530">SPINAND OTA 主要涉及以下参数配置,以 <code class="+ topic/ph pr-d/codeph ph codeph">d211_demo128_nand</code> 的配置流程为例:<ul class="- topic/ul ul" id="id__ul_mpk_d24_hdc" data-ofbid="id__ul_mpk_d24_hdc"><li class="- topic/li li" data-ofbid="d91176e23__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e25__20250121171530"><strong class="+ topic/ph hi-d/b ph b"><a class="- topic/xref xref" href="ota_spinand_config_guide.html#id__section_ckb_kg4_hdc">主系统</a></strong>:配置文件
<span class="+ topic/ph sw-d/filepath ph filepath">d211_demo128_nand_defconfig</span><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_kmq_nqw_fdc" data-ofbid="id__codeblock_kmq_nqw_fdc"><span class="hl-number">1.</span> target<em class="hl-comment">//demo128_nand/image_cfg.json //分区配置和烧录</em>
<span class="hl-number">2.</span> target<em class="hl-comment">//common/env.txt //U-Boot 环境变量</em>
<span class="hl-number">3.</span> target<em class="hl-comment">//demo128_nand/rootfs_overlay/etc/fw_env.config //环境变量分区信息</em>
<span class="hl-number">4.</span> target<em class="hl-comment">//demo128_nand/rootfs_overlay/etc/swupdate_main //挂载 OTA 本地升级文件系统</em>
<span class="hl-number">5.</span> target<em class="hl-comment">//demo128_nand/swupdate/sw-description //OTA 策略描述文件</em>
<span class="hl-number">6.</span> target<em class="hl-comment">//demo128_nand/swupdate/sw-images.cfg //打包相应文件到 OTA 升级包中</em>
<span class="hl-number">7.</span> target/configs/_demo128_nand_defconfig <em class="hl-comment">//板级配置文件</em></pre></div>
</li><li class="- topic/li li" data-ofbid="d91176e37__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e39__20250121171530"><strong class="+ topic/ph hi-d/b ph b"><a class="- topic/xref xref" href="ota_spinand_config_guide.html#id__section_q3q_hg4_hdc">Recovery
系统</a></strong>:配置文件
<span class="+ topic/ph sw-d/filepath ph filepath">d211_ota_defconfig</span><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_fsw_nqw_fdc" data-ofbid="id__codeblock_fsw_nqw_fdc"><span class="hl-number">1.</span> target<em class="hl-comment">//ota/rootfs_overlay/etc/fw_env.config //环境变量分区信息</em>
<span class="hl-number">2.</span> target<em class="hl-comment">//ota/rootfs_overlay/etc/init.d/S91swupdate_ota //开机自动挂载 OTA 分区与启动 OTA 升级程序</em>
<span class="hl-number">3.</span> target/target/configs/_ota_defconfig <em class="hl-comment">//OTA 配置文件</em></pre></div>
</li><li class="- topic/li li" data-ofbid="d91176e51__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e53__20250121171530">主系统与 Recovery
系统<strong class="+ topic/ph hi-d/b ph b">启动脚本文件</strong><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_j3m_4qw_fdc" data-ofbid="id__codeblock_j3m_4qw_fdc">package/third-party/swupdate/S90swupdate <em class="hl-comment">//开机后台执行 SWUpdate 程序</em></pre></div>
</li></ul></div><section class="- topic/section section" id="id__section_q3q_hg4_hdc" data-ofbid="id__section_q3q_hg4_hdc"><h2 class="- topic/title title sectiontitle">Recovery 系统配置</h2>
<div class="- topic/p p" data-ofbid="d91176e66__20250121171530">
<div class="- topic/note note tip note_tip admonition tip" id="id__note_ncz_hg4_hdc" data-ofbid="id__note_ncz_hg4_hdc"><span class="note__title">提示:</span>
<p class="- topic/p p" data-ofbid="d91176e70__20250121171530">为了简化使用Recovery 系统的 OTA 相关配置已打开,无需用户手动配置</p>
</div>
<ol class="- topic/ol ol" id="id__ol_syw_dh4_hdc" data-ofbid="id__ol_syw_dh4_hdc"><li class="- topic/li li" data-ofbid="d91176e75__20250121171530">
<div class="- topic/div div section" id="id__swupdate">
<strong class="+ topic/ph hi-d/b ph b">SWUpdate 包配置</strong>
<p class="- topic/p p" data-ofbid="d91176e82__20250121171530">Recovery 系统配置文件路径为
<span class="+ topic/ph sw-d/filepath ph filepath">target/configs/d211_ota_defconfig</span></p><ol class="- topic/ol ol" type="a" id="id__ol_whc_33y_3dc" data-ofbid="id__ol_whc_33y_3dc"><li class="- topic/li li" data-ofbid="d91176e87__20250121171530">进入到 Recovery 系统 SDK
生产环境:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_pcz_hg4_hdc" data-ofbid="id__pre_pcz_hg4_hdc">lunch ota
</pre></li><li class="- topic/li li" data-ofbid="d91176e91__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e93__20250121171530">在 Luban 根目录下执行命令 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">make m</span> 进入 Luban SDK
功能配置。</p>
</li><li class="- topic/li li" data-ofbid="d91176e99__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e101__20250121171530">按如下选择:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_rcz_hg4_hdc" data-ofbid="id__pre_rcz_hg4_hdc">Third-party packages ---&gt;
-*- libubootenv ---&gt;
-*- libconfig ---&gt;
-*- libcurl ---&gt;
[*] swupdate ---&gt;
[*] mtd, jffs2 and ubi/ubifs tools ---&gt; <em class="hl-comment">//SPINAND 平台需要</em>
</pre></div>
</li></ol></div>
</li><li class="- topic/li li" data-ofbid="d91176e107__20250121171530">
<div class="- topic/div div section" id="id__rootfs-initramfs">
<strong class="+ topic/ph hi-d/b ph b">配置 RootFS 为 initramfs</strong>
<ol class="- topic/ol ol" type="a" id="id__ol_lzb_k3y_3dc" data-ofbid="id__ol_lzb_k3y_3dc"><li class="- topic/li li" data-ofbid="d91176e115__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e117__20250121171530">默认切换 RootFS 配置为 initramfs执行命令 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">make m</span></p>
<div class="- topic/p p" data-ofbid="d91176e123__20250121171530">配置如下:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_tcz_hg4_hdc" data-ofbid="id__pre_tcz_hg4_hdc">Filesystem images ---&gt;
RootFS images ---&gt;
-*- cpio the root filesystem (<strong class="hl-keyword">for</strong> use as an initial RAM filesystem)
Compression method (gzip) ---&gt;
[*] initial RAM filesystem linked into linux kernel
</pre></div>
</li><li class="- topic/li li" data-ofbid="d91176e128__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e130__20250121171530">默认将 initramfs 编译进 Kernel执行命令<span class="+ topic/keyword sw-d/cmdname keyword cmdname">make km</span></p>
<div class="- topic/p p" data-ofbid="d91176e135__20250121171530">配置如下:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_vcz_hg4_hdc" data-ofbid="id__pre_vcz_hg4_hdc">General setup ---&gt;
[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
[*] Support initial ramdisk/ramfs compressed using gzip
</pre></div>
</li></ol></div>
</li><li class="- topic/li li" data-ofbid="d91176e141__20250121171530">
<div class="- topic/div div section" id="id__id1">
<strong class="+ topic/ph hi-d/b ph b">编译 Recovery 系统</strong>
<ol class="- topic/ol ol arabic simple" type="a" id="id__ol_xcz_hg4_hdc" data-ofbid="id__ol_xcz_hg4_hdc"><li class="- topic/li li" data-ofbid="d91176e149__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e151__20250121171530">检查或配置完成后,执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">make m</span> 命令编译 Recovery 系统。</p>
<p class="- topic/p p" data-ofbid="d91176e157__20250121171530">编译完成后,<code class="+ topic/ph pr-d/codeph ph codeph">output/d211_ota/images</code> 目录下会生成 Recovery
系统的打包文件 <span class="+ topic/ph sw-d/filepath ph filepath">Recovery.gz</span></p>
</li><li class="- topic/li li" data-ofbid="d91176e166__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e168__20250121171530"><span class="+ topic/ph sw-d/filepath ph filepath">Recovery.gz</span> 为 d211 NAND 平台通用 Recovery
系统。</p>
</li><li class="- topic/li li" data-ofbid="d91176e173__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e175__20250121171530">拷贝 <span class="+ topic/ph sw-d/filepath ph filepath">Recovery.gz</span>
<span class="+ topic/ph sw-d/filepath ph filepath">target/d211/common</span> 目录下。</p>
<p class="- topic/p p" data-ofbid="d91176e184__20250121171530">各板级文件编译时会打包 <span class="+ topic/ph sw-d/filepath ph filepath">Recovery.gz</span> 到最终的镜像文件中,从而烧录到
<code class="+ topic/ph pr-d/codeph ph codeph">recovery 分区</code> 中。</p>
</li></ol></div>
</li></ol>
</div>
</section><section class="- topic/section section" id="id__section_ckb_kg4_hdc" data-ofbid="id__section_ckb_kg4_hdc"><h2 class="- topic/title title sectiontitle">主系统配置</h2>
<ol class="- topic/ol ol" id="id__ol_jvq_2h4_hdc" data-ofbid="id__ol_jvq_2h4_hdc"><li class="- topic/li li" data-ofbid="d91176e202__20250121171530">
<div class="- topic/div div section" id="id__id2"><strong class="+ topic/ph hi-d/b ph b">SWUpdate 包配置</strong>
<ol class="- topic/ol ol" type="a" id="id__ol_adh_gh4_hdc" data-ofbid="id__ol_adh_gh4_hdc"><li class="- topic/li li" data-ofbid="d91176e209__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e211__20250121171530">进入主系统 SDK
生产环境:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_xkb_kg4_hdc" data-ofbid="id__pre_xkb_kg4_hdc">lunch d211_demo128_nand
</pre></div>
</li><li class="- topic/li li" data-ofbid="d91176e216__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e218__20250121171530">在 Luban 根目录下执行配置命令进入 Luban SDK
功能配置:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_ykb_kg4_hdc" data-ofbid="id__pre_ykb_kg4_hdc">make m
</pre></div>
</li><li class="- topic/li li" data-ofbid="d91176e223__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e225__20250121171530">按如下配置选择:<div class="- topic/div div highlight-kconfig notranslate">
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_zkb_kg4_hdc" data-ofbid="id__pre_zkb_kg4_hdc">Third-party packages ---&gt;
-*- libubootenv ---&gt;
-*- libconfig ---&gt;
-*- libcurl ---&gt;
[*] swupdate ---&gt;
[*] mtd, jffs2 and ubi/ubifs tools ---&gt; <em class="hl-comment">//SPINAND 平台需要</em>
</pre>
</div></div>
</li><li class="- topic/li li" data-ofbid="d91176e233__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e235__20250121171530">查看 SWUpdate
库相关配置如下:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_alb_kg4_hdc" data-ofbid="id__pre_alb_kg4_hdc">[*] use prebuilt binary instead of building from source(package/third-party/swupdate/luban_swupdate.config) swupdate configuration file
[*] swupdate webserver
</pre></div>
</li><li class="- topic/li li" data-ofbid="d91176e240__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e242__20250121171530">查看 SWUpdate 相关配置,需要先关闭 SWUpdate
预编译功能:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_blb_kg4_hdc" data-ofbid="id__pre_blb_kg4_hdc">[ ] use prebuilt binary instead of building from source</pre></div>
</li><li class="- topic/li li" data-ofbid="d91176e247__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e249__20250121171530">执行命令查看 SWUpdate
相关配置:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_clb_kg4_hdc" data-ofbid="id__pre_clb_kg4_hdc">make swupdate-menuconfig
</pre></div>
<div class="- topic/p p" data-ofbid="d91176e254__20250121171530">SWUpdate 包重要配置信息解析:<div class="table-container"><table class="- topic/table table docutils align-default frame-all" id="id__table_dlb_kg4_hdc" data-ofbid="id__table_dlb_kg4_hdc" data-cols="2"><caption></caption><colgroup><col style="width:47.16981132075471%"/><col style="width:52.83018867924528%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row row-odd"><th class="- topic/entry entry head colsep-1 rowsep-1" id="id__table_dlb_kg4_hdc__entry__1">文件</th><th class="- topic/entry entry head colsep-0 rowsep-1" id="id__table_dlb_kg4_hdc__entry__2">说明</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row row-even"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_UBOOT=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">支持 U-Boot</td></tr><tr class="- topic/row row-odd"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_DOWNLOAD=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">使能通过 libcurl 的方式下载程序</td></tr><tr class="- topic/row row-even"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_DOWNLOAD_SSL=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">在使用 libcurl 时使能 ssl 校验</td></tr><tr class="- topic/row row-odd"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_WEBSERVER=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">编译 web 服务器, 设备端作为服务器使用</td></tr><tr class="- topic/row row-even"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_HASH_VERIFY=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">解析升级包时使能 sha256 校验</td></tr><tr class="- topic/row row-odd"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_BOOTLOADERHANDLER=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">在升级过程中允许修改 U-Boot 环境变量</td></tr><tr class="- topic/row row-even"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_CFI=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">允许给 flash 烧录程序</td></tr><tr class="- topic/row row-odd"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_RAW=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">默认烧录方式, 给 eMMC 使用</td></tr><tr class="- topic/row row-even"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_SHELLSCRIPTHANDLER=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">支持 shell 脚本升级</td></tr><tr class="- topic/row row-odd"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_UBIVOL=y</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_dlb_kg4_hdc__entry__2">支持 UBI 分区升级</td></tr><tr class="- topic/row row-even"><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_dlb_kg4_hdc__entry__1">CONFIG_UBIBLACKLIST=”0 1”</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="id__table_dlb_kg4_hdc__entry__2">执行 ubiattach 时跳过的分区号<p class="- topic/p p" data-ofbid="d91176e322__20250121171530">如果执行 ubiattach
时跳过的分区号与实际不匹配,则执行 ubiattach
时会报错信息,但不影响正常升级过程。</p></td></tr></tbody></table></div></div>
<div class="- topic/note note note note_note" id="id__note_x2v_fl5_4dc" data-ofbid="id__note_x2v_fl5_4dc"><span class="note__title">注:</span> 如果需要重新配置 SWUpdate 参数,必须关掉 SWUpdate
预编译功能。关于预编译相关说明,可参考<a class="- topic/xref xref" href="../advanced/configure-precompilation-package.html">配置预编译包</a></div>
</li></ol></div>
</li><li class="- topic/li li" data-ofbid="d91176e333__20250121171530">
<div class="- topic/div div section" id="id__id4">
<strong class="+ topic/ph hi-d/b ph b">增加 recovery 分区并烧录程序</strong>
<p class="- topic/p p" data-ofbid="d91176e340__20250121171530"><span class="+ topic/ph sw-d/filepath ph filepath">image_cfg.json</span> 中增加 <code class="+ topic/ph pr-d/codeph ph codeph">recovery 分区</code>,烧录
Recovery
系统镜像:</p><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_glb_kg4_hdc" data-ofbid="id__pre_glb_kg4_hdc"><span class="hl-string">"kernel"</span>: { <span class="hl-string">"size"</span>: <span class="hl-string">"8m"</span> }, <em class="hl-comment">//由于资源有限,为了演示本地升级,适当裁剪 kernel 分区</em>
+ <span class="hl-string">"recovery"</span>: { <span class="hl-string">"size"</span>: <span class="hl-string">"12m"</span> }, <em class="hl-comment">//在 kernel 分区后面增加 recovery 分区</em>
<span class="hl-string">"kernel"</span>: {
<span class="hl-string">"file"</span>: <span class="hl-string">"kernel.itb"</span>,
<span class="hl-string">"attr"</span>: [<span class="hl-string">"mtd"</span>, <span class="hl-string">"required"</span>], <em class="hl-comment">//在 kernel 镜像烧录配置后面添加 recovery 镜像烧录配置</em>
<span class="hl-string">"part"</span>: [<span class="hl-string">"kernel"</span>]
},
+ <span class="hl-string">"recovery"</span>: {
+ <span class="hl-string">"file"</span>: <span class="hl-string">"recovery.itb"</span>, <em class="hl-comment">//将 recovery.itb 镜像文件烧录到 recovery 分区里面</em>
+ <span class="hl-string">"attr"</span>: [<span class="hl-string">"mtd"</span>, <span class="hl-string">"required"</span>],
+ <span class="hl-string">"part"</span>: [<span class="hl-string">"recovery"</span>]
+ },
<span class="hl-string">"kernel.itb"</span>: {
<span class="hl-string">"its"</span>: <span class="hl-string">"kernel.its"</span> <em class="hl-comment">//在 kernel 镜像生成方法后面增加 recovery 镜像生成方法</em>
},
+ <span class="hl-string">"recovery.itb"</span>: {
+ <span class="hl-string">"its"</span>: <span class="hl-string">"recovery.its"</span> <em class="hl-comment">//配置 recovery.itb 文件通过 recovery.its 指导编译完成</em>
+ },
</pre><ol class="- topic/ol ol arabic simple" type="a" id="id__ol_ilb_kg4_hdc" data-ofbid="id__ol_ilb_kg4_hdc"><li class="- topic/li li" data-ofbid="d91176e351__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e353__20250121171530"><span class="+ topic/ph sw-d/filepath ph filepath">image</span> 目录中检查
<span class="+ topic/ph sw-d/filepath ph filepath">recovery.itb</span> 文件是否生成。</p>
</li><li class="- topic/li li" data-ofbid="d91176e362__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e364__20250121171530">通过升级信息判断 <span class="+ topic/ph sw-d/filepath ph filepath">recovery.itb</span> 是否烧录到 recovery 分区。</p>
</li></ol></div>
</li><li class="- topic/li li" data-ofbid="d91176e371__20250121171530">
<div class="- topic/div div section" id="id__ota-ota">
<strong class="+ topic/ph hi-d/b ph b">增加 OTA 分区烧录 OTA 升级包</strong>
<div class="- topic/note note tip note_tip admonition tip" id="id__note_jlb_kg4_hdc" data-ofbid="id__note_jlb_kg4_hdc"><span class="note__title">提示:</span>
<p class="- topic/p p" data-ofbid="d91176e380__20250121171530">本操作是为了验证本地 OTA 使用,如使用网络 OTA 或 SD 卡 OTA无需执行此操作</p>
</div><ol class="- topic/ol ol" type="a" id="id__ol_vgh_qh4_hdc" data-ofbid="id__ol_vgh_qh4_hdc"><li class="- topic/li li" data-ofbid="d91176e384__20250121171530">
<div class="- topic/div div section" id="id__ota">
<strong class="+ topic/ph hi-d/b ph b">增加 OTA 分区</strong>
<p class="- topic/p p" data-ofbid="d91176e391__20250121171530">
<span class="+ topic/ph sw-d/filepath ph filepath">target/d211/demo128_nand/image_cfg.json</span>
文件中修改下列信息:</p><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_klb_kg4_hdc" data-ofbid="id__pre_klb_kg4_hdc"><span class="hl-string">"ubiroot"</span>: {
<span class="hl-string">"size"</span>: <span class="hl-string">"40m"</span>, <em class="hl-comment">//适当裁剪主系统文件系统大小,确保不超总 FLASH 的大小</em>
<span class="hl-string">"ubi"</span>: { <em class="hl-comment">// Volume in UBI device</em>
<span class="hl-string">"rootfs"</span>: { <span class="hl-string">"size"</span>: <span class="hl-string">"-"</span> },
},
},
<span class="hl-string">"ubisystem"</span>: {
<span class="hl-string">"size"</span>: <span class="hl-string">"-"</span>,
<span class="hl-string">"ubi"</span>: { <em class="hl-comment">// Volume in UBI device</em>
+ <span class="hl-string">"ota"</span>: { <span class="hl-string">"size"</span>: <span class="hl-string">"60m"</span> }, <em class="hl-comment">//ubisystem 分区上增加 ota 分区</em>
<span class="hl-string">"user"</span>: { <span class="hl-string">"size"</span>: <span class="hl-string">"-"</span> },
},
},
<span class="hl-string">"rootfs"</span>: {
<span class="hl-string">"file"</span>: <span class="hl-string">"rootfs*.ubifs"</span>,
<span class="hl-string">"attr"</span>: [<span class="hl-string">"ubi"</span>, <span class="hl-string">"required"</span>],
<span class="hl-string">"part"</span>: [<span class="hl-string">"ubiroot:rootfs"</span>] <em class="hl-comment">//在根文件系统烧录之后增加 ota 分区烧录</em>
},
+ <span class="hl-string">"ota"</span>: {
+ <span class="hl-string">"file"</span>: <span class="hl-string">"ota*.ubifs"</span>,
+ <span class="hl-string">"attr"</span>: [<span class="hl-string">"ubi"</span>, <span class="hl-string">"optional"</span>],
+ <span class="hl-string">"part"</span>: [<span class="hl-string">"ubisystem:ota"</span>] <em class="hl-comment">//将 ota*.ubifs 文件烧录到 ota 分区里面</em>
+ },
</pre><div class="- topic/note note note note_note admonition" id="id__note_llb_kg4_hdc" data-ofbid="id__note_llb_kg4_hdc"><span class="note__title">注:</span>
<p class="- topic/p p" data-ofbid="d91176e400__20250121171530">剪裁主系统文件大小后,需同步修改
<span class="+ topic/keyword pr-d/parmname keyword parmname">BR2_TARGET_ROOTFS_UBIFS_MAX_SIZE</span>
宏,具体操作如下。</p>
</div></div>
</li><li class="- topic/li li" data-ofbid="d91176e407__20250121171530">
<div class="- topic/div div section">
<p class="- topic/p p" data-ofbid="d91176e411__20250121171530">执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">make m</span> :</p>
<div class="- topic/div div highlight-kconfig notranslate">
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_mlb_kg4_hdc" data-ofbid="id__pre_mlb_kg4_hdc">Filesystem images ---&gt;
RootFS images ---&gt;
(<span class="hl-number">0x2800000</span>) ubifs size(Should be aligned to MB)
</pre>
</div>
</div>
</li><li class="- topic/li li" data-ofbid="d91176e424__20250121171530">
<div class="- topic/div div section" id="id__ota-ubifs">
<strong class="+ topic/ph hi-d/b ph b">主系统配置生成 <code class="+ topic/ph pr-d/codeph ph codeph docutils literal notranslate">ota*.ubifs</code> 目标文件</strong>
<p class="- topic/p p" data-ofbid="d91176e434__20250121171530">将 OTA 升级包下载到 <code class="+ topic/ph pr-d/codeph ph codeph">ota 分区</code> 中,方便测试 OTA
本地升级功能。</p><p class="- topic/p p" data-ofbid="d91176e439__20250121171530"><code class="+ topic/ph pr-d/codeph ph codeph">ota 分区</code> 如下所示:</p><figure class="- topic/fig fig fignone" id="id__fig_nlb_kg4_hdc" data-ofbid="id__fig_nlb_kg4_hdc"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="id__image_olb_kg4_hdc" src="../../../images/ota/part.png" alt="part"/></div><br/></figure><ol class="- topic/ol ol" type="i" id="id__ol_cg5_sh4_hdc" data-ofbid="id__ol_cg5_sh4_hdc"><li class="- topic/li li" data-ofbid="d91176e448__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e450__20250121171530">进入主系统 SDK 生产环境: </p>
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_plb_kg4_hdc" data-ofbid="id__pre_plb_kg4_hdc">lunch d211_demo128_nand
</pre>
</li><li class="- topic/li li" data-ofbid="d91176e456__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e458__20250121171530">在 Luban 根目录下执行配置命令:</p>
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_qlb_kg4_hdc" data-ofbid="id__pre_qlb_kg4_hdc">make m
</pre>
</li><li class="- topic/li li" data-ofbid="d91176e464__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e466__20250121171530">配置如下:</p>
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_rlb_kg4_hdc" data-ofbid="id__pre_rlb_kg4_hdc">[*] UserFS <span class="hl-number">1</span> ---&gt;
(ota) Name
FS Type (UBIFS) ---&gt;
(<span class="hl-number">0x3C00000</span>) ubifs size(Should be aligned to MB)
ubifs runtime compression (no compression) ---&gt;
Compression method (no compression) ---&gt;
() Additional mkfs.ubifs options
(target/$(LUBAN_CHIP_NAME)/$(LUBAN_BOARD_NAME)/ota) Overlay directory
</pre>
</li><li class="- topic/li li" data-ofbid="d91176e472__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e474__20250121171530">
<span class="+ topic/ph sw-d/filepath ph filepath">target/$(LUBAN_CHIP_NAME)/$(LUBAN_BOARD_NAME)/ota</span>
目录里的内容生成
<span class="+ topic/ph sw-d/filepath ph filepath">ota_page_2k_block_128k.ubifs</span>
镜像文件,之后会将整个文件烧录到 <code class="+ topic/ph pr-d/codeph ph codeph">ota 分区</code> 中。</p>
</li></ol>
</div>
</li></ol></div>
</li></ol>
</section><section class="- topic/section section" id="id__section_ojj_kg4_hdc" data-ofbid="id__section_ojj_kg4_hdc"><h2 class="- topic/title title sectiontitle">U-Boot 环境变量配置</h2>
<div class="- topic/note note tip note_tip admonition tip" id="id__note_ikj_kg4_hdc" data-ofbid="id__note_ikj_kg4_hdc"><span class="note__title">提示:</span>
<p class="- topic/p p" data-ofbid="d91176e497__20250121171530">为了简化使用U-Boot 环境变量的 OTA 相关配置已添加和开启,无需用户手动配置。</p>
</div>
<ol class="- topic/ol ol" id="id__ol_vvy_th4_hdc" data-ofbid="id__ol_vvy_th4_hdc"><li class="- topic/li li" data-ofbid="d91176e502__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e504__20250121171530">通过环境变量 <span class="+ topic/keyword pr-d/parmname keyword parmname">boot_partition</span> 决定从 <code class="+ topic/ph pr-d/codeph ph codeph">kernel 分区</code> 还是
<code class="+ topic/ph pr-d/codeph ph codeph">recovery 分区</code> 引导启动。</p>
</li><li class="- topic/li li" data-ofbid="d91176e516__20250121171530">
<div class="- topic/p p" data-ofbid="d91176e518__20250121171530"><span class="+ topic/ph sw-d/filepath ph filepath">d211/common/env.txt</span>
文件中修改如下:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_jkj_kg4_hdc" data-ofbid="id__pre_jkj_kg4_hdc">+ set_commonargs_recovery=setenv bootargs earlycon=${earlycon} earlyprintk console=${console} rdinit=/linuxrc
+ <em class="hl-comment">//从 Recovery 系统启动, 引导 initramfs 启动</em>
+ set_nand_bootargs_recovery=run set_nand_mtdargs; \ <em class="hl-comment">//设置环境变量 set_nand_bootargs_recovery</em>
+ run set_commonargs_recovery; \
+ setenv bootargs ${bootargs} mtdparts=${MTD}
+ ubi_rootfs_mtd=<span class="hl-number">10</span> <em class="hl-comment">//适配环境变量 ubi_rootfs_mtd, 保证主系统能够正常启动</em>
+ boot_partition=kernel <em class="hl-comment">//初始化环境变量 boot_partition 从 kernel 分区启动</em>
+ run set_nand_bootargs_recovery; \
+ loadknl mtd recovery ${knl_addr}; \
+ bootm ${knl_addr}; <em class="hl-comment">//nand_boot 环境变量增加从 recovery 分区引导启动</em>
</pre><div class="- topic/note note note note_note admonition" id="id__note_kkj_kg4_hdc" data-ofbid="id__note_kkj_kg4_hdc"><span class="note__title">注:</span>
<p class="- topic/p p" data-ofbid="d91176e527__20250121171530">手动配置环境变量 <span class="+ topic/keyword pr-d/parmname keyword parmname">boot_partition </span>并保存,重启测试 U-Boot 是否能够引导
Recovery 系统启动, 判断配置文件是否生效。</p>
</div></div>
</li><li class="- topic/li li" data-ofbid="d91176e534__20250121171530">
<div class="- topic/div div section" id="id__env"><strong class="+ topic/ph hi-d/b ph b">分区表配置增加 env 备份分区</strong>
<p class="- topic/p p" data-ofbid="d91176e540__20250121171530"><span class="+ topic/ph sw-d/filepath ph filepath">image_cfg.json</span> 中,添加 env 备份分区,保障 env
数据掉电安全:</p><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_lkj_kg4_hdc" data-ofbid="id__pre_lkj_kg4_hdc"><span class="hl-string">"env"</span>: { <span class="hl-string">"size"</span>: <span class="hl-string">"256k"</span> },
+ <span class="hl-string">"env_r"</span>: { <span class="hl-string">"size"</span>: <span class="hl-string">"256k"</span> }, <em class="hl-comment">//在 env 分区后面增加 env_r 分区</em>
<span class="hl-string">"env"</span>: {
<span class="hl-string">"file"</span>: <span class="hl-string">"env.bin"</span>,
<span class="hl-string">"attr"</span>: [<span class="hl-string">"mtd"</span>, <span class="hl-string">"required"</span>],
- <span class="hl-string">"part"</span>: [<span class="hl-string">"env"</span>]
+ <span class="hl-string">"part"</span>: [<span class="hl-string">"env"</span>,<span class="hl-string">"env_r"</span>] <em class="hl-comment">//将 env.bin 文件同时烧录到 env、env_r 分区</em>
},
</pre><div class="- topic/note note note note_note admonition" id="id__note_mkj_kg4_hdc" data-ofbid="id__note_mkj_kg4_hdc"><span class="note__title">注:</span>
<p class="- topic/p p" data-ofbid="d91176e549__20250121171530">通过升级串口打印信息可以判断 <span class="+ topic/ph sw-d/filepath ph filepath">env.bin</span> 文件是否烧录到 env_r
分区,判断配置是否生效。</p>
</div></div>
</li><li class="- topic/li li" data-ofbid="d91176e556__20250121171530">
<div class="- topic/div div section" id="id__u-boot-env-redundant">
<strong class="+ topic/ph hi-d/b ph b">U-Boot 使能 env redundant 配置</strong>
<p class="- topic/p p" data-ofbid="d91176e563__20250121171530">执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">make um</span> 使能 env redundant 机制:</p><div class="- topic/div div highlight-kconfig notranslate">
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_nkj_kg4_hdc" data-ofbid="id__pre_nkj_kg4_hdc">Environment ---&gt;
[*] Enable redundant environment support
(<span class="hl-number">0x2C0000</span>) Redundant environment offset
</pre>
</div><div class="- topic/p p" data-ofbid="d91176e573__20250121171530">
<ul class="- topic/ul ul arabic simple" id="id__ol_pkj_kg4_hdc" data-ofbid="id__ol_pkj_kg4_hdc"><li class="- topic/li li" data-ofbid="d91176e576__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e578__20250121171530">当升级过程中掉电时,其中一份环境变量如果被破坏,另一份环境变量可以继续引导启动。</p>
</li><li class="- topic/li li" data-ofbid="d91176e581__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e583__20250121171530">通过手动擦除其中一份环境变量,可以测试系统能否正常启动,同时可以测试写入保存环境变量后,被擦除的环境变量是否能够恢复。</p>
</li><li class="- topic/li li" data-ofbid="d91176e586__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e588__20250121171530"><span class="+ topic/keyword pr-d/parmname keyword parmname">CONFIG_ENV_OFFSET_REDUND</span><code class="+ topic/ph pr-d/codeph ph codeph">env_r
分区</code> 的偏移值,需要与匹配分区表。</p>
</li></ul>
</div><div class="- topic/note note trouble note_trouble" id="id__note_k53_xl5_4dc" data-ofbid="id__note_k53_xl5_4dc"><span class="note__title">故障:</span>
<div class="- topic/p p" data-ofbid="d91176e599__20250121171530">当使能了 redundant
机制,编译后烧录程序,可能会出现以下错误信息:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_qkj_kg4_hdc" data-ofbid="id__pre_qkj_kg4_hdc">Loading Environment from RAM... *** Warning - bad CRC, using <strong class="hl-keyword">default</strong> environment</pre></div>
<div class="- topic/p p" data-ofbid="d91176e604__20250121171530">这是因为 U-Boot 解析的方法发生了改变,解析数据格式增加了一个字节。通过 redundant 宏查看对应的程序,可以帮助判断哪一份
env 数据最新。在 <span class="+ topic/ph sw-d/filepath ph filepath">image_cfg.json</span>
中添加修改如下:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_rkj_kg4_hdc" data-ofbid="id__pre_rkj_kg4_hdc"> <span class="hl-string">"uboot_env"</span>: {
<span class="hl-string">"env.bin"</span>: {
<span class="hl-string">"file"</span>: <span class="hl-string">"env.txt"</span>,
<span class="hl-string">"size"</span>: <span class="hl-string">"0x4000"</span>,
+ <span class="hl-string">"redundant"</span>: <span class="hl-string">"enable"</span>,
},
},</pre></div>
<div class="- topic/p p" data-ofbid="d91176e612__20250121171530">
<div class="- topic/note note note note_note admonition" id="id__note_skj_kg4_hdc" data-ofbid="id__note_skj_kg4_hdc"><span class="note__title">注:</span>
<p class="- topic/p p" data-ofbid="d91176e616__20250121171530">如不使能 env 备份区域”redundant” 设置为 “disable” 或者不设置。</p>
</div>
</div>
</div></div>
</li><li class="- topic/li li" data-ofbid="d91176e622__20250121171530">
<div class="- topic/div div section" id="id__fw-env-config">
<strong class="+ topic/ph hi-d/b ph b">fw_env.config 配置</strong>
<p class="- topic/p p" data-ofbid="d91176e629__20250121171530">OTA 升级过程中,主系统和 Recovery 系统都使用到 SWUpdate 命令。SWUpdate 依赖 U-Boot 环境变量,需要在
Linux 中配置 U-Boot 环境变量索引路径。</p><p class="- topic/p p" data-ofbid="d91176e631__20250121171530"><code class="+ topic/ph pr-d/codeph ph codeph">fw_printenv/fw_setenv</code>
命令默认索引路径为 <span class="+ topic/ph sw-d/filepath ph filepath">/etc/fw_env.config</span></p><p class="- topic/p p" data-ofbid="d91176e638__20250121171530">因为使用到了 env_r
备份分区,<span class="+ topic/ph sw-d/filepath ph filepath">fw_env.config</span> 需要包含 env 和 env_r
分区信息。SPINAND 的默认的配置信息如下:</p><div class="- topic/div div highlight-kconfig notranslate">
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_ukj_kg4_hdc" data-ofbid="id__pre_ukj_kg4_hdc">/dev/mtd4 <span class="hl-number">0x0000</span> <span class="hl-number">0x4000</span> <span class="hl-number">0x20000</span>
/dev/mtd5 <span class="hl-number">0x0000</span> <span class="hl-number">0x4000</span> <span class="hl-number">0x20000</span>
</pre>
</div><ol class="- topic/ol ol arabic simple" type="a" id="id__ol_wkj_kg4_hdc" data-ofbid="id__ol_wkj_kg4_hdc"><li class="- topic/li li" data-ofbid="d91176e649__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e651__20250121171530">/dev/mtd4 表示 <code class="+ topic/ph pr-d/codeph ph codeph">env 分区</code> 的设备号,/dev/mtd5 表示
<code class="+ topic/ph pr-d/codeph ph codeph">env_r</code> 分区的设备号</p>
</li><li class="- topic/li li" data-ofbid="d91176e660__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e662__20250121171530">第二列表示 Device offset</p>
</li><li class="- topic/li li" data-ofbid="d91176e665__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e667__20250121171530">第三列表示 Env. size</p>
</li><li class="- topic/li li" data-ofbid="d91176e670__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e672__20250121171530">第四列表示块擦除大小</p>
</li></ol><p class="- topic/p p" data-ofbid="d91176e675__20250121171530">Recovery 系统 SDK 生产环境默认存在 <span class="+ topic/ph sw-d/filepath ph filepath">fw_env.config</span> 文件,
具体路径如下:</p><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_xkj_kg4_hdc" data-ofbid="id__pre_xkj_kg4_hdc">target/d211/ota/rootfs_overlay/etc/fw_env.config</pre><p class="- topic/p p" data-ofbid="d91176e682__20250121171530">主系统
SDK 生产环境默认存在 fw_env.config 文件,
具体路径如下:</p><p class="- topic/p p" data-ofbid="d91176e685__20250121171530"><span class="+ topic/ph sw-d/filepath ph filepath">fw_env.config</span>
在主系统的路径如下:</p><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_ykj_kg4_hdc" data-ofbid="id__pre_ykj_kg4_hdc">target/d211/demo128_nand/rootfs_overlay/etc/fw_env.config</pre><ol class="- topic/ol ol arabic simple" type="a" id="id__ol_alj_kg4_hdc" data-ofbid="id__ol_alj_kg4_hdc"><li class="- topic/li li" data-ofbid="d91176e692__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e694__20250121171530">用户 env、env_r 分区信息如果修改, 以上两个 <span class="+ topic/ph sw-d/filepath ph filepath">fw_env.config</span>
文件需要同时更新。</p>
</li><li class="- topic/li li" data-ofbid="d91176e700__20250121171530">
<p class="- topic/p p" data-ofbid="d91176e702__20250121171530">在 Linux 环境下执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">fw_printenv/fw_setenv</span> 命令,测试能够正常打印
U-Boot 环境变量信息。</p>
</li></ol></div>
</li></ol>
</section><section class="- topic/section section" id="id__section_fvs_kg4_hdc" data-ofbid="id__section_fvs_kg4_hdc"><h2 class="- topic/title title sectiontitle">启动脚本配置</h2>
<div class="- topic/div div section" id="id__id5">
<div class="- topic/note note tip note_tip admonition tip" id="id__note_nvs_kg4_hdc" data-ofbid="id__note_nvs_kg4_hdc"><span class="note__title">提示:</span>
<p class="- topic/p p" data-ofbid="d91176e719__20250121171530">为了简化使用,启动脚本配置一般无需修改即可使用</p>
</div>
<ol class="- topic/ol ol" id="id__ol_qzy_vh4_hdc" data-ofbid="id__ol_qzy_vh4_hdc"><li class="- topic/li li" data-ofbid="d91176e724__20250121171530"><strong class="+ topic/ph hi-d/b ph b">S90swupdate</strong>
<p class="- topic/p p" data-ofbid="d91176e728__20250121171530">主系统 和 Recovery 系统默认启动脚本 S90swupdate,
路径如下:</p><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_ovs_kg4_hdc" data-ofbid="id__pre_ovs_kg4_hdc">package/third-party/swupdate/S90swupdate</pre><p class="- topic/p p" data-ofbid="d91176e732__20250121171530">主要内容如下:</p><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_pvs_kg4_hdc" data-ofbid="id__pre_pvs_kg4_hdc">exec /usr/bin/swupdate-progress -w -r &amp;</pre><p class="- topic/p p" data-ofbid="d91176e736__20250121171530">
该脚本的主要功能是后台执行 swupdate-progress 命令, 可以接受 SWUpdate 传递的升级信息, 并打印到调试串口,
用户也可以重定向到显示屏上。</p></li><li class="- topic/li li" data-ofbid="d91176e738__20250121171530"><strong class="+ topic/ph hi-d/b ph b">S91swupdate_ota</strong>
<p class="- topic/p p" data-ofbid="d91176e742__20250121171530">使用 Recovery 系统启动脚本可以挂载好对应的升级分区,并执行 Recovery 系统 OTA
升级程序。脚本路径如下:</p><pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_qvs_kg4_hdc" data-ofbid="id__pre_qvs_kg4_hdc">target/d211/ota/rootfs_overlay/etc/init.d/S91swupdate_ota</pre><p class="- topic/p p" data-ofbid="d91176e746__20250121171530">主要内容如下:</p><div class="- topic/div div highlight-sh notranslate">
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__pre_rvs_kg4_hdc" data-ofbid="id__pre_rvs_kg4_hdc">ubiattach dev/ubi_ctrl -m $mtd_num <em class="hl-comment">//识别 ota 分区</em>
mount -t ubifs /dev/$ubi_param /mnt/ota <em class="hl-comment">//挂载 ota 分区到 mnt/ota 目录下</em>
./usr/lib/swupdate/swupdate_cmd.sh <em class="hl-comment">//执行 OTA 升级程序</em>
</pre>
</div><div class="- topic/note note note note_note admonition" id="id__note_svs_kg4_hdc" data-ofbid="id__note_svs_kg4_hdc"><span class="note__title">注:</span>
<p class="- topic/p p" data-ofbid="d91176e755__20250121171530">主系统和 Recovery 系统挂载设备节点不同。</p>
</div></li></ol>
</div>
</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="#id__section_q3q_hg4_hdc" data-tocid="id__section_q3q_hg4_hdc">Recovery 系统配置</a></div></li><li class="section-item"><div class="section-title"><a href="#id__section_ckb_kg4_hdc" data-tocid="id__section_ckb_kg4_hdc">主系统配置</a></div></li><li class="section-item"><div class="section-title"><a href="#id__section_ojj_kg4_hdc" data-tocid="id__section_ojj_kg4_hdc">U-Boot 环境变量配置</a></div></li><li class="section-item"><div class="section-title"><a href="#id__section_fvs_kg4_hdc" data-tocid="id__section_fvs_kg4_hdc">启动脚本配置</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>