1GKI Tools for Android Kernels 2============================= 3 4Overview 5-------- 6 7This directory contains helpful tools that may be used to aid in the 8development of modularized drivers. 9 10add_EXPORT_SYMBOLS_GPL 11---------------------- 12 13 USAGE: add_EXPORT_SYMBOL_GPL [--no-skip-arch] < kernel_build_error_log 14 add_EXPORT_SYMBOL_GPL [--no-skip-arch] kernel_build_error_log 15 grep /<module>[.]ko build_error_log | add_EXPORT_SYMBOL_GPL [--no-skip-arch] 16 vi `add_EXPORT_SYMBOL_GPL [--no-skip-arch] < kernel_build_error_log` 17 18To acquire the kernel_build_error_log eg: 19 20 $ ./build_sm8250.sh -j50 2>&1 | tee kernel_build_error_log 21 22To only create commit related to symbols needed for cam_spec.ko module: 23 24 $ grep /cam_spec[.]ko kernel_build_error_log | add_EXPORT_SYMBOL_GPL 25 26The script will only affect the current directory level and downward, 27this allows one to segregate the adjusted content. Any symbols that 28are needed outside the range of that directory will result in errors 29and the git commit phase will not be performed. 30 31Add EXPORT_SYMBOL_GPL for any noted missing symbols, output the list of files 32modified to stdout (so it can be passed to an editor command line should you 33need to check or adjust the results). Automatically commit the list of files 34into git. 35 36Deals as simply as it can to handle \_\_trace\_\<symbols>, sorting the result. 37 38Keep in mind exports can change, be added or subtracted, and that preliminary 39work may expose or remove required symbols to resolve during later work. As 40such this script only adds, so you may need to revert the results and try 41again to get the most up to date set. By making this part automated it can 42deal with the tens or thousands of exports that need to be discovered or 43added. If you need to adjust a subsystem, run this script in the subsystem 44directory, and it will only adjust from that point downwards leaving other 45higher up trees alone. 46 47add_MODULE_LICENSE 48------------------ 49 50 USAGE: add_MODULE_LICENSE < kernel_build_error_log 51 add_MODULE_LICENSE kernel_build_error_log 52 53Add MODULE_LICENSE to all the files. 54 55Must be performed in the root directory. 56 57find_circular 58------------- 59 60 USAGE: find_circular [dir] 61 62Call this when depmod breaks down, or when one needs a list of the symbols 63implicated in the circular dependency. 64 65Search current or dir directory for all kernel modules. Itemize what they 66export, and what they import. Discover links and report who fulfills them. 67Report any first order circular relationships and the symbols that got us 68into the situation. 69 70Standard output is of the form: 71 72module1.ko(symbols) -> module2.ko(symbols) -> module1.ko 73 74Leaves an annotated modules.dep file in the specified directory. 75 76device_snapshot 77--------------- 78 79 USAGE: device_snapshot [-s <serialno>] [-D] [-f [<input>]] [-F [-o <output> [-d <input>]]] 80 81Collect filtered /dev and /sys details, along with dmesg and probe list. 82 83-o \<output> will drop the collection into a set of files, but will not 84overrite existing content. -F will overwrite. 85 86-D will wait for the display 87 88if \<output> is empty ('' or last option), will not collect dmesg or probe 89list. If no -o option is specified, then \<output> will be default of - 90(stdout) and all pieces will go to the standard output separated by a cut 91and snip header. If specified, \<output> will contain the filtered /dev/ 92and /sys/ dumps, \<output>.probed the subset filter of just the probed drivers, 93\<output>.dmesg the kernel logs and \<output>.config the uncompressed 94/proc/config.gz. 95 96-d \<input> will take the dropped collection specified to -o \<output> and 97produce a diff -U1 output compared against the \<input>. 98 99-f \<input> allows one to utilize the filter to an existing find /dev /sys 100output from a device. No dmesg will be collected. 101 102-s \<serialno> will allow one to specify a device to connect to when multiples 103are available, otherwise will default to one available or ANDROID_SERIAL 104environment variable. 105 106In your local build/flash/boot script for tight development cycles, add 107 108 SEQ=`for i in out/${DEFAULT_BUILD}.snapshot.[0-9]*; do 109 echo ${i#out/${DEFAULT_BUILD}.snapshot.} 110 done | 111 sed 's/^0*//' | 112 grep -v 0-9 | 113 tr -d .[:alpha:] | 114 sort -nu | 115 tail -1` && 116 NEWSEQ=$((${SEQ:-0}+1)) && 117 NEWSEQ=`printf "%03u" ${NEWSEQ}` 118 if [ -z "${SEQ}" ]; then 119 private/msm-google/scripts/gki/device_snapshot \ 120 -o out/${DEFAULT_BUILD}.snapshot.${NEWSEQ} 121 else 122 SEQ=`printf "%03u" ${SEQ}` 123 private/msm-google/scripts/gki/device_snapshot \ 124 -o out/${DEFAULT_BUILD}.snapshot.${NEWSEQ} \ 125 -d out/${DEFAULT_BUILD}.snapshot.${SEQ} 126 fi 127 128instrument_module_init 129---------------------- 130 USAGE: instrument_module_init [dir|file] 131 132Add debug instrumentation to module_init and probe functions. 133