~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/dtc/dtx_diff

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/dtc/dtx_diff (Version linux-6.12-rc7) and /scripts/dtc/dtx_diff (Version linux-2.6.32.71)


  1 #! /bin/bash                                      
  2 # SPDX-License-Identifier: GPL-2.0-only           
  3                                                   
  4 # Copyright (C) 2015 Frank Rowand                 
  5 #                                                 
  6                                                   
  7                                                   
  8 usage() {                                         
  9                                                   
 10         # use spaces instead of tabs in the us    
 11         cat >&2 <<eod                             
 12                                                   
 13 Usage:                                            
 14                                                   
 15    `basename $0` DTx                              
 16         decompile DTx                             
 17                                                   
 18    `basename $0` DTx_1 DTx_2                      
 19         diff DTx_1 and DTx_2                      
 20                                                   
 21                                                   
 22       --annotate    synonym for -T                
 23       --color       synonym for -c (requires d    
 24        -c           enable colored output         
 25        -f           print full dts in diff (--    
 26        -h           synonym for --help            
 27        -help        synonym for --help            
 28       --help        print this message and exi    
 29        -s SRCTREE   linux kernel source tree i    
 30                         (default is current di    
 31        -S           linux kernel source tree i    
 32        -T           annotate output .dts with     
 33                         (-T -T for more detail    
 34        -u           unsorted, do not sort DTx     
 35                                                   
 36                                                   
 37 Each DTx is processed by the dtc compiler to p    
 38 file.  If DTx is a dts source file then it is     
 39 manner as done for the compile of the dts sour    
 40 build system ('#include' and '/include/' direc    
 41                                                   
 42 If two DTx are provided, the resulting dts sou    
 43                                                   
 44 If DTx is a directory, it is treated as a DT s    
 45   /proc/device-tree.                              
 46                                                   
 47 If DTx contains the binary blob magic value in    
 48   it is treated as a binary blob (aka .dtb or     
 49                                                   
 50 Otherwise DTx is treated as a dts source file     
 51                                                   
 52    If this script is not run from the root of     
 53    and DTx utilizes '#include' or '/include/'     
 54    linux source tree can be provided by '-s SR    
 55    include paths will be set properly.            
 56                                                   
 57    The shell variable \${ARCH} must provide th    
 58    the dts source file for include paths to be    
 59    or '/include/' to be processed.                
 60                                                   
 61    If DTx_1 and DTx_2 are in different archite    
 62    may not work since \${ARCH} is part of the     
 63    workaround can be used:                        
 64                                                   
 65       `basename $0` ARCH=arch_of_dtx_1 DTx_1 >    
 66       `basename $0` ARCH=arch_of_dtx_2 DTx_2 >    
 67       `basename $0` tmp_dtx_1.dts tmp_dtx_2.dt    
 68       rm tmp_dtx_1.dts tmp_dtx_2.dts              
 69                                                   
 70    If DTx_1 and DTx_2 are in different directo    
 71    add the path of DTx_1 and DTx_2 to the incl    
 72    a local file that exists in both the path o    
 73    file in the path of DTx_1 will incorrectly     
 74    workaround:                                    
 75                                                   
 76       `basename $0` DTx_1 >tmp_dtx_1.dts          
 77       `basename $0` DTx_2 >tmp_dtx_2.dts          
 78       `basename $0` tmp_dtx_1.dts tmp_dtx_2.dt    
 79       rm tmp_dtx_1.dts tmp_dtx_2.dts              
 80                                                   
 81 eod                                               
 82 }                                                 
 83                                                   
 84                                                   
 85 compile_to_dts() {                                
 86                                                   
 87         dtx="$1"                                  
 88         dtc_include="$2"                          
 89                                                   
 90         if [ -d "${dtx}" ] ; then                 
 91                                                   
 92                 # -----  input is file tree       
 93                                                   
 94                 if ( ! ${DTC} -I fs ${dtx} ) ;    
 95                         exit 3                    
 96                 fi                                
 97                                                   
 98         elif [ -f "${dtx}" ] && [ -r "${dtx}"     
 99                                                   
100                 magic=`hexdump -n 4 -e '/1 "%0    
101                 if [ "${magic}" = "d00dfeed" ]    
102                                                   
103                         # -----  input is FDT     
104                                                   
105                         if ( ! ${DTC} -I dtb $    
106                                 exit 3            
107                         fi                        
108                                                   
109                         return                    
110                                                   
111                 fi                                
112                                                   
113                 # -----  input is DTS (source)    
114                                                   
115                 if ( cpp ${cpp_flags} -x assem    
116                         | ${DTC} ${dtc_include    
117                         return                    
118                 fi                                
119                                                   
120                 echo ""                           
121                 echo "Possible hints to resolv    
122                 echo "  (hints might not fix t    
123                                                   
124                 hint_given=0                      
125                                                   
126                 if [ "${ARCH}" = "" ] ; then      
127                         hint_given=1              
128                         echo ""                   
129                         echo "  shell variable    
130                 fi                                
131                                                   
132                 dtx_arch=`echo "/${dtx}" | sed    
133                                                   
134                 if [ "${dtx_arch}" != ""  -a "    
135                         hint_given=1              
136                         echo ""                   
137                         echo "  architecture $    
138                         echo "  but does not m    
139                         echo "  >>\$ARCH<< is:    
140                 fi                                
141                                                   
142                 if [ ! -d ${srctree}/arch/${AR    
143                         hint_given=1              
144                         echo ""                   
145                         echo "  ${srctree}/arc    
146                         echo "  Is \$ARCH='${A    
147                         echo "  Possible fix:     
148                                                   
149                         git_root=`git rev-pars    
150                         if [ -d ${git_root}/ar    
151                                 echo "  Possib    
152                         fi                        
153                 fi                                
154                                                   
155                 if [ $hint_given = 0 ] ; then     
156                         echo ""                   
157                         echo "  No hints avail    
158                 fi                                
159                                                   
160                 echo ""                           
161                                                   
162                 exit 3                            
163                                                   
164         else                                      
165                 echo ""                           
166                 echo "ERROR: ${dtx} does not e    
167                 echo ""                           
168                 exit 2                            
169         fi                                        
170                                                   
171 }                                                 
172                                                   
173                                                   
174 # -----  start of script                          
175                                                   
176 annotate=""                                       
177 cmd_diff=0                                        
178 diff_flags="-u"                                   
179 diff_color=""                                     
180 dtx_file_1=""                                     
181 dtx_file_2=""                                     
182 dtc_sort="-s"                                     
183 help=0                                            
184 srctree=""                                        
185                                                   
186                                                   
187 while [ $# -gt 0 ] ; do                           
188                                                   
189         case $1 in                                
190                                                   
191         -c | --color )                            
192                 if diff --color /dev/null /dev    
193                         diff_color="--color=al    
194                 fi                                
195                 shift                             
196                 ;;                                
197                                                   
198         -f )                                      
199                 diff_flags="--unified=999999"     
200                 shift                             
201                 ;;                                
202                                                   
203         -h | -help | --help )                     
204                 help=1                            
205                 shift                             
206                 ;;                                
207                                                   
208         -s )                                      
209                 srctree="$2"                      
210                 shift 2                           
211                 ;;                                
212                                                   
213         -S )                                      
214                 git_root=`git rev-parse --show    
215                 srctree="${git_root}"             
216                 shift                             
217                 ;;                                
218                                                   
219         -T | --annotate )                         
220                 if [ "${annotate}"  = "" ] ; t    
221                         annotate="-T"             
222                 elif [ "${annotate}"  = "-T" ]    
223                         annotate="-T -T"          
224                 fi                                
225                 shift                             
226                 ;;                                
227         -u )                                      
228                 dtc_sort=""                       
229                 shift                             
230                 ;;                                
231                                                   
232         *)                                        
233                 if [ "${dtx_file_1}"  = "" ] ;    
234                         dtx_file_1="$1"           
235                 elif [ "${dtx_file_2}" = "" ]     
236                         dtx_file_2="$1"           
237                 else                              
238                         echo ""                   
239                         echo "ERROR: Unexpecte    
240                         echo ""                   
241                         exit 2                    
242                 fi                                
243                 shift                             
244                 ;;                                
245                                                   
246         esac                                      
247                                                   
248 done                                              
249                                                   
250 if [ "${srctree}" = "" ] ; then                   
251         srctree="."                               
252 fi                                                
253                                                   
254 if [ "${dtx_file_2}" != "" ]; then                
255         cmd_diff=1                                
256 fi                                                
257                                                   
258 if (( ${help} )) ; then                           
259         usage                                     
260         exit 1                                    
261 fi                                                
262                                                   
263 # this must follow check for ${help}              
264 if [ "${dtx_file_1}" = "" ]; then                 
265         echo ""                                   
266         echo "ERROR: parameter DTx required"      
267         echo ""                                   
268         exit 2                                    
269 fi                                                
270                                                   
271                                                   
272 # -----  prefer dtc from linux kernel, allow f    
273                                                   
274 if [ "${KBUILD_OUTPUT:0:2}" = ".." ] ; then       
275         __KBUILD_OUTPUT="${srctree}/${KBUILD_O    
276 elif [ "${KBUILD_OUTPUT}" = "" ] ; then           
277         __KBUILD_OUTPUT="."                       
278 else                                              
279         __KBUILD_OUTPUT="${KBUILD_OUTPUT}"        
280 fi                                                
281                                                   
282 DTC="${__KBUILD_OUTPUT}/scripts/dtc/dtc"          
283                                                   
284 if [ ! -x ${DTC} ] ; then                         
285         __DTC="dtc"                               
286         if grep -q "^CONFIG_DTC=y" ${__KBUILD_    
287                 make_command='                    
288          make scripts'                            
289         else                                      
290                 make_command='                    
291          Enable CONFIG_DTC in the kernel confi    
292          make scripts'                            
293         fi                                        
294         if ( ! which ${__DTC} >/dev/null ) ; t    
295                                                   
296                 # use spaces instead of tabs i    
297                 cat >&2 <<eod                     
298                                                   
299 ERROR: unable to find a 'dtc' program             
300                                                   
301    Preferred 'dtc' (built from Linux kernel so    
302    is not executable.                             
303                                                   
304       'dtc' is: ${DTC}                            
305                                                   
306       If it does not exist, create it from the    
307 ${make_command}                                   
308                                                   
309       If not at the root of the Linux kernel s    
310       may need to be specified to find 'dtc'.     
311                                                   
312       If 'O=\${dir}' is specified in your Linu    
313       'export KBUILD_OUTPUT=\${dir}' or add \$    
314       before running.                             
315                                                   
316       If \${KBUILD_OUTPUT} is a relative path,    
317       this script from the root of the Linux k    
318                                                   
319    Fallback '${__DTC}' was also not in \${PATH    
320                                                   
321 eod                                               
322                 exit 2                            
323         fi                                        
324         DTC=${__DTC}                              
325 fi                                                
326                                                   
327                                                   
328 # -----  cpp and dtc flags same as for linux s    
329 #        plus directories of the dtx file(s)      
330                                                   
331 dtx_path_1_dtc_include="-i `dirname ${dtx_file    
332                                                   
333 dtx_path_2_dtc_include=""                         
334 if (( ${cmd_diff} )) ; then                       
335         dtx_path_2_dtc_include="-i `dirname ${    
336 fi                                                
337                                                   
338 cpp_flags="\                                      
339         -nostdinc                                 
340         -I${srctree}/scripts/dtc/include-prefi    
341         -undef -D__DTS__"                         
342                                                   
343 DTC="\                                            
344         ${DTC}                                    
345         -i ${srctree}/scripts/dtc/include-pref    
346         -O dts -qq -f ${dtc_sort} ${annotate}     
347                                                   
348                                                   
349 # -----  do the diff or decompile                 
350                                                   
351 if (( ${cmd_diff} )) ; then                       
352                                                   
353         diff ${diff_flags} ${diff_color} --lab    
354                 <(compile_to_dts "${dtx_file_1    
355                 <(compile_to_dts "${dtx_file_2    
356                                                   
357 else                                              
358                                                   
359         compile_to_dts "${dtx_file_1}" "${dtx_    
360                                                   
361 fi                                                
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php