mtd-utils交叉編譯

在網上參考了很多人的文章,開始就是編譯不過去,提示/sys/acl.h無法找到!

最後終於解決,原因是路徑的問題

 

1、源碼

http://www.zlib.net/zlib-1.2.5.tar.gz

http://www.oberhumer.com/opensource/lzo/download/lzo-2.03.tar.gz

ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-1.4.1.tar.bz2

 

說明:zlib和lzo是編譯mtd-utils所需庫文件,需提前交叉編譯完成,以供mtd-utils編譯時調用

 

2、編譯安裝zlib:

root@:/home/# cd zlib-1.2.5

root@:/home/zlib-1.2.5# CC=arm-none-linux-gnueabi-gcc  ./configure --shared --prefix=/opt/armv6/codesourcery/arm-none-linux-gnueabi/

root@:/home/zlib-1.2.5# make

root@:/home/zlib-1.2.5# make install

 

其中-prefix指定zlib的安裝路徑,需要指定到交叉編譯器所在路徑!

 

 

3、編譯安裝lzo:

root@:/home/# cd lzo-2.03/

root@:/home/lzo-2.03# 編譯安裝lzo:

root@:/home/# cd lzo-2.03/

root@:/home/lzo-2.03# CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-linux --prefix=/opt/armv6/codesourcery/arm-none-linux-gnueabi/

root@:/home/lzo-2.03# make

root@:/home/lzo-2.03# make install

 

 

4、編譯mtd-utils

 

make CROSS=/opt/armv6/codesourcery/bin/arm-none-linux-gnueabi- WITHOUT_XATTR=1

 

 

指定WITHOUT_XATTR=1 是由於在編譯 mkfs.jffs2使其不調用acl.h而是用zlib的庫,否則會報錯:

mkfs.jffs2.c:69:21: error: sys/acl.h: No such file or directory
mkfs.jffs2.c: In function ‘formalize_posix_acl’:
mkfs.jffs2.c:1118: error: ‘ACL_USER_OBJ’ undeclared (first use in this function)
mkfs.jffs2.c:1118: error: (Each undeclared identifier is reported only once
mkfs.jffs2.c:1118: error: for each function it appears in.)
mkfs.jffs2.c:1119: error: ‘ACL_GROUP_OBJ’ undeclared (first use in this function)
mkfs.jffs2.c:1120: error: ‘ACL_MASK’ undeclared (first use in this function)
mkfs.jffs2.c:1121: error: ‘ACL_OTHER’ undeclared (first use in this function)
mkfs.jffs2.c:1127: error: ‘ACL_USER’ undeclared (first use in this function)
mkfs.jffs2.c:1128: error: ‘ACL_GROUP’ undeclared (first use in this function)
make: *** [mkfs.jffs2.o] Error 1

 

有人寫到出現此錯誤需要安裝libacl-dev,個人覺得如果指定WITHOUT_XATTR=1,就不需要安裝!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章