<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Linux on Tech Snippets - 嵌入式技术笔记</title><link>https://tech-snippets.xyz/tags/linux/</link><description>Recent content in Linux on Tech Snippets - 嵌入式技术笔记</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Fri, 10 Apr 2026 03:00:00 +0800</lastBuildDate><atom:link href="https://tech-snippets.xyz/tags/linux/index.xml" rel="self" type="application/rss+xml"/><item><title>嵌入式 Linux 开发指南 2026</title><link>https://tech-snippets.xyz/posts/embedded-linux-development/</link><pubDate>Fri, 10 Apr 2026 03:00:00 +0800</pubDate><guid>https://tech-snippets.xyz/posts/embedded-linux-development/</guid><description>嵌入式 Linux 开发完整指南，涵盖内核配置、驱动开发、根文件系统和调试</description><content:encoded><![CDATA[<h2 id="引言">引言</h2>
<p>本文基于 2026 年最新行业资料整理，涵盖 embedded Linux development 的核心概念、开发流程和实战技巧。</p>
<h2 id="嵌入式-linux-架构">嵌入式 Linux 架构</h2>



<div class="goat svg-container ">
  
    <svg
      xmlns="http://www.w3.org/2000/svg"
      font-family="Menlo,Lucida Console,monospace"
      
        viewBox="0 0 256 185"
      >
      <g transform='translate(8,16)'>
<text text-anchor='middle' x='0' y='4' fill='currentColor' style='font-size:1em'>┌</text>
<text text-anchor='middle' x='0' y='20' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='0' y='36' fill='currentColor' style='font-size:1em'>├</text>
<text text-anchor='middle' x='0' y='52' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='0' y='68' fill='currentColor' style='font-size:1em'>├</text>
<text text-anchor='middle' x='0' y='84' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='0' y='100' fill='currentColor' style='font-size:1em'>├</text>
<text text-anchor='middle' x='0' y='116' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='0' y='132' fill='currentColor' style='font-size:1em'>├</text>
<text text-anchor='middle' x='0' y='148' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='0' y='164' fill='currentColor' style='font-size:1em'>└</text>
<text text-anchor='middle' x='8' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='8' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='8' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='8' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='8' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='8' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='16' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='16' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='16' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='16' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='16' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='16' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='24' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='24' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='24' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='24' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='24' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='24' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='32' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='32' y='20' fill='currentColor' style='font-size:1em'>应</text>
<text text-anchor='middle' x='32' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='32' y='52' fill='currentColor' style='font-size:1em'>库</text>
<text text-anchor='middle' x='32' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='32' y='84' fill='currentColor' style='font-size:1em'>系</text>
<text text-anchor='middle' x='32' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='32' y='116' fill='currentColor' style='font-size:1em'>L</text>
<text text-anchor='middle' x='32' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='32' y='148' fill='currentColor' style='font-size:1em'>B</text>
<text text-anchor='middle' x='32' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='40' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='40' y='20' fill='currentColor' style='font-size:1em'>用</text>
<text text-anchor='middle' x='40' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='40' y='52' fill='currentColor' style='font-size:1em'>层</text>
<text text-anchor='middle' x='40' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='40' y='84' fill='currentColor' style='font-size:1em'>统</text>
<text text-anchor='middle' x='40' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='40' y='116' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='40' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='40' y='148' fill='currentColor' style='font-size:1em'>S</text>
<text text-anchor='middle' x='40' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='48' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='48' y='20' fill='currentColor' style='font-size:1em'>层</text>
<text text-anchor='middle' x='48' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='48' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='48' y='84' fill='currentColor' style='font-size:1em'>调</text>
<text text-anchor='middle' x='48' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='48' y='116' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='48' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='48' y='148' fill='currentColor' style='font-size:1em'>P</text>
<text text-anchor='middle' x='48' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='56' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='56' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='56' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='56' y='84' fill='currentColor' style='font-size:1em'>用</text>
<text text-anchor='middle' x='56' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='56' y='116' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='56' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='56' y='148' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='56' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='64' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='64' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='64' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='64' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='64' y='116' fill='currentColor' style='font-size:1em'>x</text>
<text text-anchor='middle' x='64' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='64' y='148' fill='currentColor' style='font-size:1em'>驱</text>
<text text-anchor='middle' x='64' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='72' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='72' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='72' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='72' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='72' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='72' y='148' fill='currentColor' style='font-size:1em'>动</text>
<text text-anchor='middle' x='72' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='80' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='80' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='80' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='80' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='80' y='116' fill='currentColor' style='font-size:1em'>内</text>
<text text-anchor='middle' x='80' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='80' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='88' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='88' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='88' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='88' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='88' y='116' fill='currentColor' style='font-size:1em'>核</text>
<text text-anchor='middle' x='88' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='88' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='96' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='96' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='96' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='96' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='96' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='96' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='104' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='104' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='104' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='104' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='104' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='104' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='112' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='112' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='112' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='112' y='84' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='112' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='112' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='112' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='120' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='120' y='20' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='120' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='120' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='120' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='120' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='120' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='128' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='128' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='128' y='52' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='128' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='128' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='128' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='128' y='148' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='128' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='136' y='4' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='136' y='36' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='136' y='68' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='136' y='100' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='136' y='116' fill='currentColor' style='font-size:1em'>│</text>
<text text-anchor='middle' x='136' y='132' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='136' y='164' fill='currentColor' style='font-size:1em'>─</text>
<text text-anchor='middle' x='144' y='4' fill='currentColor' style='font-size:1em'>┐</text>
<text text-anchor='middle' x='144' y='36' fill='currentColor' style='font-size:1em'>┤</text>
<text text-anchor='middle' x='144' y='68' fill='currentColor' style='font-size:1em'>┤</text>
<text text-anchor='middle' x='144' y='100' fill='currentColor' style='font-size:1em'>┤</text>
<text text-anchor='middle' x='144' y='132' fill='currentColor' style='font-size:1em'>┤</text>
<text text-anchor='middle' x='144' y='164' fill='currentColor' style='font-size:1em'>┘</text>
<text text-anchor='middle' x='152' y='52' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='160' y='52' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='168' y='52' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='176' y='52' fill='currentColor' style='font-size:1em'>b</text>
<text text-anchor='middle' x='184' y='52' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='192' y='52' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='200' y='52' fill='currentColor' style='font-size:1em'>μ</text>
<text text-anchor='middle' x='208' y='52' fill='currentColor' style='font-size:1em'>C</text>
<text text-anchor='middle' x='216' y='52' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='224' y='52' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='232' y='52' fill='currentColor' style='font-size:1em'>b</text>
<text text-anchor='middle' x='240' y='52' fill='currentColor' style='font-size:1em'>c</text>
</g>

    </svg>
  
