Skip to content

Commit

Permalink
基本上是一个未改动的干净的uboot源码,以后可以直接将其恢复即可
Browse files Browse the repository at this point in the history
  • Loading branch information
xianbintang committed Oct 28, 2015
1 parent 699bdc8 commit 15f088c
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 39 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.[oa]
tags
cscope.out
*.depend
u-boot*
*.map
11 changes: 2 additions & 9 deletions fs/yaffs2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,14 @@ COBJS-$(CONFIG_YAFFS2) := \
SRCS := $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y))

# -DCONFIG_YAFFS_NO_YAFFS1
CFLAGS += -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 -DNO_Y_INLINE -DLINUX_VERSION_CODE=0x20622
# -DCONFIG_YAFFS_NO_YAFFS1 -DCONFIG_YAFFS_YAFFS2
CFLAGS += -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DLINUX_VERSION_CODE=0x20500 -DCONFIG_YAFFS_YAFFS2

all: $(LIB)

$(LIB): $(obj).depend $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)

#.PHONY: clean distclean
#clean:
# rm -f $(OBJS)

#distclean: clean
# rm -f $(LIB) core *.bak .depend

#########################################################################

# defines $(obj).depend target
Expand Down
18 changes: 6 additions & 12 deletions fs/yaffs2/yaffs_mtdif.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ const char *yaffs_mtdif_c_version =
#include "linux/time.h"
#include "linux/mtd/nand.h"

//#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
#if 1
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
static struct nand_oobinfo yaffs_oobinfo = {
.useecc = 1,
.eccbytes = 6,
Expand All @@ -40,8 +39,7 @@ static struct nand_oobinfo yaffs_noeccinfo = {
};
#endif

//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 1
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
static inline void translate_spare2oob(const yaffs_Spare *spare, __u8 *oob)
{
oob[0] = spare->tagByte0;
Expand Down Expand Up @@ -80,16 +78,14 @@ int nandmtd_WriteChunkToNAND(yaffs_Device * dev, int chunkInNAND,
const __u8 * data, const yaffs_Spare * spare)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
struct mtd_oob_ops ops;
#endif
size_t dummy;
int retval = 0;

loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk;
//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
__u8 spareAsBytes[8]; /* OOB */

if (data && !spare)
Expand Down Expand Up @@ -146,16 +142,14 @@ int nandmtd_ReadChunkFromNAND(yaffs_Device * dev, int chunkInNAND, __u8 * data,
yaffs_Spare * spare)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
struct mtd_oob_ops ops;
#endif
size_t dummy;
int retval = 0;

loff_t addr = ((loff_t) chunkInNAND) * dev->nDataBytesPerChunk;
//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
__u8 spareAsBytes[8]; /* OOB */

if (data && !spare)
Expand Down
12 changes: 4 additions & 8 deletions fs/yaffs2/yaffs_mtdif2.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
const yaffs_ExtendedTags * tags)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
struct mtd_oob_ops ops;
#else
size_t dummy;
Expand All @@ -53,8 +52,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(yaffs_Device * dev, int chunkInNAND,
("nandmtd2_WriteChunkWithTagsToNAND chunk %d data %p tags %p"
TENDSTR), chunkInNAND, data, tags));

//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
if (tags)
yaffs_PackTags2(&pt, tags);
else
Expand Down Expand Up @@ -107,8 +105,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
__u8 * data, yaffs_ExtendedTags * tags)
{
struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice);
//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
struct mtd_oob_ops ops;
#endif
size_t dummy;
Expand All @@ -123,8 +120,7 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
("nandmtd2_ReadChunkWithTagsFromNAND chunk %d data %p tags %p"
TENDSTR), chunkInNAND, data, tags));

//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
if (data && !tags)
retval = mtd->read(mtd, addr, dev->nDataBytesPerChunk,
&dummy, data);
Expand Down
16 changes: 6 additions & 10 deletions fs/yaffs2/yaffscfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static yaffsfs_DeviceConfiguration yaffsfs_config[] = {
int yaffs_StartUp(void)
{
struct mtd_info *mtd = &nand_info[0];
int yaffsVersion = 2;
int yaffsVersion = 1;
int nBlocks;

yaffs_Device *flashDev = calloc(1, sizeof(yaffs_Device));
Expand Down Expand Up @@ -162,7 +162,6 @@ int yaffs_StartUp(void)
#endif

// /flash

flashDev->nReservedBlocks = 5;
// flashDev->nShortOpCaches = (options.no_cache) ? 0 : 10;
flashDev->nShortOpCaches = 10; // Use caches
Expand All @@ -176,20 +175,17 @@ int yaffs_StartUp(void)
flashDev->queryNANDBlock = nandmtd2_QueryNANDBlock;
flashDev->spareBuffer = YMALLOC(mtd->oobsize);
flashDev->isYaffs2 = 1;
//#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
#if 0
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
flashDev->nDataBytesPerChunk = mtd->writesize;
flashDev->nChunksPerBlock = mtd->erasesize / mtd->writesize;
#else
//flashDev->nDataBytesPerChunk = mtd->oobblock;
flashDev->nDataBytesPerChunk = 2048;
flashDev->nDataBytesPerChunk = mtd->oobblock;
flashDev->nChunksPerBlock = mtd->erasesize / mtd->oobblock;
#endif
//nBlocks = mtd->size / mtd->erasesize;
nBlocks = 200 ;
nBlocks = mtd->size / mtd->erasesize;

flashDev->nCheckpointReservedBlocks = 10;
flashDev->startBlock = 50;
flashDev->startBlock = 0;
flashDev->endBlock = nBlocks - 1;
}
else
Expand All @@ -198,7 +194,7 @@ int yaffs_StartUp(void)
flashDev->readChunkFromNAND = nandmtd_ReadChunkFromNAND;
flashDev->isYaffs2 = 0;
nBlocks = mtd->size / (YAFFS_CHUNKS_PER_BLOCK * YAFFS_BYTES_PER_CHUNK);
flashDev->startBlock = 320;
flashDev->startBlock = 1;
flashDev->endBlock = nBlocks - 1;
flashDev->nChunksPerBlock = YAFFS_CHUNKS_PER_BLOCK;
flashDev->nDataBytesPerChunk = YAFFS_BYTES_PER_CHUNK;
Expand Down
4 changes: 4 additions & 0 deletions fs/yaffs2/yportenv.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#ifndef __YPORTENV_H__
#define __YPORTENV_H__

#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))



/* XXX U-BOOT XXX */
#ifndef CONFIG_YAFFS_DIRECT
#define CONFIG_YAFFS_DIRECT
Expand Down
13 changes: 13 additions & 0 deletions include/configs/MPC837XERDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
#ifndef __CONFIG_H
#define __CONFIG_H


#define YAFFS2_DEBUG

#ifdef YAFFS2_DEBUG
#define YD_LEVEL 5
#define YD(level, str) if (level < YD_LEVEL) printf("%s", str)
#else
#define YD(level, str)
#endif




/*
* High Level Configuration Options
*/
Expand Down
1 change: 1 addition & 0 deletions include/linux/mtd/compat.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _LINUX_COMPAT_H_
#define _LINUX_COMPAT_H_


#define __user
#define __iomem

Expand Down

0 comments on commit 15f088c

Please sign in to comment.