STM32MP157A-DK1测评 - 5、10分钟简化制作Linux Distro
<div class='showpostmsg'> 本帖最后由 freebsder 于 2020-4-7 23:13 编辑<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">简化不是简单,简化只是简化Linux系统的制作过程,制作的目标系统是产品级系统。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">ST</span></span><span style="line-height:150%">用<a href="https://wiki.st.com/stm32mpu/wiki/Category:System_build" style="color:#0563c1; text-decoration:underline">yocto</a>制作工具发布<a href="https://wiki.st.com/stm32mpu/wiki/OpenSTLinux_distribution" style="color:#0563c1; text-decoration:underline">OpenSTLinux</a>系统,这个系统在ST的<a href="https://wiki.st.com/stm32mpu/wiki/Category:How_to_build_software" style="color:#0563c1; text-decoration:underline">wiki</a>上有明确的<a href="https://wiki.st.com/stm32mpu/wiki/STM32MP1_Distribution_Package" style="color:#0563c1; text-decoration:underline">制作过程</a>。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">使用yocto做系统是嵌入式应用里面比较流行也比较完备的制作方法,然而它有3个问题。第1个问题是yocto的复杂性。这个东西本身使用python脚本来控制制作过程,定制各种组件的编译条件,解决依赖等等。对于这种自成体系的东西,需要消耗大量精力对它的组成,语法,流程等熟悉之后才能取得比较理想的定制效果。第2个问题是recipes菜单管理的碎片化。它没有一个统一的中心仓库管理recipes,官方提供的仓库远远不能满足定制化需求,因此目前来说芯片厂自己提供很多菜单满足自己的需求。第3个问题最致命,基于众所周知的原因,我们通过网络获取外部资源总是无法访问或奇慢无比,甚至使用技术手段加持后还是无法满足网络资源的获取。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">因此本人借评测STM32MP157A-DK1的机会给大家介绍一种简化的制作过程。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">为什么要自己做一个。1:部分定制,2:过程简单,做系统10分钟,系统配置10分钟,下面看着图多,其实命令很少,主要是大家喜欢图,3:略过make源代码的制作速度快,主机空间占用小,4:包和源代码下载快,5:标准Debian系统,这点很重要,在开发阶段的排错和产品阶段的补丁都可以使用最新的社区成果。缺点:1:定制深度不及Yocto,2:系统空间占用比Yocto定制的系统大。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"> </p>
<ul>
<li style="text-align: justify;"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">OpenSTLinux</span></span></span></span></span></li>
</ul>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">首先要说明的是OpenSTLinux是一个基于Debian的发行版,它包括Debian包管理工具apt-get,apt-cache等。OpenSTLinux的系统管理机制不再是传统的SysV的init的方式,而是使用的功能更强大的systemd管理系统,挂载系统等初始化行为由systemd接管。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">也就是说,OpenSTLinux是一个定制化的Debian Embedded Linux System。这就有意思了,可以查看/etc/apt/sources.list.d/packages.openstlinux.st.com.list了解ST的包仓库。通过wiki<a href="https://wiki.st.com/stm32mpu/wiki/Package_repository_for_OpenSTLinux_distribution" style="color:#0563c1; text-decoration:underline">这部分了解基本操作</a>。忘掉ST提供的那个所谓SDK吧,有BUG不说真没什么用。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">OpenSTLinux</span></span><span style="line-height:150%">提供的<a href="https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32-mpu-openstlinux-distribution/stm32mp1starter.html" style="color:#0563c1; text-decoration:underline">原始镜像包</a>里面包括:</span></span></span></span></p>
<ol>
<li style="text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">uboot</span></span><span style="line-height:150%">:</span></span></span></span></li>
</ol>
<p style="margin-left:52px; text-indent:0cm; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">u-boot-stm32mp157a-dk1-basic.img</span></span><span style="line-height:150%">,u-boot-spl.stm32-stm32mp157a-dk1-basic</span></span></span></span></p>
<ol start="2">
<li style="text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">存放二进制内核与设备树的bootfs:</span></span></span></span></li>
</ol>
<p style="margin-left:52px; text-indent:0cm; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">st-image-bootfs-openstlinux-weston-stm32mp1.ext4 </span></span></span></span></span></p>
<ol start="3">
<li style="text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">rootfs</span></span><span style="line-height:150%">:</span></span></span></span></li>
</ol>
<p style="margin-left:52px; text-indent:0cm; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">st-image-weston-openstlinux-weston-stm32mp1.ext4</span></span></span></span></span></p>
<ol start="4">
<li style="text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">user fs</span></span><span style="line-height:150%">:</span></span></span></span></li>
</ol>
<p style="margin-left:24px; text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">st-image-userfs-openstlinux-weston-stm32mp1.ext4</span></span></span></span></span></p>
<ol start="5">
<li style="text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">一些工具fs</span></span></span></span></li>
</ol>
<p style="margin-left:52px; text-indent:0cm; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">st-image-vendorfs-openstlinux-weston-stm32mp1.ext4</span></span></span></span></span></p>
<p style="margin-left:52px; text-indent:0cm; text-align:justify"> </p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">除了uboot是可执行的二进制文件之外,其余的都是ext4文件系统。通过主机的挂载工具可以直接查看、添加、删除,最主要是可以拷贝里面的东西出来。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">拷贝是比较有用的,毕竟OpenSTLinux是一个深度定制的Linux发行版,有些文件是ST单独提供的,我们既然要简化偷懒,最好的办法莫过于拿来直接用,虽然这些文件大部分都是脚本。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">bootfs</span></span><span style="line-height:150%">就是把内核与dtb拷贝进去,我们不用再做一个bootfs,可以在make kernel之后把uImage和*.dtb拷贝过来,比如<a href="https://bbs.eeworld.com.cn/thread-1116453-1-1.html" style="color:#0563c1; text-decoration:underline">上一篇</a>中的SPI操作我就是这样更新的镜像。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"> </p>
<ul>
<li style="text-align: justify;"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">Debian – </span></span><span style="line-height:150%">基本系统</span></span></span></span></li>
</ul>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-bash">make ee_st_rootfs
make install qemu-user-static debootstrap
debootstrap --arch=armhf--foreign buster debian_st https://mirrors.tuna.tsinghua.edu.cn/debian/</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url("https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="margin-left:28px; text-align:justify"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">debootstrap</span></span><span style="line-height:150%">可以指定目标系统的规模:mini,还是base,还是其他。具体可以查看debootstrap手册,我这里省事用的base版。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">这个过程大约4分钟,当然,这要依赖网络情况,清华的源还是蛮快的。</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-bash">cp /usr/bin/qemu-arm-static debian_st/usr/bin/
chroot debian_st /usr/bin/qemu-arm-static /bin/sh -i</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url("https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-bash">/debootstrap/debootstrap --second-stage</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url("https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">这一步是解包刚才debootstrap下载的安装包,大约6分钟,当然,这和你的机器性能有关。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">最后,设置root密码,建立登录用户,设置默认输出控制台,这个基本系统就算是做完了,so easy。</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="language-bash hljs">rm -fr boot
passwd root
adduser ee
systemctl enable serial-getty@ttySTM0.service</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background:rgba(220,220,220,0.5);background-image:url(https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png)"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">这个系统简化是简化,然而这些包都是Debian的Production Release的包,用做服务器的Debian系统不要太多。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">如果没有其他需求,可以直接往下一节,制作镜像和烧写。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p align="center" style="text-align:center"> </p>
<p align="center" style="text-align:center"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">进一步的,还可以设置本地化locales,安装一些软件包,例如我打算安装无线网卡,因为我不习惯太多线缆。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">编辑/etc/apt/sources.list源,然后更新debian包信息。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p align="center" style="text-align:center"> </p>
<p align="center" style="text-align:center"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">还可以设置locates:dpkg-reconfigure locales,全部选成en_US.UTF-8即可。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">最后看一下这个目标系统的大小,退出chroot环境。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">这个根文件系统就不要删了,可以当作GCC编译器的include和lib包。 </span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"> </p>
<ul>
<li style="text-align: justify;"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">镜像制作和烧写</span></span></span></span></li>
</ul>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">上面已经exit退出了chroot环境,下面的操作都是在主机上进行。根据上面的目标系统大小,做一个块设备文件,并格式化文件系统。</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="language-bash hljs">dd <span class="hljs-keyword">if</span>=/dev/zero of=ee_st_fs.ext4 bs=<span class="hljs-number">1</span>M count=<span class="hljs-number">600</span>
<span class="hljs-built_in">sudo</span> mkfs.ext4 ee_st_fs.ext4</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background:rgba(220,220,220,0.5);background-image:url(https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png)"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">挂载它,然后把ee_st_rootfs下面做好的目标系统考进去。</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="language-bash hljs"><span class="hljs-built_in">sudo</span> mount ee_st_fs.ext4 rfs
<span class="hljs-built_in">sudo</span> cp -ar ee_st_rootfs/* rfs
<span class="hljs-built_in">sudo</span> umount rfs</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background:rgba(220,220,220,0.5);background-image:url(https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png)"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">当然,也可以反过来,先做一个ext4的文件系统,挂载之后再直接在这个挂载的系统里debootstrap做系统。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">系统镜像做好了,下面主要是烧写和引导相关的操作。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">1</span></span><span style="line-height:150%">、把ee_st_fs.ext4拷贝到stm32mp1-openstlinux-20-02-19\images\stm32mp1下。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">2</span></span><span style="line-height:150%">、在stm32mp1-openstlinux-20-02-19\images\stm32mp1\flashlayout_st-image-weston下面用仿照现有的tsv文件编写一个自己的烧写配置:</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="language-bash hljs"><span class="hljs-comment">#Opt Id Name Type IP Offset Binary</span>
- <span class="hljs-number">0</span>x01 fsbl1-boot Binary none <span class="hljs-number">0</span>x0 tf<span class="hljs-operator">-a</span>-stm32mp157a-dk1-trusted.stm32
- <span class="hljs-number">0</span>x03 ssbl-boot Binary none <span class="hljs-number">0</span>x0 u-boot-stm32mp157a-dk1-trusted.stm32
P <span class="hljs-number">0</span>x04 fsbl1 Binary mmc0 <span class="hljs-number">0</span>x00004400 u-boot-spl.stm32-stm32mp157a-dk1-basic
P <span class="hljs-number">0</span>x05 fsbl2 Binary mmc0 <span class="hljs-number">0</span>x00044400 u-boot-spl.stm32-stm32mp157a-dk1-basic
P <span class="hljs-number">0</span>x06 ssbl Binary mmc0 <span class="hljs-number">0</span>x00084400 u-boot-stm32mp157a-dk1-basic.img
P <span class="hljs-number">0</span>x21 bootfs System mmc0 <span class="hljs-number">0</span>x00284400 st-image-bootfs-openstlinux-weston-stm32mp1.ext4
P <span class="hljs-number">0</span>x23 rootfs FileSystem mmc0 <span class="hljs-number">0</span>x04284400 ee_st_fs.ext4</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background:rgba(220,220,220,0.5);background-image:url(https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png)"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">3</span></span><span style="line-height:150%">、如果只更改rootfs的话,则可以直接进入第5步烧写。如果像我上面那样只保留了bootfs和rootfs,去掉了vendorfs和userfs的话,还需要进行下面的第4步。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">4</span></span><span style="line-height:150%">、仿照上面的形式挂载st-image-bootfs-openstlinux-weston-stm32mp1.ext4,修改mmc0_stm32mp157a-dk1_extlinux/extlinux.conf:</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-bash"><span class="hljs-comment"># Generic Distro Configuration file generated by OpenEmbedded</span>
MENU BACKGROUND /splash.bmp
TIMEOUT <span class="hljs-number">20</span>
LABEL stm32mp157a-dk1-sdcard
KERNEL /uImage
FDT /stm32mp157a-dk1.dtb
APPEND root=/dev/mmcblk0p5 rootwait rw console=ttySTM0,<span class="hljs-number">115200</span></code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url("https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">主要是root=/dev/mmcblk0p5这里。(tsv文件里面第一列的P代表分区,rootfs放在第几个P,这里就改成几)</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">5、通过STM32CubeProgrammer工具烧写。<a href="https://bbs.eeworld.com.cn/thread-1115509-1-1.html" style="color:#0563c1; text-decoration:underline">参见前篇文章</a>。</span></span></span></span></p>
<p style="text-align:justify"> </p>
<ul>
<li style="text-align: justify;"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">Debian – </span></span><span style="line-height:150%">配置网络和系统</span></span></span></span></li>
</ul>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">上电,一个完整的基础Debian就起来了。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p align="center" style="text-align:center"> </p>
<p align="center" style="text-align:center"></p>
<p align="center" style="text-align:center"> </p>
<p align="center" style="text-align:center"></p>
<p align="center" style="text-align:center"> </p>
<p align="center" style="text-align:center"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">配置无线网卡。参见Debian<a href="https://wiki.debian.org/WiFi/HowToUse#wpa_supplicant" style="color:#0563c1; text-decoration:underline">官方wiki</a>。这里需要注意的是在制作根文件系统的时候,要apt install wpasupplicant iw 等相关包。参考上面 “Debian – 基本系统”的后半截。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">通过df -h / 查看文件系统占用情况。然后:</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-bash">resize2fs -p /dev/mmcblk0p5</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url("https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span lang="EN-US">mmcblk0p5</span>是具体情况需要根据自己的实际情况选择。<span style="line-height:150%"><span style="line-height:150%">调整根文件系统大小,扩展到整个SD卡。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p style="text-align:justify"> </p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">到了这里,一个可无线联网的运行在32G SD卡上Debian系统就做好了。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">因为做base 系统的时候已经装了openssh-server,因此可以用ssh工具连接开发板进行管理和文件交换了。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"> </p>
<ul>
<li style="text-align: justify;"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">Debian - weston</span></span><span style="line-height:150%">图形界面</span></span></span></span></li>
</ul>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">1</span></span><span style="line-height:150%">、首先安装weston和虚拟终端的kbd</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="hljs language-bash">apt update
apt install kbd weston</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background: url("https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png") rgba(220, 220, 220, 0.5); top: -15px; left: 0px; display: block;"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"><span lang="EN-US" style="font-size: 20px; font-family: 宋体; text-indent: 21pt;"><span style="line-height:150%">2</span></span><span style="font-size: 20px; font-family: 宋体; text-indent: 21pt; line-height: 150%;">、在主机上挂载OpenSTLinux的st-image-weston-openstlinux-weston-stm32mp1.ext4,主要在主机上拷贝出来三个文件,这三个文件weston配置文件和systemd服务配置文件,不复杂,但是有现成的自然拿来用。</span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">同样的方法,ST提供的其他几个ext4文件系统里的内容,都可以拷贝出来直接用。</span></span></span></span></p>
<pre>
<code class="language-bash">sudo mount st-image-weston-openstlinux-weston-stm32mp1.ext4 rfs
scp rfs/etc/xdg/weston/weston.ini ee@192.168.31.8:/home/ee/
scp rfs/lib/systemd/system/weston.service ee@192.168.31.8:/home/ee/
scp rfs/usr/bin/weston-start ee@192.168.31.8:/home/ee/</code></pre>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">192.168.31.8</span></span><span style="line-height:150%">是我的开发板地址。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">3</span></span><span style="line-height:150%">、在开发板上,修改weston服务配置文件和weston配置文件:</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">编辑~/weston.service,注释掉</span></span></span></span></p>
<pre>
<code class="language-bash"># After=pulsesaudio.service</code></pre>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">因为我没有装音频相关包,所以先注释掉。</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">编辑~/weston.ini,注释掉</span></span></span></span></p>
<pre>
<code class="language-bash">#
#icon=/usr/share/weston/icon/ST13345_Products_light_blue_24x24.png
#path=/usr/local/demo/demo_launcher.py</code></pre>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">因为我没有挂载ST的工具包</span></span></span></span></p>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span lang="EN-US"><span style="line-height:150%">4</span></span><span style="line-height:150%">、在开发板上:</span></span></span></span></p>
<div aria-label="代码段 小部件" contenteditable="false" role="region" tabindex="-1">
<pre data-widget="codesnippet">
<code class="language-bash hljs"><span class="hljs-built_in">cd</span> ~
<span class="hljs-built_in">sudo</span> mkdir -p /etc/xdg/weston/
<span class="hljs-built_in">sudo</span> cp weston.ini /etc/xdg/weston/
<span class="hljs-built_in">sudo</span> cp weston.service /lib/systemd/system/
chmod +x weston-start
<span class="hljs-built_in">sudo</span> cp weston-start /usr/bin/
</code></pre>
<img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" /><span style="background:rgba(220,220,220,0.5);background-image:url(https://bbs.eeworld.com.cn/static/editor/plugins/widget/images/handle.png)"><img height="15" role="presentation" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" title="点击并拖拽以移动" width="15" /></span></div>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-size: 20px; font-family: 宋体; text-indent: 21pt; line-height: 150%;"><i>5</i>、然后打开weston服务</span></p>
<pre>
<code class="language-bash">sudo systemctl enable weston
sudo systemctl start weston</code></pre>
<p style="text-indent:21.0pt; text-align:justify"><span style="font-family:宋体;"><span style="font-size:20px;"><span style="line-height:150%"><span style="line-height:150%">应该能看到weston图形界面了。</span></span></span></span></p>
<p align="center" style="text-align:center"></p>
<p align="center" style="text-align:center"> </p>
<p><br />
<b><font color="#5E7384">此内容由EEWORLD论坛网友<font size="3">freebsder</font>原创,如需转载或用于商业用途需征得作者同意并注明出处</font></b><br />
</p>
</div><script> var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
} </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script> <p>牛的</p>
hotsauce1861 发表于 2020-4-8 14:26
牛的
谢谢捧场:congratulate: <p>厉害啦</p>
<p>这个挺列害</p>
<p>道长你这写错了一个地方吧,是mkdir rootfs不是make rootfs</p>
donatello1996 发表于 2020-4-14 23:08
道长你这写错了一个地方吧,是mkdir rootfs不是make rootfs
是的,写错了。下面图里是正确的。每次改帖子都要审核,我就不改了。 donatello1996 发表于 2020-4-14 23:08
道长你这写错了一个地方吧,是mkdir rootfs不是make rootfs
<p>好眼力,我都不知道你是在哪里看到的。<img height="50" src="https://bbs.eeworld.com.cn/static/editor/plugins/hkemoji/sticker/red/Animaux-Crabe-2.gif" width="50" /></p>
littleshrimp 发表于 2020-4-16 15:12
好眼力,我都不知道你是在哪里看到的。
<p>因为我也要弄这块板子,帖子我是认真看完的,每一行</p>
<p>膜拜,linux是个深奥的东西啊</p>
<p>这个不错,标记一下</p>
页:
[1]