Last active
September 28, 2023 07:26
-
-
Save orangecms/2d014eb3a21123b4da89d13f974f7c6b to your computer and use it in GitHub Desktop.
Preprocess DTS includes and flatten the tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# https://stackoverflow.com/a/50658776 | |
_INC="-I include -I arch/riscv/include" | |
_TMP=/tmp/resolved.dts | |
_OUT=/tmp/recompiled.dts | |
cpp -nostdinc $_INC -undef -x assembler-with-cpp "$1" $_TMP | |
# sed -i '/^#.*/d' $_TMP | |
echo Preprocessed / resolved DTS: $_TMP | |
dtc -O dts -o $_OUT $_TMP | |
echo Recompiled / flattened DTS: $_OUT | |
echo "To compile a dtb, run:\n dtc -o out.dtb $_TMP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A handy little
dts2svd
wrapper around the generator (adjust as needed):Passing the DTS from U-Boot as is fails resolving the includes: