mtd-utils编译过程

2024-02-17 07:58
文章标签 编译 过程 utils mtd

本文主要是介绍mtd-utils编译过程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

http://blog.csdn.net/jackyard/article/details/46453055

一.mtd-utils编译过程
下载:
sun@ubuntu:/work/6410/tools$ git clone git://git.infradead.org/mtd-utils.git
修改Makefile
sun@ubuntu:/work/6410/tools/mtd-utils$ vi common.mk 
  1 CROSS=arm-none-linux-gnueabi-                               ;指定交叉编译器
 25 PREFIX=/tmp/mtd
1.第一次编译

  1. sun@ubuntu:/work/6410/tools/mtd-utils$ make
  2.   CHK include/version.h
  3.   LD ftl_format
  4.   CC flash_erase.o
  5.   LD flash_erase
  6.   CC nanddump.o
  7.   LD nanddump
  8.   CC doc_loadbios.o
  9.   LD doc_loadbios
  10.   CC ftl_check.o
  11.   LD ftl_check
  12.   CC mkfs.jffs2.o
  13. mkfs.jffs2.c:70:21:error: sys/acl.h: No such file or directory
  14. mkfs.jffs2.c:Infunction'formalize_posix_acl':
  15. mkfs.jffs2.c:1024:error:'ACL_USER_OBJ' undeclared (first use in this function)
  16. mkfs.jffs2.c:1024:error:(Each undeclared identifier is reported only once
  17. mkfs.jffs2.c:1024:error:foreachfunction it appears in.)
  18. mkfs.jffs2.c:1025:error:'ACL_GROUP_OBJ' undeclared (first use in this function)
  19. mkfs.jffs2.c:1026:error:'ACL_MASK' undeclared (first use in this function)
  20. mkfs.jffs2.c:1027:error:'ACL_OTHER' undeclared (first use in this function)
  21. mkfs.jffs2.c:1033:error:'ACL_USER' undeclared (first use in this function)
  22. mkfs.jffs2.c:1034:error:'ACL_GROUP' undeclared (first use in this function)
  23. make:***[/work/6410/tools/mtd-utils/arm-none-linux-gnueabi/mkfs.jffs2.o]Error 1
原因:  编译时调用acl.h了而没有调用zlib库
解决方法:指定WITHOUT_XATTR=1 指定编译时要调用zlib库

2.第二次编译
  1. sun@ubuntu:/work/6410/tools/mtd-utils$ make WITHOUT_XATTR=1
  2.   CHK include/version.h
  3.   CC mkfs.jffs2.o
  4.   CC compr_rtime.o
  5.   CC compr_zlib.o
  6.   CC compr_lzo.o
  7. compr_lzo.c:31:23:error: lzo/lzo1x.h: No such file or directory
  8. compr_lzo.c:Infunction'jffs2_lzo_cmpr':
  9. compr_lzo.c:53:error:'lzo_uint' undeclared (first use in this function)
  10. compr_lzo.c:53:error:(Each undeclared identifier is reported only once
  11. compr_lzo.c:53:error:foreachfunction it appears in.)
  12. compr_lzo.c:53:error: expected ';' before 'compress_size'
  13. compr_lzo.c:56: warning: implicit declaration of function'lzo1x_999_compress'
  14. compr_lzo.c:56:error:'compress_size' undeclared (first use in this function)
  15. compr_lzo.c:58:error:'LZO_E_OK' undeclared (first use in this function)
  16. compr_lzo.c:Infunction'jffs2_lzo_decompress':
  17. compr_lzo.c:74:error:'lzo_uint' undeclared (first use in this function)
  18. compr_lzo.c:74:error: expected ';' before 'dl'
  19. compr_lzo.c:76: warning: implicit declaration of function'lzo1x_decompress_safe'
  20. compr_lzo.c:76:error:'dl' undeclared (first use in this function)
  21. compr_lzo.c:78:error:'LZO_E_OK' undeclared (first use in this function)
  22. compr_lzo.c:Infunction'jffs2_lzo_init':
  23. compr_lzo.c:97:error:'LZO1X_999_MEM_COMPRESS' undeclared (first use in this function)
  24. make:***[/work/6410/tools/mtd-utils/arm-none-linux-gnueabi/compr_lzo.o]Error 1
