當前位置:首頁 » 編程軟體 » 設備樹怎麼編譯

設備樹怎麼編譯

發布時間: 2022-05-29 19:48:06

A. 如何編譯高通kernal設備樹

DTS (device tree source)
.dts文件是一種ASCII 文本格式的Device
Tree描述,此文本格式非常人性化,適合人類的閱讀習慣。基本上,在ARM
linux在,一個。dts文件對應一個ARM的machine,一般放置在內核的arch/arm/boot/dts/目錄。由於一個SoC可能對應多個machine(一個SoC可以對應多個產品和電路板),勢必這些。dts文件需包含許多共同的部分,Linux內核為了簡化,把SoC公用的部分或者多個machine共同的部分一般提煉為。dtsi,類似於C語言的頭文件。其他的machine對應的。dts就include這個。dtsi。譬如,對於VEXPRESS而言,vexpress-v2m.dtsi就被vexpress-v2p-ca9.dts所引用,
vexpress-v2p-ca9.dts有如下一行:
/include/
「vexpress-v2m.dtsi」
當然,和C語言的頭文件類似,。dtsi也可以include其他的。dtsi,譬如幾乎所有的ARM
SoC的。dtsi都引用了skeleton.dtsi。
.dts(或者其include的。dtsi)基本元素即為前文所述的結點和屬性:
[plain] view
plainprint?
/ {
node1 {
a-string-property = 「A string」;
a-string-list-property = 「first string」, 「second string」;
a-byte-data-property = [0x01 0x23 0x34 0x56];
child-node1 {
first-child-property;
second-child-property = <1>;
a-string-property = 「Hello, world」;
};
child-node2 {
};
};
node2 {
an-empty-property;
a-cell-property = <1 2 3 4>; /* each number (cell) is a uint32 */
child-node1 {
};
};
};
/ {
node1 {
a-string-property = 「A string」;
a-string-list-property = 「first string」, 「second string」;
a-byte-data-property = [0x01 0x23 0x34 0x56];
child-node1 {
first-child-property;
second-child-property = <1>;
a-string-property = 「Hello, world」;
};
child-node2 {
};
};
node2 {
an-empty-property;
a-cell-property = <1 2 3 4>; /* each number (cell) is a uint32 */
child-node1 {
};
};
};
上述。dts文件並沒有什麼真實的用途,但它基本表徵了一個Device
Tree源文件的結構:
1個root結點「/」;
root結點下面含一系列子結點,本例中為「node1」 和
「node2」;
結點「node1」下又含有一系列子結點,本例中為「child-node1」 和
「child-node2」;
各結點都有一系列屬性。這些屬性可能為空,如「
an-empty-property」;可能為字元串,如「a-string-property」;可能為字元串數組,如「a-string-list-property」;可能為Cells(由u32整數組成),如「second-child-property」,可能為二進制數,如「a-byte-data-property」。
下面以一個最簡單的machine為例來看如何寫一個。dts文件。假設此machine的配置如下:
1個雙核ARM
Cortex-A9 32位處理器;
ARM的local bus上的內存映射區域分布了2個串口(分別位於0x101F1000 和
0x101F2000)、GPIO控制器(位於0x101F3000)、SPI控制器(位於0x10170000)、中斷控制器(位於0x10140000)和一個external
bus橋;
External bus橋上又連接了SMC SMC91111
Ethernet(位於0x10100000)、I2C控制器(位於0x10160000)、64MB NOR
Flash(位於0x30000000);
External bus橋上連接的I2C控制器所對應的I2C匯流排上又連接了Maxim
DS1338實時鍾(I2C地址為0x58)。
其對應的。dts文件為:
[plain] view
plainprint?
/ {
compatible = 「acme,coyotes-revenge」;
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&intc>;
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
compatible = 「arm,cortex-a9」;
reg = <0>;
};
cpu@1 {
compatible = 「arm,cortex-a9」;
reg = <1>;
};
};
serial@101f0000 {
compatible = 「arm,pl011」;
reg = <0x101f0000 0x1000 >;
interrupts = < 1 0 >;
};
serial@101f2000 {
compatible = 「arm,pl011」;
reg = <0x101f2000 0x1000 >;
interrupts = < 2 0 >;
};
gpio@101f3000 {
compatible = 「arm,pl061」;
reg = <0x101f3000 0x1000
0x101f4000 0x0010>;
interrupts = < 3 0 >;
};
intc: interrupt-controller@10140000 {
compatible = 「arm,pl190」;
reg = <0x10140000 0x1000 >;
interrupt-controller;
#interrupt-cells = <2>;
};
spi@10115000 {
compatible = 「arm,pl022」;
reg = <0x10115000 0x1000 >;
interrupts = < 4 0 >;
};
external-bus {
#address-cells = <2>
#size-cells = <1>;
ranges = <0 0 0x10100000 0x10000 // Chipselect 1, Ethernet
1 0 0x10160000 0x10000 // Chipselect 2, i2c controller
2 0 0x30000000 0x1000000>; // Chipselect 3, NOR Flash
ethernet@0,0 {
compatible = 「smc,smc91c111」;
reg = <0 0 0x1000>;
interrupts = < 5 2 >;
};
i2c@1,0 {
compatible = 「acme,a1234-i2c-bus」;
#address-cells = <1>;
#size-cells = <0>;
reg = <1 0 0x1000>;
interrupts = < 6 2 >;
rtc@58 {
compatible = 「maxim,ds1338」;
reg = <58>;
interrupts = < 7 3 >;
};
};
flash@2,0 {
compatible = 「samsung,k8f1315ebm」, 「cfi-flash」;
reg = <2 0 0x4000000>;
};
};
};
/ {
compatible = 「acme,coyotes-revenge」;
#address-cells = <1>;
#size-cells = <1>;
interrupt-parent = <&intc>;
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
compatible = 「arm,cortex-a9」;
reg = <0>;
};
cpu@1 {
compatible = 「arm,cortex-a9」;
reg = <1>;
};
};
serial@101f0000 {
compatible = 「arm,pl011」;
reg = <0x101f0000 0x1000 >;
interrupts = < 1 0 >;
};
serial@101f2000 {
compatible = 「arm,pl011」;
reg = <0x101f2000 0x1000 >;
interrupts = < 2 0 >;
};
gpio@101f3000 {
compatible = 「arm,pl061」;
reg = <0x101f3000 0x1000
0x101f4000 0x0010>;
interrupts = < 3 0 >;
};
intc: interrupt-controller@10140000 {
compatible = 「arm,pl190」;
reg = <0x10140000 0x1000 >;
interrupt-controller;
#interrupt-cells = <2>;
};
spi@10115000 {
compatible = 「arm,pl022」;
reg = <0x10115000 0x1000 >;
interrupts = < 4 0 >;
};
external-bus {
#address-cells = <2>
#size-cells = <1>;
ranges = <0 0 0x10100000 0x10000 // Chipselect 1, Ethernet
1 0 0x10160000 0x10000 // Chipselect 2, i2c controller
2 0 0x30000000 0x1000000>; // Chipselect 3, NOR Flash
ethernet@0,0 {
compatible = 「smc,smc91c111」;
reg = <0 0 0x1000>;
interrupts = < 5 2 >;
};
i2c@1,0 {
compatible = 「acme,a1234-i2c-bus」;
#address-cells = <1>;
#size-cells = <0>;
reg = <1 0 0x1000>;
interrupts = < 6 2 >;
rtc@58 {
compatible = 「maxim,ds1338」;
reg = <58>;
interrupts = < 7 3 >;
};
};
flash@2,0 {
compatible = 「samsung,k8f1315ebm」, 「cfi-flash」;
reg = <2 0 0x4000000>;
};
};
};
上述。dts文件中,root結點「/」的compatible 屬性compatible =
「acme,coyotes-revenge」;定義了系統的名稱,它的組織形式為:<manufacturer>,<model>。Linux內核透過root結點「/」的compatible
屬性即可判斷它啟動的是什麼machine。
在。dts文件的每個設備,都有一個compatible
屬性,compatible屬性用戶驅動和設備的綁定。compatible
屬性是一個字元串的列表,列表中的第一個字元串表徵了結點代表的確切設備,形式為「<manufacturer>,<model>」,其後的字元串表徵可兼容的其他設備。可以說前面的是特指,後面的則涵蓋更廣的范圍。如在arch/arm/boot/dts/vexpress-v2m.dtsi中的Flash結點:
[plain] view
plainprint?
flash@0,00000000 {
compatible = 「arm,vexpress-flash」, 「cfi-flash」;
reg = <0 0x00000000 0x04000000>,
<1 0x00000000 0x04000000>;
bank-width = <4>;
};
flash@0,00000000 {
compatible = 「arm,vexpress-flash」, 「cfi-flash」;
reg = <0 0x00000000 0x04000000>,
<1 0x00000000 0x04000000>;
bank-width = <4>;
};
compatible屬性的第2個字元串「cfi-flash」明顯比第1個字元串「arm,vexpress-flash」涵蓋的范圍更廣。
再比如,Freescale
MPC8349 SoC含一個串口設備,它實現了國家半導體(National Semiconctor)的ns16550
寄存器介面。則MPC8349串口設備的compatible屬性為compatible = 「fsl,mpc8349-uart」,
「ns16550」。其中,fsl,mpc8349-uart指代了確切的設備, ns16550代表該設備與National Semiconctor
的16550
UART保持了寄存器兼容。
接下來root結點「/」的cpus子結點下面又包含2個cpu子結點,描述了此machine上的2個CPU,並且二者的compatible
屬性為「arm,cortex-a9」。
注意cpus和cpus的2個cpu子結點的命名,它們遵循的組織形式為:<name>[@<unit-address>],<>中的內容是必選項,[]中的則為可選項。name是一個ASCII字元串,用於描述結點對應的設備類型,如3com
Ethernet適配器對應的結點name宜為ethernet,而不是3com509。如果一個結點描述的設備有地址,則應該給出@unit-address。多個相同類型設備結點的name可以一樣,只要unit-address不同即可,如本例中含有cpu@0、cpu@1以及serial@101f0000與serial@101f2000這樣的同名結點。設備的unit-address地址也經常在其對應結點的reg屬性中給出。ePAPR標准給出了結點命名的規范。

