资源简介
强大的工具 -- Flashimg
flashimg是一个由网友 Fabrice Jouhaud 开发的软件,可以很快捷地生成NAND或NOR镜像文

代码片段和文件信息
/*
* flashimg
* Copyright (C) 2011-2012 Yargil
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
*/
#include
#include
#include
#include
#include
#include
#include
#include “config.h“
#define FLASH_TYPE_NAND 0
#define FLASH_TYPE_NOR 1
struct image {
char *mem;
size_t size;
};
struct action {
char *part;
char *file;
char action;
};
struct ecc_info {
int page_size;
int oob_size;
int ecc_nb;
int ecc_pos[24];
};
struct ecc_info const ecc_tab[] = {
{
.page_size = 256
.oob_size = 8
.ecc_nb = 3
.ecc_pos = { 0 1 2 }
}
{
.page_size = 512
.oob_size = 16
.ecc_nb = 6
.ecc_pos = { 0 1 2 3 6 7 }
}
{
.page_size = 2048
.oob_size = 64
.ecc_nb = 24
.ecc_pos = {
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63 }
}
};
struct partition {
char *name;
long off;
long len;
};
static struct ecc_info const *ecc = NULL;
static int page_size;
static struct partition part_tab[32];
static int nb_part;
static int flash_type;
void __nand_calculate_ecc(const unsigned char *buf unsigned int eccsize
unsigned char *code);
static void oob(const unsigned char *buf size_t len unsigned char *check)
{
int i;
unsigned char code[32] *_code;
memset(check 0xff 16);
_code = code;
for (i=0;i __nand_calculate_ecc(buf+i*256 256 _code);
check[0] = _code[0];
check[1] = _code[1];
check[2] = _code[2];
_code += 3;
}
for (i=0;iecc_nb;i++)
check[ecc->ecc_pos[i]] = code[i];
}
/*
* Parse the partition file
*/
static int partition_file(const char *filename)
{
int idx = 0;
char name[64];
long off len;
FILE *fp;
int retval = 0;
/*
* File format:
*
*/
printf(“Partition list:\n“);
fp = fopen(filename “r“);
if (fp == NULL) {
fprintf(stderr “Can‘t open partition file %s\n“ filename);
return -1;
}
printf(“name\toffset\t\tsize\n“);
do {
int ret = fscanf(fp “%s %li %li“ name &len &off);
if (ret == -1) break;
if (ret != 3) {
retval = -1;
fprintf(stderr “Error in partition file\n“);
break;
}
part_tab[idx].name = strdup(name);
part_tab[idx].off = off;
part_tab[idx].len = len;
printf(“%s\t0x%08l
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-11-25 02:42 flashimg-master\
文件 166 2013-11-25 02:42 flashimg-master\.gitignore
文件 16 2013-11-25 02:42 flashimg-master\AUTHORS
文件 18011 2013-11-25 02:42 flashimg-master\COPYING
文件 0 2013-11-25 02:42 flashimg-master\ChangeLog
文件 18045 2013-11-25 02:42 flashimg-master\LICENSE
文件 306 2013-11-25 02:42 flashimg-master\Makefile.am
文件 0 2013-11-25 02:42 flashimg-master\NEWS
文件 1650 2013-11-25 02:42 flashimg-master\README
文件 188 2013-11-25 02:42 flashimg-master\README.md
文件 307 2013-11-25 02:42 flashimg-master\autocp.sh
文件 153 2013-11-25 02:42 flashimg-master\autogen.sh
文件 641 2013-11-25 02:42 flashimg-master\configure.ac
文件 9874 2013-11-25 02:42 flashimg-master\main.c
文件 12378 2013-11-25 02:42 flashimg-master\nand_ecc.c
文件 109 2013-11-25 02:42 flashimg-master\uboot.part
- 上一篇:微信小程序 记事本
- 下一篇:软件工程课程设计-物流平台的信息发布
相关资源
- 2440 cs8900a 网卡驱动程序
- qemu-0.8.1-windows-2
- mini2440全套裸机程序MDK 运行
- TQ2440裸机中断(外部中断)
- 收藏奉献_DOS汉字系统21:国家统计局
- 国嵌mini2440项目开发手册
- S3C2440中文手册pdf(去密码)
- 基于mini2440安全文件传输系统
- 基于嵌入式的安防视频监控
- JZ2440使用手册
- Qemu Libvirt & KVM.pdf
- S3C2440核心板PCB完整工程,带原理图
- AD设计的 ARM9 S3C2440核心板原理图和P
- 友善之臂mini2440内核文件,测试可用
- ds18b20-mini2440驱动,测试程序,qt显示
- MSL2024404880488095用户指南
- mini2440基于MDK的全套裸机程序
- 基于S3C2440的keil For ARM程序
- S3C2440平台操作系统内核设计与实现
- keil MDK s3c2440 按键 中断 led 蜂鸣器
- WinCE6.02440开发教程
- 三星S3C2440参考设计!
- win7、win10环境的友善之臂mini2440的us
- QEMU for windows+安装说明
- TE2440-II全部用户手册.rar
- 基于mini2440的mp3播放器的设计
- u-boot-2012.10移植全记录基于s3c2440
- 虚拟机镜像的制作
- 64位系统Mini2440-USBDriver-DebugTool
- mini2440串口工具(for windowns)
评论
共有 条评论