摘要:cd/home/zhangyi/work/posc_Ltpmkdirtutils二。编译并安装zlibcd./zlib-1.2.11/#/configure--prefix=$PWD/install_DirexportCC=arm-linux-gnueabihf-gcc#否则,编译x86体系结构,然后编译mtd_将在utils:libz中报告错误。sofilenotrecognized:文件格式无法识别/configure--prefix=/home/zhangyi/work/posc_ltp/mtdutils--staticmake&&makeinstall III编译并安装lzo-2.10cd./lzo-2.10/#/configure--prefix=$PWD/install_dir--host=arm-linux/configureCC=arm-linux-gnueabihf-gcc--prefix=/home/zhangyi/work/posc_Ltp/mtdutils--host=arm-liinux-enable-static#注意,以前是这样的/configure--prefix=../mtutils提示configure:error:expectedabsolutedirectoryname for--prefix:../mtutils。因此,绝对地址更可靠。2.10之前的配置将遇到符合性测试失败的问题。制作并制作安装IV。编译并安装e2fsprogs-141.14./configureCC=arm-linux-gnueabihf-gcc-host=arm-liinux-prefix=/home/zhangyi/work/posc_Ltp/mtdutilscdlb/uuid/Make&&install V。编译并安装mtd-utils-2.0.0#cd./mtd-utils-1.4.5/#exportZLIBCPFLAGS=-I/home/zhangyi/work/posc_ltp/mtdutils/include#exportZLIBLDFLAGS=-L/home/zhangyi/work/posc_lt p/mtdutils/lib#exportLZOCPPFLAGS=-I/home/hangyi/work/Posc_ltp/mtdutils/include/lzo#exportLZOLDFLAG=-L/homes/zhangyi/work/pssc_ltp/mtdutils/lib#makeCROSS=arm-linux-gnueabihf-WITHOUT_存在问题XATTR=11.4.5假设。经过检查,据说版本太旧,与更新的ubuntu不兼容。它返回到2.0.0.cd./mtd-utils-2.0.0exportZLIB_CFLAGS=-I/home/zhangyi/work/posc_ltp/mtdutils/includeexportZLIB_LIB_LIB=-L/home/zhangyi/work/posc_lt p/mtdutils/libexportLZO_CFLAGS=-I/home/zhangyi/work/pssc_ltp/mtdutils/include/lzoexportLZO_LIBS=-L/home/zhangyi/work/pos_cltp/mtdutils/libexportUUID_CFLAGS=-I/home/zhangyi/工作/posc_ltp/mtdutils/include/uuidexportUUID_LIBS=-L/home/zhangyi/work/posc_Ltp/mtdutils/lib/pkgconfigexportLDFLAGS=“$ZLIB_LIBS$LZO_LIBS$UUID_LIBS luuid-lz”exportCFLAGS=“-O2-g$ZLIB_CFLAGS$LZO_CFLAGS$UUID_FLAGS”#-luid-lz是在根据make报告的错误进行查询后添加的。#您必须使用export将其导出为环境变量,否则configure无法使用它。
一、获取源码并解压
存储于/home/zhangyi/work/psoc_ltp/tools-ltp-ddt中,解压后的源码存于上一层目录。
1.mtd-utils-2.0.0
wget ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-2.0.0.tar.bz2
tar -jxvf mtd-utils-2.0.0.tar.bz2 -C ..#解压到上一层目录
#wget ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-1.4.5.tar.bz2
#tar -jxvf mtd-utils-1.4.5.tar.bz2 -C .. #解压到上一层目录
2.zlib-1.2.11
wget http://www.zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz -C ..#解压到上一层目录
.3.lzo-2.04
#wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz
#tar -zxvf lzo-2.10.tar.gz
wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz
tar -zxvf lzo-2.04.tar.gz -C ..
4.e2fsprogs-1.41.14
#wget http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/v1.41.14/e2fsprogs-1.41.14.tar.gz
#tar -xzf e2fsprogs-1.41.14.tar.gz -C ..#无法解压
git clone git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git #git下来的是源码,非压缩包
cp -R e2fsprogs/ ..
编译安装前,先建立一个安装目录。
cd /home/zhangyi/work/psoc_ltp
mkdir mtdutils
二、编译安装zlib
cd ./zlib-1.2.11/
#./configure --prefix=$PWD/install_dir
export CC=arm-linux-gnueabihf-gcc #否则编译出x86架构的,在编译mtd_utils时候会报错libz.so file not recognized: File format not recognized
./configure --prefix=/home/zhangyi/work/psoc_ltp/mtdutils --static
make && make install
三、编译安装lzo-2.10
cd ./lzo-2.10/
#./configure --prefix=$PWD/install_dir --host=arm-linux
./configure CC=arm-linux-gnueabihf-gcc --prefix=/home/zhangyi/work/psoc_ltp/mtdutils --host=arm-linux --enable-static
#注意之前是./configure --prefix=../mtdutils 提示configure: error: expected an absolute directory name for --prefix: ../mtdutils 所以还是绝对地址比较靠谱
2.10之前的版本configure会碰到ACC conformance test failed问题。
make && make install
四、编译安装e2fsprogs-1.41.14
./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux --prefix=/home/zhangyi/work/psoc_ltp/mtdutils
cd lib/uuid/
make && make install
五、编译安装mtd-utils-2.0.0
#cd ./mtd-utils-1.4.5/
#export ZLIBCPPFLAGS=-I/home/zhangyi/work/psoc_ltp/mtdutils/include
#export ZLIBLDFLAGS=-L/home/zhangyi/work/psoc_ltp/mtdutils/lib
#export LZOCPPFLAGS=-I/home/zhangyi/work/psoc_ltp/mtdutils/include/lzo
#export LZOLDFLAGS=-L/home/zhangyi/work/psoc_ltp/mtdutils/lib
#make CROSS=arm-linux-gnueabihf- WITHOUT_XATTR=1
1.4.5make有问题,查了一下说版本太老,和较新的ubuntu不兼容,又回到2.0.0版本。
cd ./mtd-utils-2.0.0
export ZLIB_CFLAGS=-I/home/zhangyi/work/psoc_ltp/mtdutils/include
export ZLIB_LIBS=-L/home/zhangyi/work/psoc_ltp/mtdutils/lib
export LZO_CFLAGS=-I/home/zhangyi/work/psoc_ltp/mtdutils/include/lzo
export LZO_LIBS=-L/home/zhangyi/work/psoc_ltp/mtdutils/lib
export UUID_CFLAGS=-I/home/zhangyi/work/psoc_ltp/mtdutils/include/uuid
export UUID_LIBS=-L/home/zhangyi/work/psoc_ltp/mtdutils/lib/pkgconfig
export LDFLAGS="$ZLIB_LIBS $LZO_LIBS $UUID_LIBS-luuid -lz" export CFLAGS="-O2 -g $ZLIB_CFLAGS $LZO_CFLAGS $UUID_CFLAGS"
#-luuid -lz是根据make报错的情况查询后加上的。
#必须要使用export导出为环境变量,否则configure使用不了。
./configure --host=arm-linux CC=arm-linux-gnueabihf-gcc --prefix=$PWD/install_dir
make CROSS=arm-linux-gnueabihf- WITHOUT_XATTR=1
make install