33 lines
807 B
Bash
33 lines
807 B
Bash
#!/bin/bash
|
|
|
|
DEVICE=$1
|
|
|
|
if [ ! "$DEVICE" ]; then
|
|
echo "usage: $0 <device-name>"
|
|
exit 1
|
|
fi
|
|
|
|
SRC=$DEVICE.dts
|
|
TMP=$DEVICE.tmp.dts
|
|
DST=$DEVICE.dtb
|
|
DTC=dtc #../../../../scripts/dtc/dtc
|
|
LINUX_INCLUDE=../../../../../include # remove one ../ if you're working with arm tree
|
|
|
|
|
|
echo "-- Preprocess $SRC to $TMP"
|
|
cpp -nostdinc -I$LINUX_INCLUDE -undef -x assembler-with-cpp "$SRC" > "$TMP" || exit $?
|
|
|
|
echo "-- Compile $TMP"
|
|
$DTC -O dtb -b 0 -o "$DST" "$TMP" || exit $?
|
|
|
|
#echo "-- Decompile $DST to $IDE.decompiled.dts.tmp"
|
|
#$DTC -O dts -s -o "$IDE".decompiled.dts.tmp "$DST" || exit $?
|
|
|
|
#echo "-- Deleting phandles for easier diffs"
|
|
#grep -vE "\sphandle|\slinux,phandle" "$IDE".decompiled.dts.tmp > "$IDE".decompiled.dts || exit $?
|
|
#rm "$IDE".decompiled.dts.tmp
|
|
|
|
echo "-- Remove $TMP"
|
|
rm "$TMP"
|
|
|
|
exit 0 |