交叉编译mtd-utils

时间:2021-10-09 00:17:11

busybox中没有flash_erase,在线升级不方便,所以打算从源码交叉编译mtd-utils

【1】下载源码包

http://download.savannah.gnu.org/releases/acl/
http://download.savannah.gnu.org/releases/attr/
http://www.zlib.net/
http://www.oberhumer.com/opensource/lzo/download/
http://sourceforge.net/projects/libuuid/
ftp://ftp.infradead.org/pub/mtd-utils/
【2】交叉编译
【2.1】准备编译目录。所有的库编译完成后都将安装到该路径下,之后的库也将从该路径中寻找头文件的库文件

sudo mkdir /opt/omapl138_root
sudo chown user:user /opt/omapl138_root

【2.2】attr

tar xf attr-2.4.47.src.tar.gz
cd attr-2.4.47
./configure --host=arm-none-linux-gnueabi --prefix=/opt/omapl138_root/
make
make install-dev
make install-lib
make install

【2.3】acl

tar xf acl-2.2.52.src.tar.gz
cd acl-2.2.52
./configure --host=arm-none-linux-gnueabi --prefix=/opt/omapl138_root/  
CFLAGS="-I/opt/omapl138_root/include" LDFLAGS="-L/opt/omapl138_root/lib" make
make install
make install-lib
make install-dev

【2.4】zlib

tar xf zlib-1.2.8.tar.xz
cd zlib-1.2.8
CC=arm-none-linux-gnueabi-gcc ./configure --prefix=/opt/omapl138_root/
CC=arm-none-linux-gnueabi-gcc make
make install

【2.5】lzo

tar xf lzo-2.09.tar.gz
cd lzo-2.09/
./configure --host=arm-none-linux-gnueabi --prefix=/opt/omapl138_root/
make
make install

【2.6】libuuid

tar xf libuuid-1.0.3.tar.gz
cd libuuid-1.0.3/
./configure --host=arm-none-linux-gnueabi --prefix=/opt/omapl138_root/
make
make install

【2.7】mtd-utils

tar xf mtd-utils-1.5.2.tar.bz2
cd mtd-utils-1.5.2/
CFLAGS="-I/opt/omapl138_root/include" LDFLAGS="-L/opt/omapl138_root/lib" make install CROSS=arm-none-linux-gnueabi- DESTDIR=/opt/omapl138_root