设为首页收藏本站
查看: 11583|回复: 0

移植mtd-utils到开发板

[复制链接]

25

主题

9

回帖

280

积分

中级会员

积分
280
Willian.Mo 发表于 2015-5-6 17:42:25 | 显示全部楼层 |阅读模式
本帖最后由 Willian.Mo 于 2015-5-13 15:16 编辑

mtd-utils依赖于zlib、lzo、e2fsprogs提供的库,所以编译mtd-utils之前,需要先编译zlib、lzo、e2fsprogs
mtd-utils下载地址:ftp://ftp.infradead.org/pub/mtd-utils/
zlib下载地址:http://www.zlib.net/zlib-1.2.8.tar.gz
lzo下载地址:http://www.oberhumer.com/opensource/lzo/download/lzo-2.08.tar.gz
e2fsprogs下载地址:http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/

配置交叉工具环境
[mw_shl_code=bash,true]msl@ubuntu:~/workdir/mtd-utils$ export PATH=$PATH:/home/msl/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin[/mw_shl_code]

1、编译zlib
[mw_shl_code=bash,true]msl@ubuntu:~/workdir/mtd-utils$ tar -zxvf zlib-1.2.8.tar.gz
msl@ubuntu:~/workdir/mtd-utils$ cd zlib-1.2.8/
msl@ubuntu:~/workdir/mtd-utils/zlib-1.2.8$ CC=arm-linux-gnueabihf-gcc ./configure --shared --prefix=/home/msl/workdir/mtd-utils/opt
msl@ubuntu:~/workdir/mtd-utils/zlib-1.2.8$ make
msl@ubuntu:~/workdir/mtd-utils/zlib-1.2.8$ make install[/mw_shl_code]

2、编译lzo
[mw_shl_code=bash,true]msl@ubuntu:~/workdir/mtd-utils/zlib-1.2.8$ cd ..
msl@ubuntu:~/workdir/mtd-utils/$ tar -zxvf lzo-2.06.tar.gz
msl@ubuntu:~/workdir/mtd-utils/$ cd lzo-2.06/
msl@ubuntu:~/workdir/mtd-utils/lzo-2.06$ CC=arm-linux-gnueabihf-gcc ./configure --host=arm-linux --prefix=/home/msl/workdir/mtd-utils/opt
msl@ubuntu:~/workdir/mtd-utils/lzo-2.06$ make
msl@ubuntu:~/workdir/mtd-utils/lzo-2.06$ make install[/mw_shl_code]

3、编译安装e2fsprogs
[mw_shl_code=bash,true]msl@ubuntu:~/workdir/mtd-utils/lzo-2.06$ cd ..
msl@ubuntu:~/workdir/mtd-utils$ tar -zxvf e2fsprogs-1.42.tar.gz
msl@ubuntu:~/workdir/mtd-utils$ cd e2fsprogs-1.42/
msl@ubuntu:~/workdir/mtd-utils/e2fsprogs-1.42$ CC=arm-linux-gnueabihf-gcc ./configure --host=arm-linux --prefix=/home/msl/workdir/mtd-utils/opt
msl@ubuntu:~/workdir/mtd-utils/e2fsprogs-1.42$ make
msl@ubuntu:~/workdir/mtd-utils/e2fsprogs-1.42$ sudo apr-get install texlive
msl@ubuntu:~/workdir/mtd-utils/e2fsprogs-1.42$ make install
msl@ubuntu:~/workdir/mtd-utils/e2fsprogs-1.42$ make install-libs[/mw_shl_code]
4、编译mtd-utils
[mw_shl_code=bash,true]msl@ubuntu:~/workdir/mtd-utils/e2fsprogs-1.42$ cd ..
msl@ubuntu:~/workdir/mtd-utils$ tar -jxvf mtd-utils-1.5.1.tar.bz2
msl@ubuntu:~/workdir/mtd-utils$ cd mtd-utils-1.5.1/
msl@ubuntu:~/workdir/mtd-utils$/mtd-utils-1.5.1$ vi Makefile[/mw_shl_code]
在最上面添加如下3行
[mw_shl_code=bash,true]CROSS=arm-linux-gnueabihf-
WITHOUT_XATTR=1
DESTDIR=../opt/mtd-utils
msl@ubuntu:~/workdir/mtd-utils/mtd-utils-1.5.1$ cp -rp ../opt/include/* /home/msl/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf/include/
msl@ubuntu:~/workdir/mtd-utils/mtd-utils-1.5.1$ cp -rp ../opt/lib/* /home/msl/Toolchain/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/arm-linux-gnueabihf/lib/
msl@ubuntu:~/workdir/mtd-utils/mtd-utils-1.5.1$ make
msl@ubuntu:~/workdir/mtd-utils/mtd-utils-1.5.1$ make install[/mw_shl_code]

mtd-utils命令安装到/home/msl/workdir/mtd-utils/opt/mtd-utils/usr/sbin目录下拷贝到开发板即可



回复

使用道具 举报

您需要登录后才可以回帖 登录

本版积分规则

Archiver|手机版|小黑屋|米尔科技论坛   

GMT+8, 2024-12-23 15:28 , Processed in 0.035835 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表