Skip to content

Instantly share code, notes, and snippets.

@evadot
Created January 14, 2018 20:22
Show Gist options
  • Save evadot/f6b30fa582253ccf7b9652523b80c47f to your computer and use it in GitHub Desktop.
Save evadot/f6b30fa582253ccf7b9652523b80c47f to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ $# -ne 2 ]; then
echo "Usage: make_dtb.sh arch dtsfile"
exit 1
fi
case $1 in
arm)
dtsfile=$2
vendor=""
arch=arm
;;
arm64)
dtsfile=$(echo $2 | cut -d '/' -f 2)
vendor=$(echo $2 | cut -d '/' -f 1)
vendor="${vendor}/"
arch="arm64"
;;
esac
dtbfile=$(echo ${dtsfile} | sed 's/dts/dtb/')
cpp -P -x assembler-with-cpp -I include/ -I arch/arm/boot/dts/ -I arch/arm64/boot/dts/ -include arch/${arch}/boot/dts/${vendor}${dtsfile} /dev/null | dtc -@ -O dtb -o ${dtbfile} -b 0 -p 1024 -i include/ -i arch/arm/boot/dts/ -i arch/arm64/boot/dts/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment