ECE 441 · Week 3
Modern Computer: Secure Infrastructure
How to diff the live device tree against the source tree.
Week 3 of 10 · Solitude
ECE 441 · Week 3 · In class
How to diff the live device tree against the source tree.
- Bring the section titles already written on your week-1 table.
ECE 441 · Week 3 · In class
Copy three section titles from the week-1 table you already turned in, onto a page, before you open the live tree.
- Those three titles are the homework.
- In the lab, diff the live tree against the source tree.
- The hand-in is that diff, plus three week-1 titles that do not appear in the live tree.
- A title that did appear stays out of those three.
ECE 441 · Week 3 · Lecture
Two trees, one board
- The source tree is the
.dtsin the repository, compiled to a.dtb. - The live tree is what the kernel booted with, under
/proc/device-tree. - Between the two, the bootloader and any overlays may add, change, or delete nodes.
- The diff shows what changed on the way; nothing else does.
ECE 441 · Week 3 · Lecture
Making the two comparable
# live tree, decompiled and sorted
dtc -q -s -I fs -O dts -o live.dts /proc/device-tree
# source tree, compiled then decompiled the same way
dtc -q -s -I dtb -O dts -o src.dts board.dtb
diff -u src.dts live.dts > tree.diff
-s sorts nodes and properties, so order alone does not show as a difference.
ECE 441 · Week 3 · Lecture
Reading the diff
| Difference | Usual cause |
|---|---|
/chosen gains bootargs | The bootloader passed the command line |
A memory node is filled in | The bootloader measured the DRAM size |
| MAC or serial number appears | The bootloader fixed it up |
status flips to "okay" | An overlay enabled a device |
| phandle values differ | Numbering, usually not a change |
ECE 441 · Week 3 · Lecture
Looking for a title in the tree
grep -n 'compatible' live.dts
ls /proc/device-tree/
find /proc/device-tree -name 'status' | head
- A section title from a document is a name for a block; the tree uses node names and compatible strings.
- Not finding a block in the live tree is a finding: the board does not describe it to the kernel.
ECE 441 · Week 3 · Lab
Lab
- Diff the live device tree against the source tree.
- For three section titles from your week-1 table, write down each title that does not appear in the live tree. Second pass: name one title that did appear, and leave it out of the three you turn in.
- Assemble the lab hand-in: The diff of the live device tree against the source tree, plus three week-1 section titles that do not appear in the live tree.
ECE 441 · Week 3 · Lab
Hand in
The diff of the live device tree against the source tree, plus three week-1 section titles that do not appear in the live tree.
ECE 441 · Week 3 · Homework
Homework
- From the week-1 table you already turned in, copy three section titles onto a page before you open the live tree.
ECE 441 · Week 3 · Homework
Turn in
Three section titles copied from the week-1 table you already turned in.
ECE 441 · Week 3 · Read
Read
On the lab site: Module 5, Memory bring-up, and Module 9, Device tree and pin multiplexing, show the tree. This week grades the diff and the three titles.
ECE 441 · Week 3 · Next
Week 4
A rebuild has an identity: the hash of its image, and one console line only that build prints.