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

相关文章

将Mybatis升级为Mybatis-Plus的详细过程

《将Mybatis升级为Mybatis-Plus的详细过程》本文详细介绍了在若依管理系统(v3.8.8)中将MyBatis升级为MyBatis-Plus的过程,旨在提升开发效率,通过本文,开发者可实现... 目录说明流程增加依赖修改配置文件注释掉MyBATisConfig里面的Bean代码生成使用IDEA生

Java编译生成多个.class文件的原理和作用

《Java编译生成多个.class文件的原理和作用》作为一名经验丰富的开发者,在Java项目中执行编译后,可能会发现一个.java源文件有时会产生多个.class文件,从技术实现层面详细剖析这一现象... 目录一、内部类机制与.class文件生成成员内部类(常规内部类)局部内部类(方法内部类)匿名内部类二、

C# WinForms存储过程操作数据库的实例讲解

《C#WinForms存储过程操作数据库的实例讲解》:本文主要介绍C#WinForms存储过程操作数据库的实例,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、存储过程基础二、C# 调用流程1. 数据库连接配置2. 执行存储过程(增删改)3. 查询数据三、事务处

JSON Web Token在登陆中的使用过程

《JSONWebToken在登陆中的使用过程》:本文主要介绍JSONWebToken在登陆中的使用过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录JWT 介绍微服务架构中的 JWT 使用结合微服务网关的 JWT 验证1. 用户登录,生成 JWT2. 自定义过滤

java中使用POI生成Excel并导出过程

《java中使用POI生成Excel并导出过程》:本文主要介绍java中使用POI生成Excel并导出过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录需求说明及实现方式需求完成通用代码版本1版本2结果展示type参数为atype参数为b总结注:本文章中代码均为

SpringCloud之LoadBalancer负载均衡服务调用过程

《SpringCloud之LoadBalancer负载均衡服务调用过程》:本文主要介绍SpringCloud之LoadBalancer负载均衡服务调用过程,具有很好的参考价值,希望对大家有所帮助,... 目录前言一、LoadBalancer是什么?二、使用步骤1、启动consul2、客户端加入依赖3、以服务

Oracle存储过程里操作BLOB的字节数据的办法

《Oracle存储过程里操作BLOB的字节数据的办法》该篇文章介绍了如何在Oracle存储过程中操作BLOB的字节数据,作者研究了如何获取BLOB的字节长度、如何使用DBMS_LOB包进行BLOB操作... 目录一、缘由二、办法2.1 基本操作2.2 DBMS_LOB包2.3 字节级操作与RAW数据类型2.

C#原型模式之如何通过克隆对象来优化创建过程

《C#原型模式之如何通过克隆对象来优化创建过程》原型模式是一种创建型设计模式,通过克隆现有对象来创建新对象,避免重复的创建成本和复杂的初始化过程,它适用于对象创建过程复杂、需要大量相似对象或避免重复初... 目录什么是原型模式?原型模式的工作原理C#中如何实现原型模式?1. 定义原型接口2. 实现原型接口3

Spring Security注解方式权限控制过程

《SpringSecurity注解方式权限控制过程》:本文主要介绍SpringSecurity注解方式权限控制过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、摘要二、实现步骤2.1 在配置类中添加权限注解的支持2.2 创建Controller类2.3 Us

Spring AI集成DeepSeek三步搞定Java智能应用的详细过程

《SpringAI集成DeepSeek三步搞定Java智能应用的详细过程》本文介绍了如何使用SpringAI集成DeepSeek,一个国内顶尖的多模态大模型,SpringAI提供了一套统一的接口,简... 目录DeepSeek 介绍Spring AI 是什么?Spring AI 的主要功能包括1、环境准备2