Board logo

标题: 成功在skyeye 上实现U-Boot 的Nand命令并从Nand中启动Linux [打印本页]

作者: zbluecn    时间: 2008-2-25 21:45     标题: 成功在skyeye 上实现U-Boot 的Nand命令并从Nand中启动Linux

同主题~~
一天的时间 就跟踪代码了~~

步骤见2楼


[root@fc4 test]# vim u-boot.conf
复制内容到剪贴板
代码:
# skyeye config file for S3C2410X

cpu: arm920t
mach: s3c2410x

# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000, file=./u-boot.bin ,boot=yes

mem_bank: map=M, type=RW, addr=0x30000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0x30800000, size=0x00800000
mem_bank: map=M, type=RW, addr=0x31000000, size=0x03000000


# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020

net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1
nandflash: type=s3c2410x,name=K9F1208U0B,dump=./nand.dump
#lcd:type=s3c2410x, mod=gtk
dbct:state=on

用skyeye 提供的mknandflashdump程序将 我们的u-boot.bin文件镜像到nand.dump 文件中

mknandflashdump u-boot.bin nand.dump 0


[ 本帖最后由 zbluecn 于 2008-2-26 15:48 编辑 ]
作者: zbluecn    时间: 2008-2-26 12:29

1. 下载u-boot-1.1.4.tar.bz2,并解压
2. 将arm-linux-2.95.3复制到/usr/local/arm/2.95.3/

3. 编辑u-boot跟目录的Makefile文件
复制内容到剪贴板
代码:
include $(TOPDIR)/config.mk
CROSS_COMPILE=/usr/local/arm/2.95.3/bin/arm-linux-
ifndef CROSS_COMPILE
复制内容到剪贴板
代码:
smdk2410_config : unconfig
        @./mkconfig $(@:_config=) arm arm920t smdk2410 NULL s3c24x0

sky2410_config : unconfig
        @./mkconfig $(@:_config=) arm arm920t sky2410 NULL s3c24x0

SX1_config :    unconfig
        @./mkconfig $(@:_config=) arm arm925t sx1
4. 复制必要的文件
cp -arf board/smdk2410/ board/sky2410
mv board/sky2410/smdk2410.c board/sky2410/sky2410.c
cp include/configs/smdk2410.h include/configs/sky2410.h

5. 修改board/sky2410/Makefile
复制内容到剪贴板
代码:
LIB = lib$(BOARD).a

