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
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
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.)
Previous article:Transplantation of μC/OS-Ⅱ based on ARM7(LPC2131) platform
Next article:ARM40-A5 application - adaptation of fbset and LCD screen parameters
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- Breaking through the intelligent competition, Changan Automobile opens the "God's perspective"
- The world's first fully digital chassis, looking forward to the debut of the U7 PHEV and EV versions
- Design of automotive LIN communication simulator based on Renesas MCU
- When will solid-state batteries become popular?
- Adding solid-state batteries, CATL wants to continue to be the "King of Ning"
- The agency predicts that my country's public electric vehicle charging piles will reach 3.6 million this year, accounting for nearly 70% of the world
- U.S. senators urge NHTSA to issue new vehicle safety rules
- Giants step up investment, accelerating the application of solid-state batteries
- Guangzhou Auto Show: End-to-end competition accelerates, autonomous driving fully impacts luxury...
- Lotus launches ultra-900V hybrid technology "Luyao" to accelerate the "Win26" plan
- How to adjust the optical drive laser head power
- Share an article I read about PLL integer boundary spurs by IDT (Renesas)
- Tcp_Udp test
- Several questions about common source amplifier circuits.
- Reliable communications for short-range wireless systems
- Technical guidance: How to use copper holes and copper grooves in Protel 99 SE and AD
- I can't read the TMP275 temperature sensor. I use the STM32 I/O to simulate IIC. Please help.
- Understanding GaN Device Thermal Analysis
- 5. Control objects in previous “Control” competitions
- Dual-position drive linear servo motor triple dynamic synchronous control