原因: 没有lzo库
解决方法:编译lzo库,并添加到交叉编译工具链中
  1. sun@ubuntu:/work/6410/tools/mtd-utils$ cd ..
  2. sun@ubuntu:/work/6410/tools$ wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.06.tar.gz   //下载lzo库
  3. sun@ubuntu:/work/6410/tools$ ls
  4. lzo-2.06.tar.gz mtd-utils
  5. //下面的config指定交叉编译器
  6. sun@ubuntu:/work/6410/tools/lzo-2.06$ CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-linux --prefix=/opt/6410/4.3.2/arm-none-linux-gnueabi/
  7. //编译
  8. sun@ubuntu:/work/6410/tools/lzo-2.06$ make && make install
  9. //确认在工具链目录中是否己经有头文件了
  10. sun@ubuntu:/work/6410/tools/lzo-2.06$ find /opt/6410/4.3.2/-name "lzo1x.h"
  11. /opt/6410/4.3.2/arm-none-linux-gnueabi/include/lzo/lzo1x.h
3.第三次编译
  1. sun@ubuntu:/work/6410/tools/mtd-utils$ make WITHOUT_XATTR=1
  2.   CHK include/version.h
  3.   LD mkfs.jffs2
  4. /opt/6410/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lz
  5. collect2: ld returned 1 exit status
  6. make:***[/work/6410/tools/mtd-utils/arm-none-linux-gnueabi/mkfs.jffs2]Error 1
原因: 没有libz库
解决方法:编译libz库,并添加到交叉编译工具链中
  1. sun@ubuntu:/work/6410/tools$ wget http://zlib.net/zlib-1.2.8.tar.gz   //下载lzo库
  2. sun@ubuntu:/work/6410/tools$ ls
  3. lzo-2.06 lzo-2.06.tar.gz lzo-2.06.tar.gz.1 mtd-utils zlib-1.2.8.tar.gz
  4. sun@ubuntu:/work/6410/tools$ tar xf zlib-1.2.8.tar.gz 
  5. sun@ubuntu:/work/6410/tools$ cd zlib-1.2.8/
  6. //下面的config指定交叉编译器
  7. sun@ubuntu:/work/6410/tools/zlib-1.2.8$ CC=arm-none-linux-gnueabi-gcc ./configure --shared --prefix=/opt/6410/4.3.2/arm-none-linux-gnueabi/
  8. //编译并安装到工具链目录中
  9. sun@ubuntu:/work/6410/tools/zlib-1.2.8$ make && make install
  10. //确认在工具链目录中是否己经有库了
  11. sun@ubuntu:/work/6410/tools/zlib-1.2.8$ find /opt/6410/4.3.2/arm-none-linux-gnueabi/-name "libz*"
  12. /opt/6410/4.3.2/arm-none-linux-gnueabi/lib/libz.a
  13. /opt/6410/4.3.2/arm-none-linux-gnueabi/lib/libz.so.1
  14. /opt/6410/4.3.2/arm-none-linux-gnueabi/lib/libz.so.1.2.8
  15. /opt/6410/4.3.2/arm-none-linux-gnueabi/lib/libz.so
  16. /opt/6410/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/libz.a
