1 #!/bin/bash 2 # Copyright (C) 2016 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 alert() { 17 echo "$*" >&2 18 } 19 20 die() { 21 echo "ERROR: $@" 22 exit 1 23 } 24 25 command_exists () { 26 type "$1" &> /dev/null; 27 } 28 29 remove_local_fixups() { 30 sed '/__local_fixups__/ {s/^\s*__local_fixups__\s*//; :again;N; s/{[^{}]*};//; /^$/ !b again; d}' $1 31 } 32 33 remove_overlay_stuff() { 34 # remove __symbols__, phandle, "linux,phandle" and __local_fixups__ 35 sed "/__symbols__/,/[}];/d" $1 | sed "/\(^[ \t]*phandle\)/d" | sed "/\(^[ \t]*linux,phandle\)/d" | sed '/^\s*$/d' | remove_local_fixups 36 } 37 38 dts_diff () { 39 diff -u <(cat "$1" | remove_overlay_stuff) <(cat "$2" | remove_overlay_stuff) 40 } 41