中国Linux公社论坛's Archiver

jameslux 发表于 2005-12-12 08:45

uclinux上建立jffs2遇到的问题(uclinux启动

:roll:

我使用4510b + SST39V160(接nCRS0)
bootloader用的是lumit提供的1.0.0 (www.lumit.org)

在linux-2.4.x\drivers\mtd\maps目录中建了一个s3c4510b.c,相关信息如下:

......
#define WINDOW_ADDR 0x01000000 | 0x04000000  // 不知这个地址有没有问题
#define WINDOW_SIZE 0x200000
#define BUSWIDTH 2
.......

/*
* MTD 'PARTITIONING' STUFF
*/
//分区信息
static struct mtd_partition s3c4510b_partitions[] = {
        {
                name: "BOOTLOADER (32K)",
                size: 0x8000,
                offset: 0x00000,
  mask_flags: MTD_WRITEABLE
        },
        {
                name: "KERNEL (1024K)",
                size: 0x100000,
                offset: 0x8000
        },
{
                name: "USER (992K)",
                size: 0xF8000,
                offset: 0x108000
        }
};


在/mtd/chips/jedec_probe.c中添加设备信息
{
  mfr_id: MANUFACTURER_SST,
  dev_id: SST39LF160,
  name: "SST 39LF/VF160",
  DevSize: SIZE_2MiB,
  //CmdSet: P_ID_AMD_STD,
  NumEraseRegions: 1,
    /* Split into two regions to get around the 256-region restriction */
  regions: {ERASEINFO(0x10000,32)
  }
  }

在linux-2.4.x/include/linux/mtd/mtd.h中修改了:

#define MTD_BLOCK_MAJOR 30

在vendors/Samsung/4510B/Makefiel中添加
DEVICES = \
tty,c,5,0 console,c,5,1 cua0,c,5,64 cua1,c,5,65 \
mtd0,c,90,0 mtd1,c,90,1 mtd2,c,90,2 \
mtdblock0,b,30,0 mtdblock1,b,30,1 mtdblock2,b,30,2 \
mem,c,1,1 kmem,c,1,2 null,c,1,3 \
zero,c,1,5 random,c,1,8 urandom,c,1,9  \


修改内核配置,内容如下:
# Memory Technology Devices (MTD)
CONFIG_MTD=y
CONFIG_MTD_DEBUG=y
CONFIG_MTD_DEBUG_VERBOSE=3
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_CONCAT is not set
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_CMDLINE_PARTS is not set
# CONFIG_MTD_BOOTLDR_PARTS is not set
# CONFIG_MTD_AFS_PARTS is not set
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_GEN_PROBE=y
# CONFIG_MTD_CFI_ADV_OPTIONS is not set
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CFI_AMDSTD=y
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set
# CONFIG_MTD_OBSOLETE_CHIPS is not set
# CONFIG_MTD_AMDSTD is not set
# CONFIG_MTD_SHARP is not set
# CONFIG_MTD_JEDEC is not set
# CONFIG_MTD_PHYSMAP is not set
# CONFIG_MTD_UCLINUX is not set
# CONFIG_MTD_DRAGONIX is not set
# CONFIG_MTD_NETtel is not set
# CONFIG_MTD_SNAPGEODE is not set
# CONFIG_MTD_NETteluC is not set
# CONFIG_MTD_KeyTechnology is not set
# CONFIG_MTD_NORA is not set
# CONFIG_MTD_ARM_INTEGRATOR is not set
# CONFIG_MTD_CDB89712 is not set
# CONFIG_MTD_SA1100 is not set
# CONFIG_MTD_DC21285 is not set
# CONFIG_MTD_IQ80310 is not set
# CONFIG_MTD_EPXA10DB is not set
# CONFIG_MTD_AUTCPU12 is not set
# CONFIG_MTD_IXP425 is not set
CONFIG_MTD_S3C4510B=y
# CONFIG_MTD_PCI is not set
# Self-contained MTD device drivers
# CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_MTDRAM is not set
# CONFIG_MTD_BLKMTD is not set
# CONFIG_MTD_DOC1000 is not set
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOCPROBE is not set
# CONFIG_MTD_NAND is not set
还有文件系统什么的配置信息这里没有写出来

但是启动后发现:

Linux version 2.4.20-uc0 (root@localhost.localdomain) (gcc v5Processor: Samsung S3C4510B revision 6
Architecture: SNDS100
On node 0 totalpages: 4096
zone(0): 0 pages.
zone(1): 4096 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/rom0
Calibrating delay loop... 49.76 BogoMIPS
Memory: 16MB = 16MB total
Memory: 14148KB available (1800K code, 173K data, 40K init)
Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)
Inode cache hash table entries: 1024 (order: 1, 8192 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 4096 (order: 2, 16384 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
Samsung S3C4510 Serial driver version 0.9 (2001-12-27) with no serial options edttyS00 at 0x3ffd000 (irq = 5) is a S3C4510B
ttyS01 at 0x3ffe000 (irq = 7) is a S3C4510B
Blkmem copyright 1998,1999 D. Jeff Dionne
Blkmem copyright 1998 Kenneth Albanowski
Blkmem 1 disk images:
0: E3C50-1D404F [VIRTUAL E3C50-1D404F] (RO)
RAMDISK driver initialized: 16 RAM disks of 1024K size 1024 blocksize
Samsung S3C4510 Ethernet driver version 0.1 (2002-02-20) <mac@os.nctu.edu.tw>
eth0: 00:40:95:36:35:34
//***************下面有问题
[b]s3c4510b flash device: 200000 at 5000000
CFI: Found no S3C4510B flash device device at location zero
init_mtdchar: allocated major number 90.
init_mtdblock: allocated major number 30.[/b]
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 1024 bind 1024)
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 40K
Shell invoked to run file: /etc/rc
Command: hostname Samsung
Command: /bin/expand /etc/ramfs.img /dev/ram0
Command: /bin/expand /etc/ramfs2048.img /dev/ram1
Command: mount -t proc proc /proc
Command: mount -t ext2 /dev/ram0 /var
Command: mount -t ext2 /dev/ram1 /ramdisk
Command: chmod 777 /ramdisk
Command: mkdir /var/config
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.255.255.0 lo
Command: ifconfig eth0 192.168.168.101 netmask 255.255.255.0 up
Command: cat /etc/motd
Welcome to
          ____ _  _
         /  __| ||_|
    _   _| |  | | _ ____  _   _  _  _
   | | | | |  | || |  _ \| | | |\ \/ /
   | |_| | |__| || | | | | |_| |/    \
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|
                                                                                
For further information check:
http://www.uclinux.org/
                                                                                
Command: /bin/sh
                                                                                
Sash command shell (version 1.1.1)
/> Reading command line: Bad file descriptor
pid 19: failed 256
Execution Finished, Exiting
init: Booting to single user mode
                                                                                
Sash command shell (version 1.1.1)
/>


后来在ftp://ftp.uk.linux.org/pub/people/dwmw2/mtd/cvs/mtd/mtd-jffs-HOWTO.txt中发现了下面的话

Don't be fooled by the message:
"physmap flash device:xxxxx at yyyyyyy"

This is just reporting what parameters you have compiled into the
system (see above under "Physical mapping of flash chips".

If your flash is really detected then it will print something like:
"Physically mapped flash: Found bla-bla-bla at location 0".

If no device is found, then physmap will refuse to load as a module!
This is not a problem with compiling it as a module or with physmap or
modprobe itself. Unfortunately this is the hard part. You have to dive
into the routine "do_cfi_probe()" called from physmap.c.

Caution! physmap.c uses ioremap() to map the physical memory into an
area of logical memory. If your processor has a cache in it, then
modify physmem to use ioremap_nocache(), else you will tear your hair
out as your flash chips will never be detected.

This routine is called cfi_probe() and is in the file "cfi_probe.c"
under mtd/kernel/

我还在一篇文章里看到这样一句话
#define WINDOW_ADDR 0x01000000 | 0x04000000  //注意Flash分区地址必须是non-cacheble

各位大虾,这是怎么回事啊?谢谢了!

rootlinger 发表于 2005-12-15 08:40

我也碰到同样的问题,希望高手指点,呵。。 :-D

limingth 发表于 2005-12-16 12:31

关于在 lumit4510 上建立 jffs2 文件系统,CoryXie 网友已经基于 linux-2.6.x 上实现了,可以先尝试一下把他移植的内核和文件系统跑起来试试。  8)

yuhw 发表于 2006-2-21 18:48

我也在做jffs,希望一起交流。qq:68333957

页: [1]

Powered by Discuz! Archiver 6.1.0F  © 2001-2007 Comsenz Inc.