mtd-utils的交叉编译

按照顺序做即可, 在Ubuntu 18.04 LTS上验证过

Build Zlib: zlib-1.2.11.tar.gz

tar xvf ~/download/zlib-1.2.11.tar.gz 
cd zlib-1.2.11/ 
./configure --prefix=`pwd`/../__install/ 

Change Makefile: 

--- a/Makefile 
+++ b/Makefile 
@@ -16,7 +16,7 @@ 
 # To install in $HOME instead of /usr/local, use: 
 #    make install prefix=$HOME 
   
-CC=gcc 
+CC=aarch64-linux-gnu-gcc 
   
 CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN 
 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 
@@ -27,8 +27,8 @@ CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN 
 SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN 
 LDFLAGS= 
 TEST_LDFLAGS=-L. libz.a 
-LDSHARED=gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map 
-CPP=gcc -E 
+LDSHARED=aarch64-linux-gnu-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map 
+CPP=aarch64-linux-gnu-gcc -E 
   
 STATICLIB=libz.a 
 SHAREDLIB=libz.so 
@@ -36,9 +36,9 @@ SHAREDLIBV=libz.so.1.2.11 
 SHAREDLIBM=libz.so.1 
 LIBS=$(STATICLIB) $(SHAREDLIBV) 
   
-AR=ar 
+AR=aarch64-linux-gnu-ar 
 ARFLAGS=rc 
-RANLIB=ranlib 
+RANLIB=aarch64-linux-gnu-ranlib 
 LDCONFIG=ldconfig 
 LDSHAREDLIBC=-lc 
 TAR=tar

继续执行:

make -j8 
make install

 

Build LZO: lzo-2.10.tar.gz

tar xvf ~/download/lzo-2.10.tar.gz 
cd lzo-2.10/ 
./configure --host=aarch64-linux-gnu --prefix=`pwd`/../__install/ 
make -j8 
make install

 

Build e2fsprogs: e2fsprogs-1.45.2.tar.gz

tar xvf e2fsprogs-1.45.2.tar.gz 
cd e2fsprogs-1.45.2/ 
./configure --host=aarch64-linux-gnu --prefix=`pwd`/../__install 
make -j8  
make install

 

Build mtd-utils: mtd-utils-2.1.0.tar.bz2

tar xvf mtd-utils-2.1.0.tar.bz2 
cd mtd-utils-2.1.0/ 
export PKG_CONFIG_PATH=`pwd`/../__install/lib/pkgconfig/; 
export PREFIX=`pwd`/../__install/; 
./configure --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc --prefix=${PREFIX} WITHOUT_XATTR=1 LDFLAGS=-L${PREFIX}/lib CFLAGS='-I${PREFIX}/include -I${PREFIX}/include/lzo -I${PREFIX}/include/uuid/ -g -O2' UUID_CFLAGS='-I${PREFIX}/include/uuid/' LZO_CFLAGS='-I${PREFIX}/include/' ZLIB_CFLAGS='-I${PREFIX}/include' --without-crypto 
Change ubifs-utils/mkfs.ubifs/mkfs.ubifs.h as follow patch: 
[PATCH] mkfs.ubifs: fix build without openssl 
make -j8 
make install

 

你可能感兴趣的:(mtd-utils的交叉编译)