</div>
<h2 id="开发环境搭建">开发环境搭建</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># 安装交叉编译工具链</span>
</span></span><span class="line"><span class="cl">sudo apt install gcc-arm-linux-gnueabihf
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># 编译内核</span>
</span></span><span class="line"><span class="cl">make <span class="nv">ARCH</span><span class="o">=</span>arm <span class="nv">CROSS_COMPILE</span><span class="o">=</span>arm-linux-gnueabihf- zImage
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># 编译设备树</span>
</span></span><span class="line"><span class="cl">make <span class="nv">ARCH</span><span class="o">=</span>arm <span class="nv">CROSS_COMPILE</span><span class="o">=</span>arm-linux-gnueabihf- dtbs
</span></span></code></pre></div><h2 id="驱动开发">驱动开发</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-c" data-lang="c"><span class="line"><span class="cl"><span class="c1">// 字符设备驱动框架
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="k">static</span> <span class="kt">int</span> <span class="nf">dev_open</span><span class="p">(</span><span class="k">struct</span> <span class="n">inode</span> <span class="o">*</span><span class="n">inode</span><span class="p">,</span> <span class="k">struct</span> <span class="n">file</span> <span class="o">*</span><span class="n">file</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nf">printk</span><span class="p">(</span><span class="n">KERN_INFO</span> <span class="s">&#34;设备已打开</span>
</span></span><span class="line"><span class="cl"><span class="s">&#34;);</span>
</span></span><span class="line"><span class="cl">    <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">dev_read</span><span class="p">(</span><span class="k">struct</span> <span class="n">file</span> <span class="o">*</span><span class="n">file</span><span class="p">,</span> <span class="kt">char</span> <span class="n">__user</span> <span class="o">*</span><span class="n">buf</span><span class="p">,</span> 
</span></span><span class="line"><span class="cl">                        <span class="kt">size_t</span> <span class="n">count</span><span class="p">,</span> <span class="kt">loff_t</span> <span class="o">*</span><span class="n">ppos</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nf">copy_to_user</span><span class="p">(</span><span class="n">buf</span><span class="p">,</span> <span class="n">kernel_data</span><span class="p">,</span> <span class="n">count</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">    <span class="k">return</span> <span class="n">count</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">static</span> <span class="k">struct</span> <span class="n">file_operations</span> <span class="n">fops</span> <span class="o">=</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="p">.</span><span class="n">owner</span> <span class="o">=</span> <span class="n">THIS_MODULE</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="p">.</span><span class="n">open</span> <span class="o">=</span> <span class="n">dev_open</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="p">.</span><span class="n">read</span> <span class="o">=</span> <span class="n">dev_read</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"><span class="p">};</span>
</span></span></code></pre></div><h2 id="根文件系统">根文件系统</h2>
<p>使用 Buildroot 或 Yocto 构建：</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Buildroot</span>
</span></span><span class="line"><span class="cl">git clone https://github.com/buildroot/buildroot
</span></span><span class="line"><span class="cl">make menuconfig  <span class="c1"># 配置</span>
</span></span><span class="line"><span class="cl">make             <span class="c1"># 编译</span>
</span></span></code></pre></div><h2 id="参考资料">参考资料</h2>
<ol>
<li><a href="https://www.coursera.org/specializations/advanced-embedded-linux-development">Advanced Embedded Linux Development | Coursera</a></li>
<li><a href="https://bootlin.com/training/embedded-linux/">Embedded Linux training – Bootlin</a></li>
<li><a href="https://training.linuxfoundation.org/training/embedded-linux-development/">Embedded Linux Development (LFD450)</a></li>
</ol>
<hr>
<p><em>本文基于网络公开资料整理，结合嵌入式开发实践经验编写。</em></p>
]]></content:encoded></item></channel></rss>