First, script writing
When adapting the system, you need to find some dependent files, manual use of Winhex or UltraEdit to find a very troublesome.
So I wrote a shell script to get these dependencies in batches.
Under the Linux system, save the following as Getneed.sh
[Plain]View Plaincopy print?
- #/bin/bash
- #by Changyuet
- printf "**************************************\n"
- printf "Put this shell to system folder\n"
- printf "**************************************\n"
- function Getneed ()
- {
- Echo ' <<<<<<getting need for ' >>>>>> '
- Case $ 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 $];then
- printf "can ' t find $ 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_$name.txt
- Objdump-x $1/$line | grep "NEEDED" >> need_$name.txt
- echo "*************************************" >> need_$name.txt
- Done
- RM info_$name.txt
- Fi
- }
- Getneed bin;
- Getneed Lib;
- Getneed LIB/HW;
- Getneed Vendor/bin;
- Getneed Vendor/lib;
- Getneed VENDOR/LIB/HW;
- printf "**********completed!**********\n"
Ii. Description of Use
The following operations are done under Linux (operating under Linux ext3 or EXT4 file systems), first ensure that your Linux has objdump this program
Unzip the ROM and copy the getneed.sh to the system directory
Open the shell and navigate to the system directory. #先给权限chmod a+x getneed.sh to execute again./getneed.sh
After execution, the need_xxx.txt generated in the directory is a batch-listed dependency file
If the file does not contain needed, there is no dependency on the file, or it cannot be recognized by objdump
How to interpret (example):
ADB NEEDED libc.so NEEDED libstdc++.so NEEDED libm.so
*************************************
This paragraph means:
ADB this program, need libc.so, libstdc++.so, libm.so these three files
========================================================================================
Additional knowledge:
Sometimes lacks lib, does not prompt the file name, but prompts a string for example: _zn3net15
At this point, you can find it by this command.
Grep-r "_zn3net15" *
Automatically find so dependent