<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
		<id>http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=%E7%AC%AC%E5%8D%81%E5%9B%9B%E8%AF%BE--MicroWRT_%E5%86%85%E6%A0%B8%E6%A0%91%E4%BB%8B%E7%BB%8D</id>
		<title>第十四课--MicroWRT 内核树介绍 - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http:///https//wiki.microduino.cn/index.php?action=history&amp;feed=atom&amp;title=%E7%AC%AC%E5%8D%81%E5%9B%9B%E8%AF%BE--MicroWRT_%E5%86%85%E6%A0%B8%E6%A0%91%E4%BB%8B%E7%BB%8D"/>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=%E7%AC%AC%E5%8D%81%E5%9B%9B%E8%AF%BE--MicroWRT_%E5%86%85%E6%A0%B8%E6%A0%91%E4%BB%8B%E7%BB%8D&amp;action=history"/>
		<updated>2026-04-22T00:02:25Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=%E7%AC%AC%E5%8D%81%E5%9B%9B%E8%AF%BE--MicroWRT_%E5%86%85%E6%A0%B8%E6%A0%91%E4%BB%8B%E7%BB%8D&amp;diff=5571&amp;oldid=prev</id>
		<title>Shengkai81@gmail.com：/* Device Tree Source诞生 */</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=%E7%AC%AC%E5%8D%81%E5%9B%9B%E8%AF%BE--MicroWRT_%E5%86%85%E6%A0%B8%E6%A0%91%E4%BB%8B%E7%BB%8D&amp;diff=5571&amp;oldid=prev"/>
				<updated>2014-11-03T08:02:40Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Device Tree Source诞生&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;zh-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;2014年11月3日 (一) 08:02的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l16&quot; &gt;第16行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第16行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Device Tree由一系列被命名的结点（node）和属性（property）组成，而结点本身可包含子结点。&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Device Tree由一系列被命名的结点（node）和属性（property）组成，而结点本身可包含子结点。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;所谓属性，其实就是成对出现的name和 value。在Device Tree中，可描述的信息包括（原先这些信息大多被hard code到kernel中）：&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;所谓属性，其实就是成对出现的name和 value。在Device Tree中，可描述的信息包括（原先这些信息大多被hard code到kernel中）：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;*CPU的数量和类别&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*CPU的数量和类别&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;*内存基地址和大小&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*内存基地址和大小&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;*总线和桥&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*总线和桥&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;*外设连接 &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*外设连接 &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;*中断控制器和中断使用情况&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*中断控制器和中断使用情况&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;*GPIO控制器和GPIO使用情况&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*GPIO控制器和GPIO使用情况&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;*Clock控制器和Clock使用情况&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*Clock控制器和Clock使用情况&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;它基本上就是画一棵电路板上CPU、总线、设备组成的树，Bootloader会将这棵树传递给内核，然后内核可以识别这棵树，&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;它基本上就是画一棵电路板上CPU、总线、设备组成的树，Bootloader会将这棵树传递给内核，然后内核可以识别这棵树，&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Shengkai81@gmail.com</name></author>	</entry>

	<entry>
		<id>https//wiki.microduino.cn/index.php?title=%E7%AC%AC%E5%8D%81%E5%9B%9B%E8%AF%BE--MicroWRT_%E5%86%85%E6%A0%B8%E6%A0%91%E4%BB%8B%E7%BB%8D&amp;diff=5570&amp;oldid=prev</id>
		<title>Shengkai81@gmail.com：Created page with &quot;{| style=&quot;width: 800px;&quot; |- | 本节教程主要介绍Linux 内核树的概念，在3.x的linux 系统中，为了是kernel 程序保持整洁，将许多和开发板相关的...&quot;</title>
		<link rel="alternate" type="text/html" href="https//wiki.microduino.cn/index.php?title=%E7%AC%AC%E5%8D%81%E5%9B%9B%E8%AF%BE--MicroWRT_%E5%86%85%E6%A0%B8%E6%A0%91%E4%BB%8B%E7%BB%8D&amp;diff=5570&amp;oldid=prev"/>
				<updated>2014-11-03T08:01:57Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| style=&amp;quot;width: 800px;&amp;quot; |- | 本节教程主要介绍Linux 内核树的概念，在3.x的linux 系统中，为了是kernel 程序保持整洁，将许多和开发板相关的...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| style=&amp;quot;width: 800px;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
本节教程主要介绍Linux 内核树的概念，在3.x的linux 系统中，为了是kernel 程序保持整洁，将许多和开发板相关的代码去掉了，然后引入了&lt;br /&gt;
内核树的概念。下面就让我们了解一下内核树，这里只是一个简单介绍，详细的资料在网上会找到很多。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Device Tree Source诞生==&lt;br /&gt;
&lt;br /&gt;
在过去的linux内核里，如：ARM Linux中，arch/arm/plat-xxx和arch/arm/mach-xxx中充斥着大量的垃圾代码，&lt;br /&gt;
相当多数的代码只是在描述板级细节，而这些板级细节对于内核来讲，不过是垃圾，&lt;br /&gt;
如板上的platform设备、resource、i2c_board_info、spi_board_info 以及各种硬件的platform_data。&lt;br /&gt;
Device Tree是一种描述硬件的数据结构，它起源于 OpenFirmware (OF)。在Linux 2.6中，&lt;br /&gt;
ARM架构的板极硬件细节过多地被硬编码在arch/arm/plat-xxx和arch/arm/mach-xxx，采用Device Tree后，&lt;br /&gt;
许多硬件的细节可以直接透过它传递给Linux，而不再需要在kernel中进行大量的冗余编码。&lt;br /&gt;
Device Tree由一系列被命名的结点（node）和属性（property）组成，而结点本身可包含子结点。&lt;br /&gt;
所谓属性，其实就是成对出现的name和 value。在Device Tree中，可描述的信息包括（原先这些信息大多被hard code到kernel中）：&lt;br /&gt;
 *CPU的数量和类别&lt;br /&gt;
 *内存基地址和大小&lt;br /&gt;
 *总线和桥&lt;br /&gt;
 *外设连接 &lt;br /&gt;
 *中断控制器和中断使用情况&lt;br /&gt;
 *GPIO控制器和GPIO使用情况&lt;br /&gt;
 *Clock控制器和Clock使用情况&lt;br /&gt;
&lt;br /&gt;
它基本上就是画一棵电路板上CPU、总线、设备组成的树，Bootloader会将这棵树传递给内核，然后内核可以识别这棵树，&lt;br /&gt;
并根据它展开出Linux 内核中的platform_device、i2c_client、spi_device等设备，而这些设备用到的内存、IRQ等资源，&lt;br /&gt;
也被传递给了内核， 内核会将这些资源绑定给展开的相应的设备。&lt;br /&gt;
&lt;br /&gt;
==Device Tree组成和结构==&lt;br /&gt;
&lt;br /&gt;
.dts文件是一种ASCII 文本格式的Device Tree描述，此文本格式非常人性化，适合人类的阅读习惯。&lt;br /&gt;
基本上，在mips Linux，一个.dts文件对应一个mips的machine，一般放置在/target/linux/ramips/dts目录。&lt;br /&gt;
由于一个SoC可能对应多 个machine（一个SoC可以对应多个产品和电路板），势必这些.dts文件需包含许多共同的部分，Linux内核为了简化，&lt;br /&gt;
把SoC公用的部分或者 多个machine共同的部分一般提炼为.dtsi，类似于C语言的头文件。其他的machine对应的.dts就include这个.dtsi。&lt;br /&gt;
譬如， 对于MT762n而言，mt7620n.dtsi就被WRTNODE.dts，WRTNODE.dts所引用，WRTNODE.dts 有如下一行：&lt;br /&gt;
&lt;br /&gt;
  /include/ &amp;quot;mt7620n.dtsi&amp;quot; &lt;br /&gt;
&lt;br /&gt;
当然，和C语言的头文件类似，.dtsi也可以include其他的.dtsi，譬如几乎所有的ARM SoC的.dtsi都引用了skeleton.dtsi。&lt;br /&gt;
.dts（或者其include的.dtsi）基本元素即为前文所述的结点和属性。&lt;br /&gt;
例如：m25p80的spi flash&lt;br /&gt;
&lt;br /&gt;
 m25p80@0 {&lt;br /&gt;
               #address-cells = &amp;lt;1&amp;gt;; &lt;br /&gt;
               #size-cells = &amp;lt;1&amp;gt;; &lt;br /&gt;
               #compatible = &amp;quot;mx25l6405d&amp;quot;; &lt;br /&gt;
               compatible = &amp;quot;w25q128&amp;quot;; &lt;br /&gt;
               reg = &amp;lt;0 0&amp;gt;; &lt;br /&gt;
               linux,modalias = &amp;quot;m25p80&amp;quot;, &amp;quot;w25q128&amp;quot;; &lt;br /&gt;
               spi-max-frequency = &amp;lt;10000000&amp;gt;; &lt;br /&gt;
               partition@0 { &lt;br /&gt;
                   label = &amp;quot;u-boot&amp;quot;; &lt;br /&gt;
                   reg = &amp;lt;0x0 0x30000&amp;gt;; &lt;br /&gt;
                   read-only; &lt;br /&gt;
               }; &lt;br /&gt;
               partition@30000 { &lt;br /&gt;
                   label = &amp;quot;u-boot-env&amp;quot;; &lt;br /&gt;
                   reg = &amp;lt;0x30000 0x10000&amp;gt;; &lt;br /&gt;
                   read-only; &lt;br /&gt;
               }; &lt;br /&gt;
               factory: partition@40000 { &lt;br /&gt;
                   label = &amp;quot;factory&amp;quot;; &lt;br /&gt;
                   reg = &amp;lt;0x40000 0x10000&amp;gt;; &lt;br /&gt;
                   read-only; &lt;br /&gt;
               }; &lt;br /&gt;
               partition@50000 { &lt;br /&gt;
                   label = &amp;quot;firmware&amp;quot;; &lt;br /&gt;
                   reg = &amp;lt;0x50000 0xfb0000&amp;gt;; &lt;br /&gt;
               }; &lt;br /&gt;
           };&lt;br /&gt;
&lt;br /&gt;
m25p80@0 为结点， partition@0， factory: partition@40000 是他的子结点。&lt;br /&gt;
compatible 属性的组织形式为&amp;lt;manufacturer&amp;gt;,&amp;lt;model&amp;gt;，别名其实就是去掉compatible 属性中逗号前的manufacturer前缀。&lt;br /&gt;
关于这一点，可查看drivers/spi/spi.c的源代码，函数spi_match_device()暴露了更多的细节，&lt;br /&gt;
如果别名出现在设备spi_driver的id_table里面，或者别名与spi_driver的name字段相同，SPI设备和驱动都可以匹配上。&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Shengkai81@gmail.com</name></author>	</entry>

	</feed>