ROOT file system from Flash

Andy Ngo ndno72-davinci at yahoo.com
Thu Mar 8 03:03:41 CST 2007


Hi Kishore,

I saw your posting last August and was wondering how you get the kernel to recognize the NOR flash 
as different partitions. I read a few documents recommended by T Ziomek on how to enable MTD JFFS2 in 
the kernel and did exactly as stated.  I followed the instructions exactly and modified 
linux-2.6.10_mvl401/drivers/mtd/maps/physmap.c to have several MTD partitions:


struct map_info physmap_map = {
    .name = "phys_mapped_flash",
    .phys = 0x02000000,
    .size = 0x01000000,
    .bankwidth = 2,
};


static struct mtd_partition *physmap_partitions[] = {
    {
        .name =        "Bootloader",
        .size =        0x00050000,
        .offset =    0
    },{
        .name =        "Kernel",
        .size =        0x00200000,
        .offset =    MTDPART_OFS_APPEND
    },{
        .name =        "RootFS",
        .size =        MTDPART_SIZ_FULL,
        .offset =    MTDPART_OFS_APPEND
    }
};

I enabled the following in the kernel:













CONFIG_MTD=y
CONFIG_MTD_DEBUG=y
CONFIG_MTD_DEBUG_VERBOSE=3
CONFIG_MTD_PARTITIONS=y
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_GEN_PROBE=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_START=0x02000000
CONFIG_MTD_PHYSMAP_LEN=0x01000000
CONFIG_MTD_PHYSMAP_BUSWIDTH=2
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=2
CONFIG_JFFS2_FS_WRITEBUFFER=y

After rebuilding the kernel and loading it, the kernel
tried to probe the NOR flash for the device ID to figure out 
what device it is but couldn't, the id is always 0000.  According
to the spec sheet, the NOR Flash is an AMD 29LV256M, so the device
ID should be 2201.  Because of this, it doesn't think there is a 
NOR flash device.  Maybe the ioremap function is not mapping the
physical address to the virtual address correctly?  It seems as though
the kernel can't detect the flash at all or is probing at wrong
address.

Anyways, it seems like you got pretty far along; can you please help
me?  Am I doing something wrong?  Your or anyone's else help is
appreciated.

Regards,
Andy
=================================================================================

			ROOT file system from Flash
			kishore sannapaneni

			Tue, 29 Aug 2006 03:05:29 -0700

		








HI

I want to mount root file system from flash. so i build the kernel with mtd 
map driver from the list.
wehn i boot the system i got the log messege as

             Physmaped_flash: Found 1 x16 devices at 0x0 in 16-bit bank
           Amd/Fujitsu Extended Query Table at 0x0040
          Using buffer write method
          Physmaped_flash: CFI does not contain boot bank location. 
Assuming top.
          number of CFI chips: 1
          cfi_cmdset_0002: Disabling erase-suspend-program due to code 
brokenness.
          0 partition parsing origin
          in else add-partitions
          Creating 4 MTD partitions on "Physmaped_flash":
          0x00000000-0x00040000 : "bootloader"
          mtd: Giving out device 0 to bootloader
          0x00040000-0x00050000 : "params"
          mtd: Giving out device 1 to params
         0x00050000-0x00250000 : "kernel"
         mtd: Giving out device 2 to kernel
         0x00250000-0x01000000 : "filesystem"
         mtd: Giving out device 3 to filesystem

I downloaded th MTD utilities  mtd-utils-1.0.0m  from 
http://www.linux-mtd.infradead.org/index.html.
Build th mkfs.jffs2 utility as
                                                 make mkfs.jffs2
then build the root fs image as
                                                mkfs.jffs2 -d root_folder 
-o rootfs_image.jffs2 -e 0x10000
Then i copied the root fs image to flash from u-boot to address     
0x02250000.
I supplied the boot arguments to kernel as
                    bootargs=console=ttyS0,115200n8 root=/dev/mtdblock3 rw 
noinitrd ip=dhcp  rootfstype=jffs2.
    when i boot the system i got the following error.

IP-Config: Complete:
     device=eth0, addr=10.1.11.166, mask=255.255.255.0, gw=10.1.11.76,
    host=10.1.11.166, domain=, nis-domain=(none),
    bootserver=10.1.11.76, rootserver=10.1.11.76, rootpath=
