blob: 241946e942ff02a3ddaac35e97b84069ab15028d [file] [log] [blame]
Li Chenf6c209b2016-11-28 12:15:33 +08001#!/bin/bash
SzuWei Lin4f00eda2017-04-06 17:12:27 +08002# 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.
Li Chenf6c209b2016-11-28 12:15:33 +080015
16alert() {
17 echo "$*" >&2
18}
19
20die() {
21 echo "ERROR: $@"
22 exit 1
23}
24
25command_exists () {
26 type "$1" &> /dev/null;
27}
28
Li Chenf6c209b2016-11-28 12:15:33 +080029remove_local_fixups() {
30 sed '/__local_fixups__/ {s/^\s*__local_fixups__\s*//; :again;N; s/{[^{}]*};//; /^$/ !b again; d}' $1
31}
32
33remove_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
SzuWei Linb63f3b72017-01-10 11:54:22 +080038dts_diff () {
39 diff -u <(cat "$1" | remove_overlay_stuff) <(cat "$2" | remove_overlay_stuff)
Li Chenf6c209b2016-11-28 12:15:33 +080040}