资源简介
强大的工具 -- 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
- 上一篇:微信小程序 记事本
- 下一篇:软件工程课程设计-物流平台的信息发布
相关资源
- ARM9(S3C2440PCB)
- 2440自编简易操作系统——实现任务调
- mini2440 vxworks bsp
- VxWorks BSP for s3c2440
- 基于mini2440 NFS挂载图文并茂
- S3C2440触摸屏驱动详解
- Qt实现ATK-AS608指纹设备录制、检索、识
- 基于mini2440的USB视频采集
- UC/OSII MINI2440移植
- ARM9mini2440GPS程序
- TQ2440开发板中断处理裸机程序
- mini2440之U-boot移植详细手册-20110908.p
- 温湿度传感器DHT11在mini2440上基于lin
- 韦东山视频资料整合
- qq_24407155_8246105.zip
- 基于mini2440+linux下的ds18b20驱动,
- TQ2440的触摸屏应用与校正
- mini2440按键驱动实验--4个按键分别控制
- 韦东山JZ2440第三版原理图
- Jflash烧录mini2440 norflash的项目文件
- 扬创 YC2440-T35B启动u-boot文件
- 用于jz2440的dht11驱动
- ARM9_S3C2440最小系统.doc
- 基于S3C2440和嵌入式Linux的扩展串口设
- S3C2440开发资料全
- qemu-kvm源码分析
- 天嵌TQ2440 USB驱动
- qemu-img for Windows
- qemu-kvm0.12.1.tar.gz kvm虚拟化软件包
- Qemu-1.0.1 for windows
评论
共有 条评论