赞
踩
环境:
file命令源码:file-5.08
buildroot下载地址:https://buildroot.org/downloads/
file命令下载地址:ftp://ftp.astron.com/pub/file
过程:
解压buildroot-2016.11-rc1.tar.gz到/home/biren/buildroot-2016.11-rc1目录
biren@ubuntu:~/buildroot-2016.11-rc1$ ls
arch CHANGES COPYING fs Makefile.legacy support
board Config.in DEVELOPERS host output system
boot Config.in.legacy dl linux package toolchain
build configs docs Makefile README
生成一个默认配置文件.config :
make qemu_aarch64_virt_defconfig (找一个预配置好的config文件,在configs文件夹里找)
biren@ubuntu:~/buildroot-2016.11-rc1$ make qemu_aarch64_virt_defconfig
make menuconfig 详细配置参数调整:
Target options —> 这是设置被编译出来的程序在什么样架构的机器上运行
Build options :
Download dir是下载的源码文件存放地
将Host dir修改为/home/biren/bttool (路径可自定义),即生成的交叉编译工具将存放在此。
原来的host dir :
修改后的host dir :
Mirrors and Download locations —> 从这些地址中下载源码文件
(可预先下载后放入此目录)
libraries (shared only) —> 将此处的shared only 改为both static and shared
第一次编译时就是没有改,导致不能将程序编译成静态的
Toolchain :工具链配置
Toolchain type (Buildroot toolchain) —>
以下几项版本配置根据自己需求选择:
我的旧手机配置是:
127|root@GiONEE_GBL7319:/system/bin # cat /proc/version
Linux version 3.10.65+ (android@android6) (gcc version 4.9 20140514 (mtk-20150408) (GCC) ) #1 SMP PREEMPT Tue Jun 30 05:59:41 HKT 2015
127|root@GiONEE_GBL7319:/system/bin # busybox uname -a
Linux localhost 3.10.65+ #1 SMP PREEMPT Tue Jun 30 05:59:41 HKT 2015 aarch64 GNU/Linux
选上 “Enable C++ support”
System configuration —>
Kernel —> 选择合适版本,此处选填3.10.65
Target packages :大部分默认
Compressors and decompressors —>
其它参数先保持默认的
save :
开始编译:时长1-2小时
biren@ubuntu:~/buildroot-2016.11-rc1$ make
问题一:
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/${ <-- HERE ([^ \t=:+{}]+)}
......
>>> lzo 2.09 Autoreconfiguring
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'autoconf'.
libtoolize: copying file 'autoconf/ltmain.sh'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /home/biren/bttool/usr/bin/automake line 3936.
autoreconf: /home/biren/bttool/usr/bin/automake failed with exit status: 255
package/pkg-generic.mk:206: recipe for target '/home/biren/buildroot-2016.11-rc1/output/build/lzo-2.09/.stamp_configured' failed
make[1]: *** [/home/biren/buildroot-2016.11-rc1/output/build/lzo-2.09/.stamp_configured] Error 1
Makefile:76: recipe for target '_all' failed
make: *** [_all] Error 2
原因:
2016版本较旧,正则表达式语法有些差异,不支持旧的写法
解决:
将/home/biren/bttool/usr/bin/automake文件3936行处的
$text =~ s/${([^ \t=:+{}]+)}/
修改为$text =~ s/$[{]([^ \t=:+[{]}]+)}/
(即将第一个左大括号用中括号括起来)
再次运行make(不要make clean,要不然又要编译个把小时),正常结束。
生成的Linux系统可直接写入相应的板子上即可运行。
以下与交叉编译相关:
生成的交叉编译工具放在如下目录里:
/home/biren/bttool/usr/
biren@ubuntu:~/filecmd/file-5.08$ ll /home/biren/bttool/usr
total 32
drwxr-xr-x 8 biren biren 4096 Apr 14 12:04 ./
drwxr-xr-x 4 biren biren 4096 Apr 14 14:34 ../
drwxr-xr-x 7 biren biren 4096 Apr 14 13:28 aarch64-jwj-linux-gnu/
drwxr-xr-x 2 biren biren 4096 Apr 14 14:34 bin/
drwxr-xr-x 3 biren biren 4096 Apr 14 14:34 include/
drwxr-xr-x 6 biren biren 4096 Apr 14 14:34 lib/
drwxr-xr-x 4 biren biren 4096 Apr 14 12:27 libexec/
drwxr-xr-x 15 biren biren 4096 Apr 14 14:34 share/
bin部分内容:
biren@ubuntu:~/filecmd/file-5.08$ ll /home/biren/bttool/usr/bin total 28896 -rwxr-xr-x 1 biren biren 1135448 Apr 14 12:07 aarch64-jwj-linux-gnu-addr2line* -rwxr-xr-x 2 biren biren 1169032 Apr 14 12:07 aarch64-jwj-linux-gnu-ar* -rwxr-xr-x 2 biren biren 1760440 Apr 14 12:07 aarch64-jwj-linux-gnu-as* lrwxrwxrwx 1 biren biren 17 Apr 14 13:28 aarch64-jwj-linux-gnu-c++ -> toolchain-wrapper* -rwxr-xr-x 2 biren biren 972336 Apr 14 13:28 aarch64-jwj-linux-gnu-c++.br_real* lrwxrwxrwx 1 biren biren 17 Apr 14 13:28 aarch64-jwj-linux-gnu-cc -> toolchain-wrapper* -rwxr-xr-x 3 biren biren 968144 Apr 14 13:28 aarch64-jwj-linux-gnu-cc.br_real* -rwxr-xr-x 1 biren biren 1130320 Apr 14 12:07 aarch64-jwj-linux-gnu-c++filt* lrwxrwxrwx 1 biren biren 17 Apr 14 13:28 aarch64-jwj-linux-gnu-cpp -> toolchain-wrapper* -rwxr-xr-x 1 biren biren 968192 Apr 14 13:28 aarch64-jwj-linux-gnu-cpp.br_real* -rwxr-xr-x 1 biren biren 37856 Apr 14 12:07 aarch64-jwj-linux-gnu-elfedit* lrwxrwxrwx 1 biren biren 17 Apr 14 13:28 aarch64-jwj-linux-gnu-g++ -> toolchain-wrapper* -rwxr-xr-x 2 biren biren 972336 Apr 14 13:28 aarch64-jwj-linux-gnu-g++.br_real* lrwxrwxrwx 1 biren biren 17 Apr 14 13:28 aarch64-jwj-linux-gnu-gcc -> toolchain-wrapper* lrwxrwxrwx 1 biren biren 17 Apr 14 13:28 aarch64-jwj-linux-gnu-gcc-4.9.4 -> toolchain-wrapper* ... lrwxrwxrwx 1 biren biren 31 Apr 14 13:28 aarch64-linux-addr2line -> aarch64-jwj-linux-gnu-addr2line* lrwxrwxrwx 1 biren biren 24 Apr 14 13:28 aarch64-linux-ar -> aarch64-jwj-linux-gnu-ar* lrwxrwxrwx 1 biren biren 24 Apr 14 13:28 aarch64-linux-as -> aarch64-jwj-linux-gnu-as* lrwxrwxrwx 1 biren biren 17 Apr 14 13:28 aarch64-linux-gcc -> toolchain-wrapper* lrwxrwxrwx 1 biren biren 17 Apr 14 13:28 aarch64-linux-gcc-4.9.4 -> toolchain-wrapper* -rwxr-xr-x 2 biren biren 36846 Apr 14 13:41 aclocal* -rwxr-xr-x 2 biren biren 36846 Apr 14 13:41 aclocal-1.15* -rwxr-xr-x 1 biren biren 14786 Apr 14 13:41 autoconf* -rwxr-xr-x 1 biren biren 8572 Apr 14 13:41 autoheader* -rwxr-xr-x 1 biren biren 32232 Apr 14 13:41 autom4te* -rwxr-xr-x 2 biren biren 253228 Apr 14 14:31 automake* -rwxr-xr-x 2 biren biren 253228 Apr 14 14:31 automake-1.15* -rwxr-xr-x 1 biren biren 21140 Apr 14 13:41 autoreconf* -rwxr-xr-x 1 biren biren 17179 Apr 14 13:41 autoscan* -rwxr-xr-x 1 biren biren 33946 Apr 14 13:41 autoupdate* -rwxr-xr-x 1 biren biren 667312 Apr 14 12:04 gawk* -rwxr-xr-x 1 biren biren 4148 Apr 14 13:41 ifnames* -rwxr-xr-x 1 biren biren 3189 Apr 14 12:04 igawk* -rwxr-xr-x 1 biren biren 169184 Apr 14 14:34 kmod* -rwxr-xr-x 1 biren biren 365520 Apr 14 13:41 libtool* -rwxr-xr-x 1 biren biren 129267 Apr 14 13:41 libtoolize* -rwxr-xr-x 1 biren biren 180784 Apr 14 12:08 m4* -rwxr-xr-x 1 biren biren 58296 Apr 14 14:34 pkgconf* -rwxr-xr-x 1 biren biren 323 Apr 14 14:34 pkg-config* -rwxr-xr-x 1 biren biren 10448 Apr 14 13:28 toolchain-wrapper*
查看gcc版本:
命令:aarch64-jwj-linux-gnu-gcc -v
biren@ubuntu:~/filecmd/file-5.08$ /home/biren/bttool/usr/bin/aarch64-jwj-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/home/biren/bttool/usr/bin/aarch64-jwj-linux-gnu-gcc.br_real
COLLECT_LTO_WRAPPER=/home/biren/bttool/usr/libexec/gcc/aarch64-jwj-linux-gnu/4.9.4/lto-wrapper
Target: aarch64-jwj-linux-gnu
Configured with: ./configure --prefix=/home/biren/bttool/usr --sysconfdir=/home/biren/bttool/etc --enable-static --target=aarch64-jwj-linux-gnu --with-sysroot=/home/biren/bttool/usr/aarch64-jwj-linux-gnu/sysroot --disable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --with-gmp=/home/biren/bttool/usr --with-mpc=/home/biren/bttool/usr --with-mpfr=/home/biren/bttool/usr --with-pkgversion='Buildroot 2016.11-rc1' --with-bugurl=http://bugs.buildroot.net/ --disable-libquadmath --enable-tls --disable-libmudflap --enable-threads --without-isl --without-cloog --disable-decimal-float --enable-languages=c,c++ --with-build-time-tools=/home/biren/bttool/usr/aarch64-jwj-linux-gnu/bin --enable-shared --disable-libgomp
Thread model: posix
gcc version 4.9.4 (Buildroot 2016.11-rc1)
下载并解压file-5.08.tar.gz到file-5.08目录里
编译file命令:
配置configure参数并生成Makefile:
export ARMPREFIX=aarch64-jwj-linux-gnu-
./configure –host=arm-linux --enable-static --disable-shared CC= A R M P R E F I X g c c A S = {ARMPREFIX}gcc AS= ARMPREFIXgccAS={ARMPREFIX}as LD= A R M P R E F I X l d A R = {ARMPREFIX}ld AR= ARMPREFIXldAR={ARMPREFIX}ar RANLIB=${ARMPREFIX}ranlib
biren@ubuntu:~/filecmd/file-5.08$ export ARMPREFIX=aarch64-jwj-linux-gnu- biren@ubuntu:~/filecmd/file-5.08$ ./configure --host=arm-linux --enable-static --disable-shared CC=${ARMPREFIX}gcc AS=${ARMPREFIX}as LD=${ARMPREFIX}ld AR=${ARMPREFIX}ar RANLIB=${ARMPREFIX}ranlib configure: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for arm-linux-strip... no 。。。。。。 checking for gzopen in -lz... no configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile config.status: creating magic/Makefile config.status: creating tests/Makefile config.status: creating doc/Makefile config.status: creating python/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing depfiles commands config.status: executing libtool commands
修改Makefile、file.c参数:
将file-5.08下的file-5.08/src/Makefile中的
CFLAGS = -g -O2
修改为CFLAGS = -g -O2 –static
将file-5.08/src/file.c里的
const char *magicfile = NULL;
修改为const char *magicfile = “/system/bin/Magdir.mgc”;
运行make :
问题一:
funcs.c:34:21: fatal error: re_comp.h: No such file or directory
readelf.c:372:13: warning: ‘nh32.n_type’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Elf32_Nhdr nh32;
^
CC print.lo
CC fsmagic.lo
CC funcs.lo
funcs.c:34:21: fatal error: re_comp.h: No such file or directory
compilation terminated.
make[2]: *** [funcs.lo] Error 1
make[2]: Leaving directory `/home/biren/filecmd/file-5.08/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/biren/filecmd/file-5.08'
make: *** [all] Error 2
解决:
将/home/biren/filecmd/file-5.08/src/funcs.c里的这句
#include <re_comp.h>注释掉
问题二:
magic Cannot use the installed version of file (5.32) to cross-compile file 5.08
Please install file 5.08 locally first
大意是:不能用当前系统file(版本5.32)命令的magic,请先安装5.08版本的file命令到本系统(即要求当前系统file命令的版本要与将编译的版本一致)
...... CC readcdf.lo CCLD libmagic.la CC file.o CCLD file make[2]: Leaving directory '/home/biren/filecmd/file-5.08/src' Making all in magic make[2]: Entering directory '/home/biren/filecmd/file-5.08/magic' Cannot use the installed version of file (5.32) to cross-compile file 5.08 Please install file 5.08 locally first Makefile:656: recipe for target 'magic.mgc' failed make[2]: *** [magic.mgc] Error 1 make[2]: Leaving directory '/home/biren/filecmd/file-5.08/magic' Makefile:304: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/biren/filecmd/file-5.08' Makefile:233: recipe for target 'all' failed make: *** [all] Error 2
解决:
先用不带参数的编译、安装file 5.08到当前系统上:
目的是生成5.08版本的magic文件
彻底清除:包括Makefile等生成的文件
命令: make distclean
biren@ubuntu:~/filecmd/file-5.08$ make distclean
Making distclean in python
make[1]: Entering directory '/home/biren/filecmd/file-5.08/python'
rm -rf .libs _libs
。。。
修改file-5.08/src/file.c :
将const char *magicfile = NULL;
修改为 const char *magicfile = “/usr/local/file5.08/magic/Magdir.mgc”;
运行 ./configure --prefix=/usr/local/file5.08
biren@ubuntu:~/filecmd/file-5.08$ ./configure --prefix=/usr/local/file5.08
make :
biren@ubuntu:~/filecmd/file-5.08$ make
安装 : sudo make install
biren@ubuntu:~/filecmd/file-5.08$ sudo make install [sudo] password for biren: Making install in src make[1]: Entering directory '/home/biren/filecmd/file-5.08/src' make[2]: Entering directory '/home/biren/filecmd/file-5.08/src' test -z "/usr/local/file5.08/lib" || /bin/mkdir -p "/usr/local/file5.08/lib" /bin/bash ../libtool --mode=install /usr/bin/install -c libmagic.la '/usr/local/file5.08/lib' libtool: install: /usr/bin/install -c .libs/libmagic.so.1.0.0 /usr/local/file5.08/lib/libmagic.so.1.0.0 libtool: install: (cd /usr/local/file5.08/lib && { ln -s -f libmagic.so.1.0.0 libmagic.so.1 || { rm -f libmagic.so.1 && ln -s libmagic.so.1.0.0 libmagic.so.1; }; }) libtool: install: (cd /usr/local/file5.08/lib && { ln -s -f libmagic.so.1.0.0 libmagic.so || { rm -f libmagic.so && ln -s libmagic.so.1.0.0 libmagic.so; }; }) libtool: install: /usr/bin/install -c .libs/libmagic.lai /usr/local/file5.08/lib/libmagic.la libtool: install: /usr/bin/install -c .libs/libmagic.a /usr/local/file5.08/lib/libmagic.a libtool: install: chmod 644 /usr/local/file5.08/lib/libmagic.a libtool: install: ranlib /usr/local/file5.08/lib/libmagic.a libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/file5.08/lib ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/file5.08/lib ...... make[2]: Nothing to be done for 'install-data-am'. make[2]: Leaving directory '/home/biren/filecmd/file-5.08' make[1]: Leaving directory '/home/biren/filecmd/file-5.08'
文件安装到/usr/local/file5.08目录下:
biren@ubuntu:/usr/local/file5.08$ ls
bin include lib magic share
新建magic目录:
biren@ubuntu:~/filecmd/file-5.08/src$ sudo mkdir /usr/local/file5.08/magic
将源文件Magdir目录及里面文件一起复制到新建的magic目录下:
biren@ubuntu:~/filecmd/file-5.08$ sudo cp -r ./magic/Magdir /usr/local/file5.08/magic/
用刚编译好的file命令(5.08版)生成Magdir.mgc文件:
命令:file -C -m Magdir
biren@ubuntu:/usr/local/file5.08/magic$ sudo ../bin/file -C -m Magdir
测试file 5.08 :
biren@ubuntu:/usr/local/file5.08$ bin/file -v
file-5.08
magic file from /usr/local/file5.08/magic/Magdir.mgc
biren@ubuntu:/usr/local/file5.08$ bin/file /bin/ls
/bin/ls: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.2.0, BuildID[sha1]=0xa2f96795d7f4668e31af4becd068bfcfe60a0f41, stripped
5.08版本与5.32版本对比:
biren@ubuntu:/usr/local/file5.08$ file bin/file 5.08版本的
bin/file: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=594d8d43640f7492fb3a6c8f2417565a5e52883e, with debug_info, not stripped
biren@ubuntu:/usr/local/file5.08$ file /usr/bin/file 5.32版本的
/usr/bin/file: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=2b26928f841d92afa31613c2c916a3abc96bbed8, stripped
用update-alternatives命令配置使当前系统使用file 5.08版本:
将5.32的file改名: biren@ubuntu:/usr/local/file5.08$ sudo mv /usr/bin/file /usr/bin/file5.32 注册: biren@ubuntu:/usr/local/file5.08$ sudo update-alternatives --install /usr/bin/file file /usr/bin/file5.32 400 update-alternatives: using /usr/bin/file5.32 to provide /usr/bin/file (file) in auto mode biren@ubuntu:/usr/local/file5.08$ sudo update-alternatives --install /usr/bin/file file /usr/local/file5.08/bin/file 300 配置: biren@ubuntu:/usr/local/file5.08$ sudo update-alternatives --config file There are 2 choices for the alternative file (providing /usr/bin/file). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/file5.32 400 auto mode 1 /usr/bin/file5.32 400 manual mode 2 /usr/local/file5.08/bin/file 300 manual mode Press <enter> to keep the current choice[*], or type selection number: 2 update-alternatives: using /usr/local/file5.08/bin/file to provide /usr/bin/file (file) in manual mode 验证: biren@ubuntu:/usr/local/file5.08$ file -v file-5.08 magic file from /usr/local/file5.08/magic/Magdir.mgc
重新用交叉编译链工具编译file 5.08源码 :(在旧手机上使用)
彻底删除原编译产生的文件:
biren@ubuntu:~/filecmd/file-5.08$ make distclean
执行./configure :
–host=arm-linux表示在什么机器上使用
–enable-static表示编译成静态的,因为手机上缺乏各种动态库
biren@ubuntu:~/filecmd/file-5.08$ ./configure --host=arm-linux --enable-static --disable-shared CC=${ARMPREFIX}gcc AS=${ARMPREFIX}as LD=${ARMPREFIX}ld AR=${ARMPREFIX}ar RANLIB=${ARMPREFIX}ranlib
修改Makefile :
文件在/home/biren/filecmd/file-5.08/src/
将CFLAGS = -g -O2
改为 CFLAGS = -g -O2 –static
修改 file.c :
文件在 /home/biren/filecmd/file-5.08/src/
将 const char *magicfile = NULL;
修改为 const char *magicfile = “/system/bin/Magdir.mgc”;
运行 make :
biren@ubuntu:~/filecmd/file-5.08$ make make all-recursive make[1]: Entering directory '/home/biren/filecmd/file-5.08' Making all in src make[2]: Entering directory '/home/biren/filecmd/file-5.08/src' CC magic.lo CC apprentice.lo ..... sed -e s@__CSECTION__@1@g \ -e s@__FSECTION__@4@g \ -e s@__VERSION__@5.08@g \ -e s@__MAGIC__@/usr/local/share/misc/magic@g ./libmagic.man > libmagic.3 make[2]: Leaving directory '/home/biren/filecmd/file-5.08/doc' Making all in python make[2]: Entering directory '/home/biren/filecmd/file-5.08/python' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/home/biren/filecmd/file-5.08/python' make[2]: Entering directory '/home/biren/filecmd/file-5.08' make[2]: Leaving directory '/home/biren/filecmd/file-5.08' make[1]: Leaving directory '/home/biren/filecmd/file-5.08'
恢复当前系统的file 5.32版本:
命令:sudo update-alternatives --auto file
biren@ubuntu:~/filecmd/file-5.08$ sudo update-alternatives --auto file
update-alternatives: using /usr/bin/file5.32 to provide /usr/bin/file (file) in auto mode
biren@ubuntu:~/filecmd/file-5.08$ sudo update-alternatives --display file
file - auto mode
link best version is /usr/bin/file5.32
link currently points to /usr/bin/file5.32
link file is /usr/bin/file
/usr/bin/file5.32 - priority 400
/usr/local/file5.08/bin/file - priority 300
biren@ubuntu:~/filecmd/file-5.08$ file -v
file-5.32
magic file from /etc/magic:/usr/share/misc/magic
查验结果:
ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked
biren@ubuntu:~/filecmd/file-5.08$ file ./src/file
./src/file: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, for GNU/Linux 3.10.0, with debug_info, not stripped
用adb push命令将file和Magdir目录及Magdir里面的所有文件都传到手机/system/bin/里:
c:\tmp\fastboot>adb push file /sdcard file: 1 file pushed. 3.8 MB/s (1246776 bytes in 0.316s) c:\tmp\fastboot>adb push Magdir /sdcard Magdir\: 227 files pushed. 0.9 MB/s (604844 bytes in 0.656s) c:\tmp\fastboot>adb shell shell@GiONEE_GBL7319:/ $ su 1|root@GiONEE_GBL7319:/ # mount -rw -o remount /system 1|root@GiONEE_GBL7319:/ # mkdir /system/bin/Magdir root@GiONEE_GBL7319:/ # mv /sdcard/file /system/bin root@GiONEE_GBL7319:/ # cp /sdcard/Magdir/* /system/bin/Magdir 1|root@GiONEE_GBL7319:/system/bin # ll file -rwxr-xr-x root sdcard_r 1246776 2022-04-14 20:38 file root@GiONEE_GBL7319:/system/bin # ll Magdir -rw-r----- root root 2197 2022-04-14 21:06 acorn -rw-r----- root root 425 2022-04-14 21:06 adi -rw-r----- root root 3980 2022-04-14 21:06 adventure -rw-r----- root root 402 2022-04-14 21:06 allegro -rw-r----- root root 760 2022-04-14 21:06 alliant -rw-r----- root root 386 2022-04-14 21:06 amanda -rw-r----- root root 2253 2022-04-14 21:06 amigaos -rw-r----- root root 37813 2022-04-14 21:06 animation -rw-r----- root root 276 2022-04-14 21:06 apl ......
制作mgc文件:
命令: file -C -m Magdir
root@GiONEE_GBL7319:/system/bin # file -C -m Magdir
root@GiONEE_GBL7319:/system/bin # ll Magdir.mgc
-rw-r--r-- root root 2213976 2022-04-14 21:10 Magdir.mgc
查看file命令版本:
root@GiONEE_GBL7319:/system/bin # file -v
file-5.08
magic file from /system/bin/Magdir.mgc
使用file命令:
root@GiONEE_GBL7319:/system/bin # file toolbox
toolbox: ELF 64-bit LSB shared object, version 1 (SYSV), dynamically linked (uses shared libs), stripped
root@GiONEE_GBL7319:/system/bin # file /system/xbin/busybox
/system/xbin/busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, stripped
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。