arm linux port mtd-utils 1.x

Publisher:快乐家庭Latest update time:2024-11-08 Source: cnblogsKeywords:arm  linux Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

background

It is related to the production environment of the company. I don't want to burn nand flash under uboot every time. I also think that the method of upgrading with USB disk is slow. Besides, the relevant driver is not written by me, so I don't want to be controlled by others. I still hope it is more universal under Linux.

Related articles: "Use of mtd-utils", "Use mtd-utils to burn various parts of the Arm Linux system"

Requirements: When following this article, you need to clearly know the programming address and size of each part.

Host platform: Ubuntu 16.04
Arm platform: 3531d

mtd-utils: 1.4.8

zlib: 1.2.11

lzo: 2.08

e2fsprogs: 1.41.14

arm-gcc : 4.9.4

Compile

One script to solve all problems

bash

##

# Copyright By Schips, All Rights Reserved

# Custom variables


OUTPUT_PATH=`pwd`/install

BUILD_HOST=arm-linux

ARM_GCC=${BUILD_HOST}-gcc

BASE=`pwd`

ZLIB=zlib-1.2.11

MTD_UTILS=mtd-utils-1.4.8

LZO=lzo-2.08

E2FSPROGS=e2fsprogs-1.41.14


make_dirs() {

#For ease of management, create relevant directories

cd ${BASE} && mkdir compressed install source -p

}


tget () { #try wget

filename=`basename $1`

echo "Downloading [${filename}]..."

if [ ! -f ${filename} ];then

wget $1

fi


echo "[OK] Downloaded [${filename}] "

}



download_package() {

cd ${BASE}/compressed


tget https://www.zlib.net/${ZLIB}.tar.gz

tget http://www.oberhumer.com/opensource/lzo/download/${LZO}.tar.gz

# Note the URL of the following line

tget https://jaist.dl.sourceforge.net/project/e2fsprogs/e2fsprogs/1.41.14/${E2FSPROGS}.tar.gz

tget ftp://ftp.infradead.org/pub/mtd-utils/${MTD_UTILS}.tar.bz2


}


tar_package() {

cd ${BASE}/compressed

ls * > /tmp/list.txt

for TAR in `cat /tmp/list.txt`

do

tar -xf $TAR -C ../source

done

rm -rf /tmp/list.txt

}



make_zlib () {

# Compile and install zlib

cd ${BASE}/source/${ZLIB}

echo "ZLIB ABOUT"

CC=${ARM_GCC} ./configure --prefix=${OUTPUT_PATH}/${ZLIB}

make && make install

}


make_lzo () {

# Compile and install lzo

cd ${BASE}/source/${LZO}

echo "LZO ABOUT"

CC=${ARM_GCC} ./configure --host=arm-linux --prefix=${OUTPUT_PATH}/${LZO}

make && make install

}


make_e2fsprogs() {

# Compile and install e2fsprogs

cd ${BASE}/source/${E2FSPROGS}

echo "E2FSPROGS ABOUT"

CC=${ARM_GCC} ./configure --host=arm-linux --enable-elf-shlibs --prefix=${OUTPUT_PATH}/${E2FSPROGS}

make && make install-libs

mkdir ${OUTPUT_PATH}/${E2FSPROGS}/include/uuid -p

cp lib/uuid/uuid.h ${OUTPUT_PATH}/${E2FSPROGS}/include/uuid

}


make_mtd_utils() {

# Compile and install mtd-utils

cd ${BASE}/source/${MTD_UTILS}

echo "MTD ABOUT"

# The following 4 lines fix some problems with mtd compilation

sed -r -i "/LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid/ s/.*/LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid $(ZLIBLDFLAGS) $(LZOLDFLAGS) $(UUIDLDLIBS)/ g" Makefile

sed -r -i "/#include / s/.*/#include "uuid/uuid.h"/g" mkfs.ubifs/mkfs.ubifs.h

mkdir mkfs.ubifs/uuid -p

cp ${BASE}/source/${E2FSPROGS}/lib/uuid/uuid.h mkfs.ubifs/uuid/uuid.h


export CROSS=${BUILD_HOST}-

export DESTDIR=${OUTPUT_PATH}/mtd-utils

export ZLIBCPPFLAGS=-I${OUTPUT_PATH}/${ZLIB}/include

export LZOCPPFLAGS="-I${OUTPUT_PATH}/${LZO}/include -I{$OUTPUT_PATH}/${E2FSPROGS}/include/"

export ZLIBLDFLAGS=-L${OUTPUT_PATH}/${ZLIB}/lib

export LZOLDFLAGS=-L${OUTPUT_PATH}/${LZO}/lib

export UUIDLDLIBS=-L${OUTPUT_PATH}/${E2FSPROGS}/lib


make WITHOUT_XATTR=1

}


make_dirs

#download_package

tar_package

make_zlib

make_lzo

make_e2fsprogs

make_mtd_utils


mtd-utils:

After make: the mtd-utils toolchain will be generated in the $CROSS directory under the current directory

After make install: the results generated by make will be installed in the DESTDIR directory

If make install fails, you can find the compiled results manually in the directory of the $CROSS file name

img

img

Just copy the required programs and libraries

Compilation of mtd-utils 2.0 version: https://blog.csdn.net/liyangzmx/article/details/93901411

(Note: I tried to compile version 2.x, but failed.)


Keywords:arm  linux Reference address:arm linux port mtd-utils 1.x

Previous article:Transplantation of μC/OS-Ⅱ based on ARM7(LPC2131) platform
Next article:ARM40-A5 application - adaptation of fbset and LCD screen parameters

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号