2012년 7월 4일 수요일

mtd-utils build and install


  • officail homepage


http://www.linux-mtd.infradead.org/index.html

  • download


ftp://ftp.infradead.org/pub/mtd-utils/
or
git clone git://git.infradead.org/mtd-utils.git mtd-utils

  • configure and build for cross compile


mtd-utils does not supprot configure.
You must modify Makefile of commom.mk directlry

In common.mk defines CC

CC := $(CROSS)gcc
AR := $(CROSS)ar
RANLIB := $(CROSS)ranlib


just add variable CROSS on top of common.mk for example

CROSS :=arm-none-linux-gnueabi-

  • Install


In Makefile instill DIR defined as DESTDIR

install:: $(addprefix $(BUILDDIR)/,${BINS}) ${SCRIPTS}
        mkdir -p ${DESTDIR}/${SBINDIR}
        install -m 0755 $^ ${DESTDIR}/${SBINDIR}/
        mkdir -p ${DESTDIR}/${MANDIR}/man1
        install -m 0644 mkfs.jffs2.1 ${DESTDIR}/${MANDIR}/man1/
        -gzip -9f ${DESTDIR}/${MANDIR}/man1/*.1


Do below commnad

$ make install  DESTDIR=/home/user/mtd/install

finally you can do as below

$ make CROSS=arm-none-linux-gnueabi- DESTDIR=/home/user/mtd/install all install

  • build error handling


sometimes it can return errors, because of cross compiler restriction

$ error: sys/acl.h: No such file or directory

It means your cross toolchanin does not support ACL.
mtd-util has build option for this

$ make CROSS=arm-none-linux-gnueabi- WITHOUT_XATTR=1

The access control list(ACL) enables higher flexible access control based on UNIX users and groups than traditional user/group/others model. '--with-xattr' or '--with-posix-acl' options on mkfs.jffs2 enables to
copy the ACLs associated with any files in host environment into jffs2 image file. The purpose of this feature is improvement of security in embedded region.

refer to http://lists.infradead.org/pipermail/linux-mtd/2006-November/016814.html

error: lzo/lzo1x.h: No such file or directory

There is an option build without LZO
But it does not works properly, also LZO must be needed because ubifs includes LZO

$make CROSS=arm-none-linux-gnueabi- WITHOUT_XATTR=1 WITHOUT_LZO=1

It will cause build error also in ubifs related package
Refer to http://dokyunblog.blogspot.kr/2012/07/introduction-lzo-is-data-compression.html
Contain LZO lib in toolchain.


댓글 없음:

댓글 쓰기