mtdblock_open
ok
mtdblock: read on "filesystem" at 0x400, size 0x200
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 5 [#1]
Modules linked in:
CPU: 0
PC is at __wake_up_common+0x28/0x7c
LR is at 0x0
pc : [<c0037248>]    lr : [<00000000>]    Not tainted
sp : c6e6be70  ip : c6e6be9c  fp : c6e6be98
r10: 00000006  r9 : 00000000  r8 : 00000000
r7 : c6e6a000  r6 : c0615a94  r5 : 60000013  r4 : 00000001
r3 : 00000000  r2 : 00000001  r1 : 00000006  r0 : c0615a94
Flags: nzcv  IRQs off  FIQs on  Mode SVC_32  Segment kernel
Control: 5317F  Table: 80004000  DAC: 00000017
Process mtdblockd (pid: 704, stack limit = 0xc6e6a198)
Stack: (0xc6e6be70 to 0xc6e6c000)
be60:                                     c6e6a000 60000013 c061fe28 
c6e6a000
be80: c0615a78 00000000 00000200 c6e6beb4 c6e6be9c c00372dc c0037230 
00000000
bea0: 00250400 c0615a40 c6e6bedc c6e6beb8 c01af500 c00372ac c0615a40 
00250400
bec0: c0615a40 00000000 c6e6a000 c061fe28 c6e6bf28 c6e6bee0 c01af91c 
c01af3ac
bee0: c0615a40 00250400 00250400 00000000 c0615a78 c0615a40 00000200 
60000013
bf00: c0619800 00000400 00000000 c6e6bf6c c6fa3400 00000400 00010000 
c6e6bf5c
bf20: c6e6bf2c c01a6f10 c01af6cc c6e6bf6c c6fa3400 c6e6bf40 c003bd78 
00000200
bf40: 00000400 c71ae3e0 c6fa3400 c0619000 c6e6bf98 c6e6bf60 c01ab1f8 
c01a6e74
bf60: c6e6bf6c c6fa3400 00000200 00000000 00000002 00000002 c6e6a000 
c6fa3400
bf80: c6e6122c c6e6f120 c02b253c c6e6bff4 c6e6bf9c c01ab93c c01ab114 
c6e6f130
bfa0: c061c8e0 00000000 c05eb300 c0037200 00000000 00000000 00000000 
c05eb300
bfc0: c0037200 00000000 00000000 00000000 00000000 00000000 00000000 
00000000
bfe0: 00000000 00000000 00000000 c6e6bff8 c003d63c c01ab700 1c002217 
40054e74
Backtrace:
[<c0037220>] (__wake_up_common+0x0/0x7c) from [<c00372dc>] 
(__wake_up+0x40/0x64)
[<c003729c>] (__wake_up+0x0/0x64) from [<c01af500>] (put_chip+0x164/0x16c)
[<c01af39c>] (put_chip+0x0/0x16c) from [<c01af91c>] 
(cfi_amdstd_read+0x260/0x2d0)
[<c01af6bc>] (cfi_amdstd_read+0x0/0x2d0) from [<c01a6f10>] 
(part_read+0xac/0xe0)
[<c01a6e64>] (part_read+0x0/0xe0) from [<c01ab1f8>] 
(mtdblock_readsect+0xf4/0x138)
[<c01ab104>] (mtdblock_readsect+0x0/0x138) from [<c01ab93c>] 
(mtd_blktrans_thread+0x24c/0x354)
[<c01ab6f0>] (mtd_blktrans_thread+0x0/0x354) from [<c003d63c>] 
(do_exit+0x0/0xdc0)
Code: e1a0a001 e1a04002 e1a08003 e59b9004 (e59e7000)
<6>note: mtdblockd[704] exited with preempt_count 2
BUG: scheduling while atomic: mtdblockd/0x00000002/704
caller is do_exit+0xd5c/0xdc0


i can't find the reason.
has any one done this. If so is this the correct way.

Thanking you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linux.omap.com/pipermail/davinci-linux-open-source/attachments/20070308/90bd785d/attachment-0001.htm


More information about the Davinci-linux-open-source mailing list