freebsd-dev/sys/tools/fdt/make_dtb.sh
Emmanuel Vadot efdf807990 Switch to the new device-tree vendor tree
The old vendor tree was never fully merged and doing partial merge isn't
supported with git subtree merge so a new one was created.
Switch the build to use the new DTS from sys/contrib/device-tree
This also bump the DTS used to be in sync with Linux 5.9
While here change the way to get the linux version, simply hardcode
the value in sys/dts/freebsd-compatible.dts and use awk to get that
to put it in the CFLAGS.
As a bonus we now have the bindings docs available
in sys/contrib/device-tree/Bindings/ so no need to link to the Linux repo
or to the vendor tree.
2021-01-15 20:08:39 +01:00

29 lines
788 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
# Script generates dtb file ($3) from dts source ($2) in build tree S ($1)
S=$1
dts="$2"
dtb_path=$3
if [ -z "$dts" ]; then
echo "No DTS specified"
exit 1
fi
if [ -z "${MACHINE}" ]; then
MACHINE=$(uname -m)
fi
: "${DTC:=dtc}"
: "${ECHO:=echo}"
: "${CPP:=cpp}"
for d in ${dts}; do
dtb="${dtb_path}/$(basename "$d" .dts).dtb"
${ECHO} "converting $d -> $dtb"
${CPP} -P -x assembler-with-cpp -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -I "$S/contrib/device-tree/src/" -include "$d" -include "$S/dts/freebsd-compatible.dts" /dev/null |
${DTC} -@ -O dtb -o "$dtb" -b 0 -p 1024 -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}" -i "$S/contrib/device-tree/src/"
done