4.第四次编译
  1. sun@ubuntu:/work/6410/tools/mtd-utils$ make WITHOUT_XATTR=1
  2. In file included from mkfs.ubifs/mkfs.ubifs.c:26:
  3. mkfs.ubifs/mkfs.ubifs.h:46:23:error: uuid/uuid.h: No such file or directory
  4. mkfs.ubifs/mkfs.ubifs.c:Infunction'write_data':
  5. mkfs.ubifs/mkfs.ubifs.c:1621: warning: implicit declaration of function'time'
  6. mkfs.ubifs/mkfs.ubifs.c:Infunction'write_super':
  7. mkfs.ubifs/mkfs.ubifs.c:1934: warning: implicit declaration of function'uuid_generate_random'
  8. mkfs.ubifs/mkfs.ubifs.c:1938: warning: implicit declaration of function'uuid_unparse_upper'
  9. make:***[/work/6410/tools/mtd-utils/arm-none-linux-gnueabi/mkfs.ubifs/mkfs.ubifs.o]Error 1
原因: 找不到头文件uuid
解决方法:
  1. sun@ubuntu:/opt/6410/4.3.2$ grep "uuid_generate_random"*-
  2.       arm-none-linux-gnueabi/libc/usr/include/uuid.h:void uuid_generate_random(uuid_t out);
  3. //搜索发现uuid.h是在include目录下而不是在uuid这个目录下,所以只需要改一下路径就可以了
  4. sun@ubuntu:/work/6410/tools/mtd-utils$ vi mkfs.ubifs/mkfs.ubifs.h
  5.  46 //#include <uuid/uuid.h>
  6.  47 #include <uuid.h>
5.第五次编译
  1. sun@ubuntu:/work/6410/tools/mtd-utils$ make WITHOUT_XATTR=1
  2.   CHK include/version.h
  3.   CC mkfs.ubifs/mkfs.ubifs.o
  4.   CC mkfs.ubifs/crc16.o
  5.   CC mkfs.ubifs/lpt.o
  6.   CC mkfs.ubifs/compr.o
  7.   CC mkfs.ubifs/devtable.o
  8.   CC mkfs.ubifs/hashtable/hashtable.o
  9.   CC mkfs.ubifs/hashtable/hashtable_itr.o
  10.   CC ubi-utils/libubi.o
  11.   AR ubi-utils/libubi.a
  12.   LD mkfs.ubifs/mkfs.ubifs
  13. /opt/6410/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -luuid
  14. collect2: ld returned 1 exit status
原因: 找不到库libuuid
解决方法:
  1. sun@ubuntu:/opt/6410/4.3.2$ find .-name "libuuid*"
  2. ./arm-none-linux-gnueabi/libc/armv4t/usr/lib/libuuid.so.1
  3. ./arm-none-linux-gnueabi/libc/armv4t/usr/lib/libuuid.so
  4. ./arm-none-linux-gnueabi/libc/armv4t/usr/lib/libuuid.so.1.2
  5. //搜索发现libuuid是在libc/armv4t/usr/lib目录下,arm-none-linux-gnueabi-ld找不到,所以加个软链接
  6. sun@ubuntu:/opt/6410/4.3.2/arm-none-linux-gnueabi/lib$ ln -../libc/armv4t/usr/lib/libuuid.so ./libuuid.so
6.第六次编译
OK,可以了,这样就有了一大串命令
  1. sun@ubuntu:/work/6410/tools/mtd-utils$ ls /tmp/mtd/sbin/
  2. docfdisk flash_eraseall flash_otp_lock ftl_format mkfs.ubifs nandtest recv_image sumtool ubiformat ubirename
  3. doc_loadbios flash_lock flash_otp_write jffs2dump mtd_debug nandwrite rfddump ubiattach ubimkvol ubirmvol
  4. flashcp flash_otp_dump flash_unlock jffs2reader mtdinfo nftldump rfdformat ubicrc32 ubinfo ubirsvol
  5. flash_erase flash_otp_info ftl_check mkfs.jffs2 nanddump nftl_format serve_image ubidetach ubinize ubiupdatevol



这篇关于mtd-utils编译过程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/717148

相关文章

Redis中Hash从使用过程到原理说明