OBJS  := sky2410.o flash.o
SOBJS := lowlevel_init.o
6. make 测试一下
make sky2410_config
make
出现错误
cc1: Invalid option `abi=apcs-gnu'
修改文件cpu/arm920t/config.mk
复制内容到剪贴板
代码:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
改成:
复制内容到剪贴板
代码:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu),)
再make成功

7. 开始移植nand
修改cpu/arm920t/start.S

将从Flash启动改成从NAND Flash启动。
将以下U-Boot的重定向语句段:
复制内容到剪贴板
代码:
#ifndef CONFIG_SKIP_RELOCATE_UBOOT
relocate:                /* relocate U-Boot to RAM        */
    adr    r0, _start        /* r0 <- current position of code   */
    ldr    r1, _TEXT_BASE        /* test if we run from flash or RAM */
    cmp     r0, r1                 /* don't reloc during debug         */
    beq     stack_setup

    ldr    r2, _armboot_start
    ldr    r3, _bss_start
    sub    r2, r3, r2        /* r2 <- size of armboot            */
    add    r2, r0, r2        /* r2 <- source end address         */

copy_loop:
    ldmia    r0!, {r3-r10}        /* copy from source address [r0]    */
    stmia    r1!, {r3-r10}        /* copy to   target address [r1]    */
    cmp    r0, r2            /* until source end addreee [r2]    */
    ble    copy_loop
#endif    /* CONFIG_SKIP_RELOCATE_UBOOT */
替换成:
复制内容到剪贴板
代码:
#ifdef CONFIG_S3C2410_NAND_BOOT
@ reset NAND
  mov r1, #NAND_CTL_BASE
  ldr   r2, =0xf830           @ initial value
  str   r2, [r1, #oNFCONF]
  ldr   r2, [r1, #oNFCONF]
  bic  r2, r2, #0x800              @ enable chip
  str   r2, [r1, #oNFCONF]
  mov r2, #0xff         @ RESET command
  strb r2, [r1, #oNFCMD]


  mov r3, #0                   @ wait
nand1:
  add  r3, r3, #0x1
  cmp r3, #0xa
  blt   nand1

nand2:
  ldr   r2, [r1, #oNFSTAT]      @ wait ready
  tst    r2, #0x1
  beq  nand2

  ldr   r2, [r1, #oNFCONF]
  orr  r2, r2, #0x800              @ disable chip
  str   r2, [r1, #oNFCONF]

@ get read to call C functions (for nand_read())
  ldr   sp, DW_STACK_START       @ setup stack pointer
  mov fp, #0                    @ no previous frame, so fp=0

@ copy U-Boot to RAM
  ldr   r0, =TEXT_BASE
  mov     r1, #0x0
  mov r2, #0x20000
  bl    nand_read_ll
  tst    r0, #0x0
  beq  ok_nand_read

bad_nand_read:
loop2:    b     loop2          @ infinite loop


ok_nand_read:
@ verify
  mov r0, #0
  ldr   r1, =TEXT_BASE
  mov r2, #0x400     @ 4 bytes * 1024 = 4K-bytes
go_next:
  ldr   r3, [r0], #4
  ldr   r4, [r1], #4
  teq   r3, r4
  bne  notmatch
  subs r2, r2, #4
  beq  stack_setup
  bne  go_next

notmatch:
loop3:     b     loop3         @ infinite loop

#endif /* CONFIG_S3C2410_NAND_BOOT */
在 “  _start_armboot:    .word start_armboot  ” 后加入:
复制内容到剪贴板
代码:
        .align     2
DW_STACK_START:  .word  STACK_BASE+STACK_SIZE-4
8.
(I)修改board/sky2410/Makefile
OBJS  := sky2410.o flash.o nand_read.o


(II)创建board/sky2410/nand_read.c文件
复制内容到剪贴板
代码:
#include <config.h>
#define __REGb(x) (*(volatile unsigned char *)(x))
#define __REGi(x) (*(volatile unsigned int *)(x))
#define NF_BASE  0x4e000000
#define NFCONF  __REGi(NF_BASE + 0x0)
#define NFCMD  __REGb(NF_BASE + 0x4)
#define NFADDR  __REGb(NF_BASE + 0x8)
#define NFDATA  __REGb(NF_BASE + 0xc)
#define NFSTAT  __REGb(NF_BASE + 0x10)
#define BUSY 1
#ifndef NAND_SECTOR_SIZE
#define NAND_SECTOR_SIZE 512
#endif
#ifndef
#define NAND_BLOCK_MASK 511
#endif
inline void wait_idle(void) {
int i;
while(!(NFSTAT & BUSY))
for(i=0; i<10; i++);
}
/* low level nand read function */
int
nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
{
int i, j;
if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK)) {
return -1; /* invalid alignment */
}
/* chip Enable */
NFCONF &= ~0x800;
for(i=0; i<10; i++);
for(i=start_addr; i < (start_addr + size);) {
/* READ0 */
NFCMD = 0;
/* Write Address */
NFADDR = i & 0xff;
NFADDR = (i >> 9) & 0xff;
NFADDR = (i >> 17) & 0xff;
NFADDR = (i >> 25) & 0xff;
wait_idle();
for(j=0; j < NAND_SECTOR_SIZE; j++, i++) {
*buf = (NFDATA & 0xff);
buf++;
}
}
/* chip Disable */
NFCONF |= 0x800; /* chip disable */
return 0;
}
9.修改include/configs/sky2410.h
在文件的后部添加
复制内容到剪贴板
代码:
/*
* Nandflash Boot
*/
#define CONFIG_S3C2410_NAND_BOOT 1
#define STACK_BASE    0x33f00000
#define STACK_SIZE    0x8000
//#define UBOOT_RAM_BASE    0x33f80000
/* NAND Flash Controller */
#define NAND_CTL_BASE            0x4E000000
#define bINT_CTL(Nb)        __REG(INT_CTL_BASE + (Nb))
/* Offset */
#define oNFCONF               0x00
#define oNFCMD                0x04
#define oNFADDR               0x08
#define oNFDATA               0x0c
#define oNFSTAT               0x10
#define oNFECC                0x14
10.
make 测试一下啊
到这里 u-boot 已经可以从nand启动了

[ 本帖最后由 zbluecn 于 2008-3-3 17:18 编辑 ]
作者: zbluecn    时间: 2008-2-26 12:30

下面我们对u-boot添加nand指令的支持

11. 修改include/configs/sky2410.h
(I)去掉CFG_CMD_NAND的注释
复制内容到剪贴板
代码:
#define CONFIG_COMMANDS \
      (CONFIG_CMD_DFL  | \
      CFG_CMD_CACHE  | \
      CFG_CMD_NAND   | \
      /*CFG_CMD_EEPROM |*/ \
      /*CFG_CMD_I2C  |*/ \
      /*CFG_CMD_USB  |*/ \
      CFG_CMD_REGINFO  | \
      CFG_CMD_DATE   | \
      CFG_CMD_ELF)
[code]

(II) 修改我们在第9步修改的内容
[code]
#define CFG_NAND_LEGACY
#define CFG_ENV_OFFSET  0X20000
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
#define CFG_NAND_BASE 0x4E000000
/* NandFlash控制器在SFR区起始寄存器地址 */
#define CFG_MAX_NAND_DEVICE 1
/* 支持的最在Nand Flash数据 */
#define SECTORSIZE 512
/* 1页的大小 */
#define NAND_SECTOR_SIZE SECTORSIZE
#define NAND_BLOCK_MASK 511
/* 页掩码 */
#define ADDR_COLUMN 1
/* 一个字节的Column地址 */
#define ADDR_PAGE 3
/* 3字节的页块地址!!!!!*/
#define ADDR_COLUMN_PAGE 4
/* 总共4字节的页块地址!!!!! */
#define NAND_ChipID_UNKNOWN 0x00
/* 未知芯片的ID号 */
#define NAND_MAX_FLOORS 1
#define NAND_MAX_CHIPS 1
/* Nand Flash命令层底层接口函数 */
#define WRITE_NAND_COMMAND(d, adr) {rNFCMD = d;}
#define WRITE_NAND_ADDRESS(d, adr) {rNFADDR = d;}
#define WRITE_NAND(d, adr) {rNFDATA = d;}
#define READ_NAND(adr) (rNFDATA)
#define NAND_WAIT_READY(nand) {while(!(rNFSTAT&(1<<0)));}
#define NAND_DISABLE_CE(nand) {rNFCONF |= (1<<11);}
#define NAND_ENABLE_CE(nand) {rNFCONF &= ~(1<<11);}
/* the following functions are NOP's because S3C24X0 handles this in hardware  一定要加上 */
#define NAND_CTL_CLRALE(nandptr)
#define NAND_CTL_SETALE(nandptr)
#define NAND_CTL_CLRCLE(nandptr)
#define NAND_CTL_SETCLE(nandptr)
/* 允许Nand Flash写校验 */
#define CONFIG_MTD_NAND_VERIFY_WRITE 1
/*
* Nandflash Boot
*/
#define CONFIG_S3C2410_NAND_BOOT 1
#define STACK_BASE    0x33f00000
#define STACK_SIZE    0x8000
//#define UBOOT_RAM_BASE    0x33f80000
/* NAND Flash Controller */
#define NAND_CTL_BASE            0x4E000000
#define bINT_CTL(Nb)        __REG(INT_CTL_BASE + (Nb))
/* Offset */
#define oNFCONF               0x00
#define oNFCMD                0x04
#define oNFADDR               0x08
#define oNFDATA               0x0c
#define oNFSTAT               0x10
#define oNFECC                0x14
#define rNFCONF (*(volatile unsigned int *)0x4e000000)
#define rNFCMD (*(volatile unsigned char *)0x4e000004)
#define rNFADDR (*(volatile unsigned char *)0x4e000008)
#define rNFDATA (*(volatile unsigned char *)0x4e00000c)
#define rNFSTAT (*(volatile unsigned int *)0x4e000010)
#define rNFECC (*(volatile unsigned int *)0x4e000014)
#define rNFECC0 (*(volatile unsigned char *)0x4e000014)
#define rNFECC1 (*(volatile unsigned char *)0x4e000015)
#define rNFECC2 (*(volatile unsigned char *)0x4e000016)
#endif /* CONFIG_COMMANDS & CFG_CMD_NAND*/
12. 修改 board/sky2410/sky2410.c
在文件尾部添加
复制内容到剪贴板
代码:
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
typedef enum {
NFCE_LOW,
NFCE_HIGH
} NFCE_STATE;

static inline void NF_Conf(u16 conf)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

nand->NFCONF = conf;
}

static inline void NF_Cmd(u8 cmd)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

nand->NFCMD = cmd;
}

static inline void NF_CmdW(u8 cmd)
{
NF_Cmd(cmd);
udelay(1);
}

static inline void NF_Addr(u8 addr)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

nand->NFADDR = addr;
}

static inline void NF_SetCE(NFCE_STATE s)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

switch (s) {
case NFCE_LOW:
nand->NFCONF &= ~(1<<11);
break;

case NFCE_HIGH:
nand->NFCONF |= (1<<11);
break;
}
}

static inline void NF_WaitRB(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

while (!(nand->NFSTAT & (1<<0)));
}

static inline void NF_Write(u8 data)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

nand->NFDATA = data;
}

static inline u8 NF_Read(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

return(nand->NFDATA);
}

static inline void NF_Init_ECC(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

nand->NFCONF |= (1<<12);
}

static inline u32 NF_Read_ECC(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

return(nand->NFECC);
}

#endif
/*

* NAND flash initialization.
*/
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
extern ulong nand_probe(ulong physadr);


static inline void NF_Reset(void)
{
int i;

NF_SetCE(NFCE_LOW);
NF_Cmd(0xFF); /* reset command */
for(i = 0; i < 10; i++); /* tWB = 100ns. */
NF_WaitRB(); /* wait 200~500us; */
NF_SetCE(NFCE_HIGH);
}


static inline void NF_Init(void)
{
#if 0 /* a little bit too optimistic */
#define TACLS 0
#define TWRPH0 3
#define TWRPH1 0
#else
#define TACLS 0
#define TWRPH0 4
#define TWRPH1 2
#endif

NF_Conf((1<<15)|(0<<14)|(0<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0));
/*nand->NFCONF = (1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0); */
/* 1 1 1 1, 1 xxx, r xxx, r xxx */
/* En 512B 4step ECCR nFCE=H tACLS tWRPH0 tWRPH1 */

NF_Reset();
}

void
nand_init(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

NF_Init();
#ifdef DEBUG
printf("NAND flash probing at 0x%.8lX\n", (ulong)nand);
#endif
printf ("%4lu MB\n", nand_probe((ulong)nand) >> 20);
}
#endif
现在我问对uboot的nand指令的修改也完成了

上面的步骤基本的在网上也能找到
但是,如果就真么直接使用的话 skyeye1.2.4就会报错

SMDK2410 # nand read 33000000 0 20000
NAND read: device 0 offset 0, size 131072 ... warning when RE  falling,do nothing
  0 bytes read: ERROR

最后花费一天的时间跟踪 skyeye 和u-boot 终于找到错误的原因了

在u-boot读取oob数据
先发送了NanD_Command(nand, NAND_CMD_READOOB)
然后发送NanD_Address(nand, ADDR_COLUMN_PAGE
这个时候 skyeye模拟的nand就准备好数据了
直接就可以用 READ_NAND (nandptr)读取了

但是在u-boot的NanD_ReadBuf函数中又发送了一次NanD_Command (nand, NAND_CMD_READ0);
结果skyeye就认为命令发生了改变 然后就开始等待NanD_Address(nand, ADDR_COLUMN_PAGE了
可是u-boot在发送NanD_Command (nand, NAND_CMD_READ0);后就用READ_NAND (nandptr)读取数据
skyeye 就认为是没有发送地址然后就报错了.

猜测 skyeye不能同时处理2个指令 在发送NAND_CMD_READ0后前面的NAND_CMD_READOOB就被丢失了

开始想修改skyeye的nand代码 可以整体结构已经定了 感觉很难修改

现阶段找到的办法就是
修改 command/cmd_nand.c
中的NanD_ReadBuf函数
注释掉NanD_Command (nand, NAND_CMD_READ0);这一行
问题解决


重要的一点
用修改后的u-boot下载到开发板中, 经过检测没有任何问题的.




[ 本帖最后由 zbluecn 于 2008-2-26 12:39 编辑 ]
作者: ksh    时间: 2008-2-27 11:31     标题: 回复 #3 zbluecn 的帖子

That is really great job.  If you can run flash file system based on s3c2410 nand flash with linux kernel, that is more perfect.
作者: ksh    时间: 2008-2-27 11:32     标题: 回复 #4 albert198511 的帖子

nand flash simulation was added in skyeye-1.2.4. That means you have to use skyeye-1.2.4 to try LZ's instruction.
作者: zbluecn    时间: 2008-2-27 12:20

在Linux上挂机模拟的s3c2410 nand flash 是可以的啊~~ 已经启动起来了~~
按照普通开发板的去修改内核就可以了啊

[ 本帖最后由 zbluecn 于 2008-2-27 12:54 编辑 ]
作者: zbluecn    时间: 2008-2-29 21:51

8.
错误的
(I)修改board/smdk2410/Makefile
OBJS  := sky2410.o flash.o

正确的
(I)修改board/sky2410/Makefile
OBJS  := sky2410.o flash.o nand.o
作者: zbluecn    时间: 2008-3-3 15:02

board/smdk2410/nand_read.c

文件添加错误 嘻嘻

board/sky2410/nand_read.c
作者: ksh    时间: 2008-3-4 12:23

in http://skyeye.svn.sourceforge.ne ... ce/nandflash/tools/
, and use your native gcc to build it and use it.
作者: zbluecn    时间: 2008-3-9 10:50

tftp 是从TFTP服务器上下载内核镜像
flash 是另外Nor 的虚拟 没有关系的
我们用的nand 虚拟
作者: zbluecn    时间: 2008-3-9 10:52

分清楚 nor 和 nand的区别~~
在自己的机子上做一个tftp server

建议看看 linux 的启动顺序
还有关于s3c2410的启动过程
作者: albert198511    时间: 2008-3-24 13:03     标题: 出现段错误。。。 晕

执行skyeye -c u-boot.conf之后的显示如下:

[attach]30604[/attach]
[attach]30605[/attach]
[attach]30606[/attach]
[attach]30607[/attach]

不小心执行了两遍bootm。。。 不过执行一遍的时候也是这个错误

u-boot.conf内容如下:

[attach]30608[/attach]

是访问内存出错了吗?请高手指点!!

[ 本帖最后由 albert198511 于 2008-3-24 16:40 编辑 ]
作者: albert198511    时间: 2008-3-25 13:51

我把u-boot.conf中的“dbct:state=on”注释之后,程序执行到:
Uncompressing Linux................................................................. done, booting the kernel.
死机。

还请高手指教啊!!!
作者: albert198511    时间: 2008-3-25 14:19     标题: 内核配置

内核是2.6.14.1的,按照LZ:
http://blog.csdn.net/zblue78/archive/2008/02/20/2109827.aspx
的帖子中进行的配置,最后执行make uImage,将uImage上传至tftp中,然后载入,是内核配置的问题吗?
作者: crook    时间: 2008-4-9 23:42     标题: 问题

看楼主的贴图,发现在启动过程中 有 Loaded RAM   ./initrd.img

但是在skyeye.conf 中并没有initrd.img,是什么原因?
作者: albert198511    时间: 2008-4-12 22:03

启动信息如下:

[root@localhost u-boot-1.1.4]# skyeye -c u-boot.conf

**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************

big_endian is false.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x808131c
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
nandflash: dump ./nand.dump
file size:69206016
dbct info: turn on dbct!
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM   ./u-boot.bin
Loaded RAM   ./initrd.img

dbct translate block use memory 0x03ffff03 bytes.
ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffff
ERROR: s3c2410x_io_write_word(0x4c00000 = 0x00048032


U-Boot 1.1.4 (Mar 23 2008 - 18:47:45)

U-Boot code: 33F80000 -> 33F9BF0C  BSS: -> 33F9FFE4
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 512 kB
NAND:  64 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
SMDK2410 # tftp 0x33000000 uImage
TFTP from server 10.0.0.1; our IP address is 10.0.0.110
Filename 'uImage'.
Load address: 0x33000000
Loading: #################################################################
         #################################################################
         #################################################################
         ####
done
Bytes transferred = 1015092 (f7d34 hex)
SMDK2410 # nand erase 30000 F8000

NAND erase: device 0 offset 196608, size 1015808 ... OK
SMDK2410 # nand write 33000000 30000 f7d34

NAND write: device 0 offset 196608, size 1015092 ...  1015092 bytes written: OK
SMDK2410 # [root@localhost u-boot-1.1.4]# skyeye -c u-boot.conf

**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************

big_endian is false.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x808131c
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
nandflash: dump ./nand.dump
file size:69206016
dbct info: turn on dbct!
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM   ./u-boot.bin
Loaded RAM   ./initrd.img
dbct translate block use memory 0x03ffff03 bytes.
ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffff
ERROR: s3c2410x_io_write_word(0x4c00000 = 0x00048032


U-Boot 1.1.4 (Mar 23 2008 - 18:47:45)

U-Boot code: 33F80000 -> 33F9BF0C  BSS: -> 33F9FFE4
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 512 kB
NAND:  64 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
SMDK2410 # nand read 33000000 30000 f7d34

NAND read: device 0 offset 196608, size 1015092 ...  1015092 bytes read: OK
SMDK2410 # bootm
## Booting image at 33000000 ...
   Image Name:   Linux-2.6.14
   Created:      2008-04-12  13:42:43 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1015028 Bytes = 991.2 kB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux.................................................................... done, booting the kernel.
Linux version 2.6.14 (root@localhost.localdomain) (gcc version 3.4.1) #6 Sat Apr 12 21:42:34 CST 2008
CPU: ARM920Tid(wb) [41009200] revision 0 (ARMvundefined/unknown)
Machine: SMDK2410
Warning: bad configuration page, trying to continue
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410 (id 0x32410000)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C2410 Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: noinitrd console=ttySAC0 root=/dev/mtdblock2 rootfstype=yaffs init=/linuxrc devfs=mount ramdisk_size=2048 rw
irq: clearing pending status 00004000
irq: clearing pending status 00008000
irq: clearing pending status 00800000
irq: clearing pending status 10000000
irq: clearing subpending status 00000093
PID hash table entries: 128 (order: 7, 2048 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
Console: colour dummy device 80x30
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 16MB = 16MB total
Memory: 13996KB available (1689K code, 379K data, 96K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
softlockup thread 0 started up.
NET: Registered protocol family 16
S3C2410: Initialising architecture
S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics
DMA channel 0 at c1800000, irq 33
DMA channel 1 at c1800040, irq 34
DMA channel 2 at c1800080, irq 35
DMA channel 3 at c18000c0, irq 36
NetWinder Floating Point Emulator V0.97 (double precision)
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
Console: switching to colour frame buffer device 80x25
fb0: Virtual frame buffer device, using 1024K of video memory
S3C2410 RTC, (c) 2004 Simtec Electronics
s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 2048K size 1024 blocksize
loop: loaded (max 8 devices)
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
Cirrus Logic CS8900A driver for Linux (Modified for SMDK2410)
eth0: CS8900A rev D at 0xe0000300 irq=53, no eeprom , addr: 08: 0:3E:26:0A:5B
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand: mapped registers at c1980000
s3c2410-nand: timing: Tacls 10ns, Twrph0 30ns, Twrph1 10ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00100000 : "bootloader"
0x00100000-0x00400000 : "kernel"
0x00400000-0x02c00000 : "root"
0x02d00000-0x03c00000 : "user"
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP route cache hash table entries: 256 (order: -2, 1024 bytes)
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
VFS: Cannot open root device "mtdblock2" or unknown-block(31,2)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[root@localhost u-boot-1.1.4]#
作者: albert198511    时间: 2008-4-12 22:05     标题: 续问。。。

Default kernel command string为:

noinitrd console=ttySAC0 root=/dev/mtdblock2 rootfstype=yaffs init=/linuxrc devfs=mount ramdisk_size=2048 rw

u-boot.conf内容为:

# skyeye config file for S3C2410X
cpu: arm920t
mach: s3c2410x
# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000, file=./u-boot.bin ,boot=yes
mem_bank: map=M, type=RW, addr=0xc0800000, size=0x00800000, file=./initrd.img----地址不是很确定
mem_bank: map=M, type=RW, addr=0x30000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0x30800000, size=0x00800000
mem_bank: map=M, type=RW, addr=0x31000000, size=0x03000000

# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1
nandflash: type=s3c2410x,name=K9F1208U0B,dump=./nand.dump
#lcd:type=s3c2410x, mod=gtk
dbct:state=on
~

[root@localhost u-boot-1.1.4]# vi /usr/src/kernels/linux-2.6.14/arch/arm/mach-s3c2410/devs.c
/*1.建立Nand Flash分区表*/
/* 一个Nand Flash总共64MB, 按如下大小进行分区 */
/*
name: 代表分区名字
size: 代表flash分区大小(单位:字节)
offset: 代表flash分区的起始地址(相对于0x0的偏移)
*/
static struct mtd_partition partition_info[] = {
    { /* 1MB */
        name: "bootloader",
        size: 0x00100000,
        offset: 0x0,
    },
    { /* 3MB */
        name: "kernel",
        size: 0x00300000,
        offset: 0x00100000,
    },
    { /* 40MB */
        name: "root",
        size: 0x02800000,
        offset: 0x00400000,
    },
    { /* 20MB */
        name: "user",
        size: 0x00f00000,
        offset: 0x02d00000,
    }
};

内核配置是按照LZ的“http://blog.csdn.net/zblue78/archive/2008/02/20/2109827.aspx”中配置的

恳请大侠帮忙啊!!!

作者: crook    时间: 2008-4-13 22:31     标题: Default kernel command string

noinitrd console=ttySAC0 root=/dev/mtdblock2 init=/linuxrc ramdisk_size=2048 rw
这个试过了吗?
作者: albert198511    时间: 2008-4-14 00:10     标题: 回复 #18 crook 的帖子

NET: Registered protocol family 1
Reading data from NAND FLASH without ECC is not recommended
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
作者: wujiangke    时间: 2008-4-29 00:09

这样的文章很稀有
珍惜啊
作者: shinety53    时间: 2008-4-30 21:18     标题: 我怎么作不出来啊 我的那里出了问题呢?

先赞一个  
我按lz说的方法去作了,可是在没有添加nand部分时执行的还好,即第7步之前正常。
但做到第10步的时候就不行了呢,
结果是
:~/arm/rom3$ ls
nand.dump  skyeye.conf  skyeye.conf~  u-boot  u-boot.bin
:~/arm/rom3$ sudo skyeye

**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************

big_endian is false.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x805f420
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
failed to setup_module (name:net, type:cs8900a)
nandflash: dump ./nand.dump
tapif_init: icotl TUNSETIFF errorfile size:69206016
dbct info: Note: DBCT not compiled in. This option will be ignored
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM   ./u-boot.bin




到这里就进行不下去了。这是为什么阿 ,其他的和你做的一样,SKYEYE。CONF也是一样的。
这样执行也不行
shinety@shinety:~/arm/rom3$ sudo skyeye

**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************

big_endian is false.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x805f420
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
failed to setup_module (name:net, type:cs8900a)
nandflash: dump ./nand.dump
tapif_init: icotl TUNSETIFF errorfile size:69206016
dbct info: Note: DBCT not compiled in. This option will be ignored
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM   ./u-boot.bin

[12]+  Stopped                 sudo skyeye
shinety@shinety:~/arm/rom3$ sudo skyeye -e u-boot
big_endian is false.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x805f420
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
failed to setup_module (name:net, type:cs8900a)
nandflash: dump ./nand.dump
tapif_init: icotl TUNSETIFF errorfile size:69206016
dbct info: Note: DBCT not compiled in. This option will be ignored
uart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
Loaded RAM   ./u-boot.bin
start addr is set to 0x33f80000 by exec file.
SKYEYE:NumInstrs 26021, mem_write_byte addr = 3400006d no bank


我在想是不是地址有问题。lz觉得我这边有什么不对的阿?

[ 本帖最后由 shinety53 于 2008-4-30 21:41 编辑 ]
作者: lwb12915    时间: 2008-6-26 14:16

r看看,做实验,发现很多问题!
作者: lwb12915    时间: 2008-6-26 14:55

引用:
原帖由 shinety53 于 2008-4-30 21:18 发表
先赞一个  
我按lz说的方法去作了,可是在没有添加nand部分时执行的还好,即第7步之前正常。
但做到第10步的时候就不行了呢,
结果是
:~/arm/rom3$ ls
nand.dump  skyeye.conf  skyeye.conf~  u-boot  u-b ...
用skyeye 提供的mknandflashdump程序将 我们的u-boot.bin文件镜像到nand.dump 文件中

mknandflashdump u-boot.bin nand.dump 0

没有做这个?
作者: Canbus    时间: 2008-6-26 17:26

请问楼主是怎么用skyeye就跟踪代码的。给个详细点步骤好吗?谢谢!!
作者: liudows    时间: 2008-11-13 18:52

lz的conf如下,有几点不懂想请教:

# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000,
file=./u-boot.bin ,boot=yes
请问这里指定的是nand flash吗?
如果是nor flash,怎么指定是从nand flash启动的呢?
如果是nand flash的话,2410中nand flash实际上不是连接到memory bank上的,为什么要这样指定?


我想仿照您的方法在skyeye for 2410中启动vivi,但是没有成功,故有以上疑惑。望指教,谢谢!
作者: crook    时间: 2008-11-14 09:15

想s3c2410这样的芯片之所以可以在NAND上启动,是由于s3c2410有一个叫做stepping stone的内置SRAM,将loader代码烧在NAND上,加电后,该芯片可以自动将NAND的起始4k的内容拷贝到SRAM里,然后在RAM里执行。
作者: deniel1212    时间: 2009-4-17 15:08

修改 command/cmd_nand.c
中的NanD_ReadBuf函数
注释掉NanD_Command (nand, NAND_CMD_READ0);这一行
俺的是u-boot1.2.0竟然没有这个函数,自己弄了好久,不知该怎么改。




欢迎光临 中国Linux公社论坛 (http://www.linuxfans.org/bbs/) Powered by Discuz! 6.1.0