summaryrefslogtreecommitdiff
path: root/sys/tools
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2018-03-24 21:30:24 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2018-03-24 21:30:24 +0000
commitc2f5940db3c7f6b7e584b93edba6d057c0dfc51d (patch)
treed130863769c832ead17d024f429120dcdf05a15b /sys/tools
parentfb15890a8c14818c6bfb9620a4551dd3ae0b4184 (diff)
downloadsrc-test2-c2f5940db3c7f6b7e584b93edba6d057c0dfc51d.tar.gz
src-test2-c2f5940db3c7f6b7e584b93edba6d057c0dfc51d.zip
Add dtb overlays support
DTB Overlays are useful to change/add nodes to a dtb without the need to modify it. Add support for building dtbo during buildkernel. The goal of DTBO present in the FreeBSD source tree is to fill a gap in time when we submit changes upstream (Linux). Instead of waiting 2 to 4 months we can add a DTBO in tree in the meantime. This is not for adding DTBO for capes/hat/addon boards, those will be better to put in a ports. This is also not for enabling a i2c/spi/pwm controller on certain pins, each user have a different use case for those (which pins to use etc ...) and we cannot have all possible configuration. Add a dtbo for sun8i-h3-sid which add the SID node missing in upstream dts. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D14782
Notes
Notes: svn path=/head/; revision=331499
Diffstat (limited to 'sys/tools')
-rwxr-xr-xsys/tools/fdt/make_dtbo.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/tools/fdt/make_dtbo.sh b/sys/tools/fdt/make_dtbo.sh
new file mode 100755
index 000000000000..3a438ac5d5aa
--- /dev/null
+++ b/sys/tools/fdt/make_dtbo.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+# Script generates dtbo file ($3) from dtso source ($2) in build tree S ($1)
+S=$1
+dtso="$2"
+dtbo_path=$3
+
+if [ -z "$dtso" ]; then
+ echo "No DTS overlays specified"
+ exit 1
+fi
+
+if [ -z "${MACHINE}" ]; then
+ MACHINE=$(uname -m)
+fi
+
+: ${DTC:=dtc}
+
+for d in ${dtso}; do
+ dtb=${dtbo_path}/`basename $d .dtso`.dtbo
+ echo "converting $d -> $dtb"
+ cpp -P -x assembler-with-cpp -I $S/gnu/dts/include -I $S/dts/${MACHINE} -I $S/gnu/dts/${MACHINE} -include $d /dev/null |
+ ${DTC} -@ -O dtb -o $dtb -i $S/dts/${MACHINE} -i $S/gnu/dts/${MACHINE}
+done