B. openwrt中怎麼在設備樹里pci的設備驅動開啟

不知道可以幫到你否,非復制粘貼,首先可以在Openwrt設置頁面上看是否正確識別出了3G 網卡,如果未識別先去看下Openwrt的固件版本和路由器型號,然後可以到Openwrt官網查詢固件是否支持該網卡,或者是預置網卡驅動否,如果沒有預置業可以到Openwrt官網查詢是否具備該型號網卡的驅動,驅動文件應該是ipk文件,傳到路由器上編譯進去即可。

C. 所有dtb對應什麼晶元

設備樹的源文件為.dts和.dtsi文件,經過設備樹專用的編譯器編譯後生成一個二進制的DTB(Device tree Blob)文件。在系統啟動時,DTB文件由bootloader載入進內存,此時,內存中的DTB成為FDT(Flat Device Tree)。Bootloader啟動kernel時,將FDT的地址傳給Kernel,在Kernel啟動的匯編階段,將FDT地址保存在「x5」寄存器中,並定義8位元組變數「__fdt_pointer」,用來表示該地址,以供Kernel的C代碼使用

D. 如何解決u-boot使用make編譯出現找不到dtc命令的問題

dtc是device-tree-compiler的縮寫,即設備樹編譯器,說明系統中沒有安裝這個編譯器,如多用的是apt-get install device-tree-compiler安裝後就可以成功編譯了。

