大樹底下好乘涼 ︰ 《拜樹頭》 ? ※ 碩果不食

碩果不食

□︰今已有兩極四方,恐入八卦矣!

○︰所為何事?

□︰圍城而不攻?是何故耶??

○︰是所謂碩果不食。能上不能下?窮之災!囧之禍乎??

○︰《易》有剝極來復之道!!

與時並進者遭遇『困難』,面對『未知』是再自然不過的事。如之何『求解』正砥礪著學者的『百折不撓』之精神。『九天九地』的探尋,難到不會有『一陽來復』之時?深體自由軟體者之心??

假使仔細閱讀《 Device Tree on ARCH_BCM2708 》,留心一下『那個人』── notro ── 與『那個時間』── on Jul 30, 2014 ──,也許我們不只對樹莓派『裝置樹』有更多的了解,更能明白許多的貢獻其來有自,正所謂『德不孤,必有鄰』乎!!

此處將僅簡單說說幾個工具程式,以及簡介它們的用法。

常用縮寫︰

DT 】︰  Device Tree
FDT 】︰ Flattended Device Tree: a DT representation used in the dtb blob.
.dtb 】︰ Device Tree Binary
.dts 】︰ Device Tree Source
.dtsi 】︰ Device Tree Source Include
dtc 】︰ Device Tree Compiler

 

# dtc 的用法說明

pi@raspberrypi ~ dtc -h Usage: dtc [options] <input file>  Options: -[qI:O:o:V:d:R:S:p:fb:i:H:sW:E:hv@]   -q, --quiet                 	Quiet: -q suppress warnings, -qq errors, -qqq all   -I, --in-format <arg>       	Input formats are: 		dts - device tree source text 		dtb - device tree blob 		fs  - /proc/device-tree style directory   -o, --out <arg>             	Output file   -O, --out-format <arg>      	Output formats are: 		dts - device tree source text 		dtb - device tree blob 		asm - assembler source   -V, --out-version <arg>     	Blob version to produce, defaults to %d (for dtb and asm output)   -d, --out-dependency <arg>  	Output dependency file   -R, --reserve <arg>         	tMake space for <number> reserve map entries (for dtb and asm output)   -S, --space <arg>           	Make the blob at least <bytes> long (extra space)   -p, --pad <arg>             	Add padding to the blob of <bytes> long (extra space)   -b, --boot-cpu <arg>        	Set the physical boot cpu   -f, --force                 	Try to produce output even if the input tree has errors   -i, --include <arg>         	Add a path to search for include files   -s, --sort                  	Sort nodes and properties before outputting (useful for comparing trees)   -H, --phandle <arg>         	Valid phandle formats are: 		legacy - "linux,phandle" properties only 		epapr  - "phandle" properties only 		both   - Both "linux,phandle" and "phandle" properties   -W, --warning <arg>         	Enable/disable warnings (prefix with "no-")   -E, --error <arg>           	Enable/disable errors (prefix with "no-")   -@, --symbols <arg>         	Symbols and Fixups support   -h, --help                  	Print this help and exit   -v, --version               	Print version and exit  # 範例︰解碼當下使用裝置樹 dtc -I fs -O dts -o runtime.dts /proc/device-tree    # fdtdump 的用法說明 pi@raspberrypi ~ fdtdump -h
Usage: fdtdump [options] 

Options: -[dshV]
  -d, --debug   Dump debug information while decoding the file
  -s, --scan    Scan for an embedded fdt in file
  -h, --help    Print this help and exit
  -V, --version Print version and exit

# 範例︰顯示 dtb 內容
fdtdump /boot/overlays/lirc-rpi-overlay.dtb



# fdtget 的用法說明
pi@raspberrypi ~ fdtget -h Usage: read values from device tree 	fdtget   [ ]... 	fdtget -p   [ ]...  Each value is printed on a new line. 	s=string, i=int, u=unsigned, x=hex 	Optional modifier prefix: 		hh or b=byte, h=2 byte, l=4 byte (default)  Options: -[t:pld:hV]   -t, --type     Type of data   -p, --properties    List properties for each node   -l, --list          List subnodes for each node   -d, --default  Default value to display when the property is missing   -h, --help          Print this help and exit   -V, --version       Print version and exit  # 範例︰讀取預設 bcm2709-rpi-2-b.dtb 的 spi 狀態︰ fdtget /boot/bcm2709-rpi-2-b.dtb /soc/spi@7e204000 status  disabled  # 如果 config.txt 有 dtparam=spi=on ,假使檢查 runtime dtc -I fs -O dtb -o runtime.dtb /proc/device-tree fdtget runtime.dtb /soc/spi@7e204000 status  okay    # fdtput 的用法說明 pi@raspberrypi ~ fdtput -h
Usage: write a property value to a device tree
	fdtput 
   [...]
	fdtput -c 
 [...]

The command line arguments are joined together into a single value.
	s=string, i=int, u=unsigned, x=hex
	Optional modifier prefix:
		hh or b=byte, h=2 byte, l=4 byte (default)

Options: -[cpt:vhV]
  -c, --create     Create nodes if they don't already exist
  -p, --auto-path  Automatically create nodes as needed for the node path
  -t, --type  Type of data
  -v, --verbose    Display each value decoded from command line
  -h, --help       Print this help and exit
  -V, --version    Print version and exit

# 範例︰
cp /boot/bcm2709-rpi-2-b.dtb .
fdtput --type s bcm2709-rpi-2-b.dtb /soc/spi@7e204000 status "okay"
fdtget bcm2709-rpi-2-b.dtb /soc/spi@7e204000 status