(First Version) |
(No difference)
|
At some stage you may need to run MTD utilities like flash_erase, mtdinfo, ubiformat, ubinfo on your ARM target system. The following includes details on how to build/cross compile the MTD utilities for ARM processors.
The MTD Utils require zlib and LZO compression libraries, and uuid from e2fsprogs as dependencies.
Download, cross compile and install the zlib compression libraries. Configure doesn't accept the --host parameter (reports unknown option), so you need to hack the makefile.
wget http://zlib.net/zlib-1.2.6.tar.gz tar -xzf zlib-1.2.6.tar.gz cd zlib-1.2.6/ ./configure --prefix=/home/temp/mtdutils
Edit the makefile and prefix the build tools with arm-none-linux-gnueabi-.
CC=arm-none-linux-gnueabi-gcc LDSHARED=arm-none-linux-gnueabi-gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map CPP=arm-none-linux-gnueabi-gcc -E AR=CC=arm-none-linux-gnueabi-ar RANLIB=CC=arm-none-linux-gnueabi-ranlib
Make and install:
make make install
Download, cross compile and install the LZO data compression library:
wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz tar -xzf lzo-2.06.tar.gz cd lzo-2.06/ ./configure --host=arm-none-linux-gnueabi --prefix=/home/temp/mtdutils make make install
The mtd-util uses uuid from the e2fsprogs source. Download, cross compile and install:
wget http://sourceforge.net/projects/e2fsprogs/files/e2fsprogs/1.42/e2fsprogs-1.42.tar.gz tar -xzf e2fsprogs-1.42.tar.gz cd e2fsprogs-1.42 ./configure --host=arm-none-linux-gnueabi --prefix=/home/temp/mtdutils make make install cd lib/uuid/ make install
With the dependencies above cross compiled for ARM and installed, we can now focus on MTD-Utils. Download the mtd-utils from GIT:
git clone git://git.infradead.org/mtd-utils.git cd mtd-utils
mtd-utils does not include a configure script, so we must hack the makefile to cross compile it. Add the following to the makefile :
PREFIX = /home/temp/mtdutils CROSS=arm-none-linux-gnueabi- ZLIBCPPFLAGS = -I$(PREFIX)/include ZLIBLDFLAGS = -L$(PREFIX)/lib LZOCPPFLAGS = -I$(PREFIX)/include LZOLDFLAGS = -L$(PREFIX)/lib LDFLAGS += $(ZLIBLDFLAGS) $(LZOLDFLAGS) CFLAGS ?= -O2 -g $(ZLIBCPPFLAGS) $(LZOCPPFLAGS)
Edit the common.mk file and comment out the PREFIX=/usr line. Then make and install:
WITHOUT_XATTR=1 make make install DESTDIR=/home/temp/mtdutils