E. u-boot使用make編譯出現找不到dtc命令,如何解決啊

我在ubuntu14.04上編譯uboot時也遇到了這個問題,dtc是device-tree-compiler的縮寫,即設備樹編譯器,說明系統中沒有安裝這個編譯器,我用的是apt-get install device-tree-compiler安裝後就可以成功編譯了哈。

F. linux的spi設備樹信息怎麼被讀入內核

linux3.0隻是個內核,用來 編譯成二進制,然後被燒到板上去。 ubuntu 是個操作系統,它是用來搭建一個linux環境,然後在這個環境下 編譯 linux內核、文件系統、linux應用程序等。(不用windows環境是因為在windows下編譯linux程序很麻煩)

G. 有誰知道nvidia tx1 上面打開攝像頭的命令是啥嗎,內核和設備樹已經編譯

可以讓設備樹文件和內核一起編譯,單獨編譯的化,可以參考下面的文檔:13996277

H. 編譯linux內核設備樹文件使用什麼命令

Linux源碼的arch/powerpc/boot/dts/目錄下存放了很多dts文件,可以作為參考文件。另外dtc編譯器在內核源碼2.6.25版本之後已經被包含進去。在2.6.26版本之後,生成blob的簡單規則已經加入makefile,如下命令:
$ make ARCH=powerpc canyonlands.dtb

也可以根據自己的硬體修改好dts文件後,用下面類似命令生成dtb文件。
$ dtc -f -I dts -O dtb -R 8 -S 0x3000 test.dts > mpc836x_mds.dtb

$ mkimage -A ppc -O Linux -T flat_dt -C none -a 0x300000 -e 0 -d mpc836x_mds.dtb mpc836x_mds.dtu

I. 如何在linux-3.x內核編譯設備樹

可以讓設備樹文件和內核一起編譯,單獨編譯的化,可以參考下面的文檔:
http://blog.csdn.net/woshigaoyuan/article/details/13996277

熱點內容
列舉貪心演算法 發布:2024-04-28 10:44:15 瀏覽:696
文具店疫情演練腳本 發布:2024-04-28 10:23:40 瀏覽:23
綠色商城源碼 發布:2024-04-28 10:04:45 瀏覽:585
點歌機伺服器是什麼 發布:2024-04-28 10:04:43 瀏覽:739
ssi框架源碼 發布:2024-04-28 09:32:56 瀏覽:723
用手機怎麼查詢伺服器的ip 發布:2024-04-28 09:00:43 瀏覽:204
macps緩存 發布:2024-04-28 08:03:26 瀏覽:538
騰訊雲伺服器銷售好做嗎 發布:2024-04-28 08:03:23 瀏覽:587
編程的碼 發布:2024-04-28 08:02:41 瀏覽:546
c封裝資料庫 發布:2024-04-28 07:59:27 瀏覽:684