《Redis中Hash从使用过程到原理说明》RedisHash结构用于存储字段-值对,适合对象数据,支持HSET、HGET等命令,采用ziplist或hashtable编码,通过渐进式rehash优化... 目录一、开篇:Hash就像超市的货架二、Hash的基本使用1. 常用命令示例2. Java操作示例三

Redis中Set结构使用过程与原理说明

《Redis中Set结构使用过程与原理说明》本文解析了RedisSet数据结构,涵盖其基本操作(如添加、查找)、集合运算(交并差)、底层实现(intset与hashtable自动切换机制)、典型应用场... 目录开篇:从购物车到Redis Set一、Redis Set的基本操作1.1 编程常用命令1.2 集

Linux下利用select实现串口数据读取过程

《Linux下利用select实现串口数据读取过程》文章介绍Linux中使用select、poll或epoll实现串口数据读取,通过I/O多路复用机制在数据到达时触发读取,避免持续轮询,示例代码展示设... 目录示例代码(使用select实现)代码解释总结在 linux 系统里,我们可以借助 select、

k8s中实现mysql主备过程详解

《k8s中实现mysql主备过程详解》文章讲解了在K8s中使用StatefulSet部署MySQL主备架构,包含NFS安装、storageClass配置、MySQL部署及同步检查步骤,确保主备数据一致... 目录一、k8s中实现mysql主备1.1 环境信息1.2 部署nfs-provisioner1.2.

MyBatis/MyBatis-Plus同事务循环调用存储过程获取主键重复问题分析及解决

《MyBatis/MyBatis-Plus同事务循环调用存储过程获取主键重复问题分析及解决》MyBatis默认开启一级缓存,同一事务中循环调用查询方法时会重复使用缓存数据,导致获取的序列主键值均为1,... 目录问题原因解决办法如果是存储过程总结问题myBATis有如下代码获取序列作为主键IdMappe

linux部署NFS和autofs自动挂载实现过程

《linux部署NFS和autofs自动挂载实现过程》文章介绍了NFS(网络文件系统)和Autofs的原理与配置,NFS通过RPC实现跨系统文件共享,需配置/etc/exports和nfs.conf,... 目录(一)NFS1. 什么是NFS2.NFS守护进程3.RPC服务4. 原理5. 部署5.1安装NF

MySQL使用EXISTS检查记录是否存在的详细过程

《MySQL使用EXISTS检查记录是否存在的详细过程》EXISTS是SQL中用于检查子查询是否返回至少一条记录的运算符,它通常用于测试是否存在满足特定条件的记录,从而在主查询中进行相应操作,本文给大... 目录基本语法示例数据库和表结构1. 使用 EXISTS 在 SELECT 语句中2. 使用 EXIS

oracle 11g导入\导出(expdp impdp)之导入过程

《oracle11g导入导出(expdpimpdp)之导入过程》导出需使用SEC.DMP格式,无分号;建立expdir目录(E:/exp)并确保存在;导入在cmd下执行,需sys用户权限;若需修... 目录准备文件导入(impdp)1、建立directory2、导入语句 3、更改密码总结上一个环节,我们讲了

ShardingProxy读写分离之原理、配置与实践过程

《ShardingProxy读写分离之原理、配置与实践过程》ShardingProxy是ApacheShardingSphere的数据库中间件,通过三层架构实现读写分离,解决高并发场景下数据库性能瓶... 目录一、ShardingProxy技术定位与读写分离核心价值1.1 技术定位1.2 读写分离核心价值二

MyBatis-plus处理存储json数据过程

《MyBatis-plus处理存储json数据过程》文章介绍MyBatis-Plus3.4.21处理对象与集合的差异:对象可用内置Handler配合autoResultMap,集合需自定义处理器继承F... 目录1、如果是对象2、如果需要转换的是List集合总结对象和集合分两种情况处理,目前我用的MP的版本