一、脚本编写
适配系统的时候,需要查找一些依赖文件,手工用winhex或UltraEdit来找挺麻烦的。
所以写了个shell脚本,用来批量取得这些依赖关系。
在linux系统下,把如下内容存为getNEED.sh
#/bin/bash
#by benjaminwan V0.2
printf "**************************************\n"
printf "please put this shell to system folder\n"
printf "**************************************\n"
function getNeed()
{
echo '<<<<<<getting NEED for '$1'>>>>>>'
case $1 in
lib/hw)
name=lib_hw
;;
vendor/bin)
name=vendor_bin
;;
vendor/lib)
name=vendor_lib
;;
vendor/lib/hw)
name=vendor_lib_hw
;;
*)
name=$1
;;
esac
if [ ! -d $1 ];then
printf "can't find $1 folder!\n"
else
ls $1 -p | grep [^/]$ > info_$name.txt
cat info_$name.txt |while read line
do
echo "getting NEED for" $line
echo $line >> Need_$nam

本文介绍了一种使用shell脚本在Linux环境下批量获取bin/lib文件依赖关系的方法。通过编写getNEED.sh脚本,可以方便地解析ROM中的文件依赖,如示例中adb依赖于libc.so、libstdc++.so和libm.so。当遇到无法直接识别的依赖时,可以使用grep命令进行查找。
最低0.47元/天 解锁文章
33万+

被折叠的 条评论
为什么被折叠?



