交叉编译e2fsprogs For android
来源:互联网 发布:营销人员数据统计分析 编辑:程序博客网 时间:2024/06/08 02:16
由于需要使用dumpe2fs debugfs工具,因此交叉编译了e2fsprogs的源码。
本人在ubuntu 14.04下操作的
1. 下载e2fsprogs的源码
版本是1.42.6
2. 下载NDK
https://developer.android.com/ndk/downloads/index.html
3. 生成standalone toolchain (斜体为具体路径)
cd $NDK_PATH
cd build/tools
./make_standalone_toolchain.sh --install-dir=$TOOLCHAIN_PATH
成功则在$TOOLCHAIN_PATH下生成交叉编译所需的工具
4. 测试是否成功
cd $TOOL_CHAIN/bin
./arm-linux-androideabi-gcc -v
zombie@zombie-OptiPlex-3010:~/Software/NDK/tool-chain/bin$ ./arm-linux-androideabi-gcc -vUsing built-in specs.COLLECT_GCC=./arm-linux-androideabi-gccCOLLECT_LTO_WRAPPER=/home/zombie/Software/NDK/tool-chain/bin/../libexec/gcc/arm-linux-androideabi/4.9.x/lto-wrapperTarget: arm-linux-androideabiConfigured with: /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/configure --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --target=arm-linux-androideabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/buildbot/tmp/build/toolchain/temp-install --with-mpfr=/buildbot/tmp/build/toolchain/temp-install --with-mpc=/buildbot/tmp/build/toolchain/temp-install --with-cloog=/buildbot/tmp/build/toolchain/temp-install --with-isl=/buildbot/tmp/build/toolchain/temp-install --with-ppl=/buildbot/tmp/build/toolchain/temp-install --disable-ppl-version-check --disable-cloog-version-check --disable-isl-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --enable-bionic-libs --enable-libatomic-ifuncs=no --enable-initfini-array --disable-nls --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --with-sysroot=/tmp/59719db9ae19ff43aef46bbcb79596b6/sysroot --with-binutils-version=2.25 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.9 --with-gdb-version=none --with-gxx-include-dir=/tmp/59719db9ae19ff43aef46bbcb79596b6/include/c++/4.9.x --with-bugurl=http://source.android.com/source/report-bugs.html --enable-languages=c,c++ --disable-bootstrap --enable-plugins --enable-libgomp --enable-gnu-indirect-function --disable-libsanitizer --enable-gold --enable-threads --enable-eh-frame-hdr-for-static --enable-graphite=yes --with-isl-version=0.11.1 --with-cloog-version=0.18.0 --with-arch=armv5te --program-transform-name='s&^&arm-linux-androideabi-&' --enable-gold=defaultThread model: posixgcc version 4.9.x 20150123 (prerelease) (GCC)
export PATH=$PATH:/$TOOL_CHAIN/bin
5. 编译e2fsprogs
cd $e2fsprogs_PATH
export CFLAGS="-static -O2 -fpie -pie"
export LDFLAGS="-staitc -pie"
./configure --host=arm-linux -target=arm-linux CC=arm-linux-androideabi-gcc --prefix=$OUT_DIR
make (-j8)
make install
6. 成功编译后会在$OUT_DIR/sbin下生成可执行文件
zombie@zombie-OptiPlex-3010:~/e2fsprogs/out/sbin$ lsbadblocks e2fsck filefrag fsck.ext4 mkfs.ext3 tune2fsblkid e2image findfs fsck.ext4dev mkfs.ext4 uuidddebugfs e2label fsck logsave mkfs.ext4devdumpe2fs e2undo fsck.ext2 mke2fs mklost+founde2freefrag e4defrag fsck.ext3 mkfs.ext2 resize2fs
7. 剔除可执行文件符号表信息
cd $OUT_DIR
arm-linux-androideabi-strip *
8. 查看可执行文件信息(关键是statically linked 和 stripped)
file *
zombie@zombie-OptiPlex-3010:~/e2fsprogs/out/sbin$ file *badblocks: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedblkid: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippeddebugfs: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippeddumpe2fs: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippede2freefrag: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippede2fsck: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippede2image: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippede2label: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippede2undo: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippede4defrag: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedfilefrag: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedfindfs: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedfsck: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedfsck.ext2: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedfsck.ext3: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedfsck.ext4: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedfsck.ext4dev: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedlogsave: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedmke2fs: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedmkfs.ext2: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedmkfs.ext3: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedmkfs.ext4: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedmkfs.ext4dev: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedmklost+found: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedresize2fs: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippedtune2fs: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, strippeduuidd: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, stripped
adb push debugfs /data/local/tmp
10. 在手机中运行
adb shell
cd /data/local/tmp
./debugfs
- 交叉编译e2fsprogs For android
- 交叉编译e2fsprogs
- 交叉编译e2fsprogs——android 下使用mkfs.ext4命令
- e2fsprogs编译问题
- macosx 交叉编译 valgrind For Android
- 通过arm-linux-3.4.1的交叉编译 e2fsprogs-1.39.tar.gz
- e2fsprogs
- 基于mini2440嵌入式linux上整合一套Domoticz智能家居系统(四)交叉编译OpenSSL、c-ares、e2fsprogs和mosquitto
- cocos2d-x for android 环境搭建&交叉编译
- GDAL for Android在linux下交叉编译的问题
- cocos2d-x for android 环境搭建&交叉编译
- (OK) 交叉编译node-v4.2.1—for—android
- (OK) 交叉编译node-v4.2.1—for—android
- 交叉编译gstreamer for arm
- 交叉编译gstreamer for arm
- 交叉编译Ruby for ARM
- 交叉编译minicom for ARM
- 交叉编译GCC for arm
- 入门级Hadoop集群搭建详细教程(九):MySql的安装
- redis + MQ + MySQL实现秒杀功能
- 十五天精通WCF——第六天 你必须要了解的3种通信模式
- 前端学习之路css(04)-基础知识
- 十五天精通WCF——第七天 Close和Abort到底该怎么用才对得起观众
- 交叉编译e2fsprogs For android
- 十五天精通WCF——第八天 对“绑定”的最后一点理解
- 前端学习之路css(05)-基础知识
- Python的MySQLdb模块安装
- 十五天精通WCF——第九天 高级玩法之自定义Behavior
- 数据集总结
- JQuery 绑定select标签的onchange事件,弹出选择的值,并实现跳转、传参
- 十五天精通WCF——第十天 学会用SvcConfigEditor来简化配置
- 前端学习之路css(06)-基础知识