2011-07-04 07:23:37     spi flash mtdblock confusion

Document created by Aaronwu Employee on Sep 25, 2013
Version 1Show Document
  • View in full screen mode

2011-07-04 07:23:37     spi flash mtdblock confusion

Henning Hörentrup (GERMANY)

Message: 102074   

 

Hello,

 

 

 

I'm confused with the u-boot variable Config_Bootargs_Root in bfin_adi_common.h.

 

 

 

I set up the spi-flash in /trunk/linux-2.6.x/arch/blackfin/mach-bf537/boards/stamp.c as follows:

 

 

 

if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)

 

static struct mtd_partition bfin_spi_flash_partitions[] = {

    {

        .name = "bootloader(spi)",

        .size = 0x80000,

        .offset = 0,

        .mask_flags = MTD_CAP_ROM,

    }, {

        .name = "persistent files(spi)",

        .size = 0x80000,

        .offset = MTDPART_OFS_APPEND,

      

    }, {

        .name = "config files(spi)",

        .size = 0x80000,

        .offset = MTDPART_OFS_APPEND,

            },

 

        {

        .name = "file system(spi)",

        .size = MTDPART_SIZ_FULL,

        .offset = MTDPART_OFS_APPEND,     

    }

};

 

 

 

While booting the kernel (uImage.ext2), everything seems fine regarding the spi-flash

 

 

 

m25p80 spi0.1: found s25sl12801, expected m25p80

m25p80 spi0.1: s25sl12801 (16384 Kbytes)

Creating 4 MTD partitions on "m25p80":

0x000000000000-0x000000080000 : "bootloader(spi)"

0x000000080000-0x000000100000 : "persistent files(spi)"

0x000000100000-0x000000180000 : "config files(spi)"

0x000000180000-0x000001000000 : "file system(spi)"

 

 

but if I try to mount my rootfs the kernel panics

 

Kernel panic - not syncing: VFS: Unable to mount root fs

 

 

 

Because of that, I changed the CONFIG_BOOTARGS_ROOT variable from

 

# define CONFIG_BOOTARGS_ROOT "/dev/mtdblock4(3) rw"

 

to

 

# define CONFIG_BOOTARGS_ROOT "/dev/mtdblock0 rw"

 

and everything works fine.

 

 

 

NET: Registered protocol family 17

VFS: Mounted root (ext2 filesystem) on device 31:0.

Freeing unused kernel memory: 128k freed

probing persistent memory

mounted persistent memory

Network setup

                           _____________________________________

        a8888b.           / Welcome to the uClinux distribution \

       d888888b.         /       _     _                         \

       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |

       8|o||o|88  _____/        | |    _ ____  _   _ \ \/ /       |

       8'    .88       \        | |   | |  _ \| | | | \  /        |

       8`._.' Y8.       \       | |__ | | | | | |_| | /  \        |

      d/      `8b.       \      \____||_|_| |_|\____|/_/\_\       |

     dP   .    Y8b.       \   For embedded processors including   |

    d8:'  "  `::88b        \    the Analog Devices Blackfin      /

   d8"         'Y88b        \___________________________________/

  :8P    '      :888

   8a.   :     _a88P         For further information, check out:

._/"Yaa_:   .| 88P|            - http://blackfin.uclinux.org/

\    YP"    `| 8P  `.          - http://docs.blackfin.uclinux.org/

/     \.___.d|    .'           - http://www.uclinux.org/

`--..__)8888P`._.'  jgs/a:f    - http://www.analog.com/blackfin

 

Have a lot of fun...

 

 

 

 

And finally my question:

 

Why do I have to define the config_bootargs_root as

 

# define CONFIG_BOOTARGS_ROOT "/dev/mtdblock0 rw" ?

 

 

 

Thanks for you help

 

Henning

QuoteReplyEditDelete

 

 

2011-07-04 14:34:27     Re: spi flash mtdblock confusion

Mike Frysinger (UNITED STATES)

Message: 102079   

 

you probably forgot rootfstype=

 

please post the full bootlog output and review this document:

http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:jffs#booting_kernel-only_image_with_jffs2_root_file_system

QuoteReplyEditDelete

 

 

2011-07-05 04:20:39     Re: spi flash mtdblock confusion

Henning Hörentrup (GERMANY)

Message: 102123   

 

Hello Mike,

 

 

 

thanks for your help. The important hint was in the document:

 

 

 

If you want to boot a standard ramfs ext2 kernel/filesystem image, just reboot and interrupt the countdown of U-boot. Because such a kernel uses mtdblock0 instead of mtdblock2, the bootargs environment setting has to change.

 

 

 

I was wondering, why I was only able to mount the uImage.ext2 at mtdblock0 and not mtdblock3 or mtdblock4. Do you have any further information/documention why a standard ramfs ext2 kernel/filesystem image is restricted to mtdblock0? Just for my curiosity.

 

 

 

Henning

QuoteReplyEditDelete

 

 

2011-07-05 06:27:13     Re: spi flash mtdblock confusion

Aaron Wu (CHINA)

Message: 102127   

 

I don't think you are really mount from /dev/mtdblock0, you are very likey to mount from the INTRAMFS. To verify this you can disable the BLK_DEV_INITRD in kernel config and try if you can still mount the rootfs sucessfully. That document is talking about booting from any other rootfs other than the INITRAMFS.

QuoteReplyEditDelete

 

 

2011-07-05 06:41:48     Re: spi flash mtdblock confusion

Aaron Wu (CHINA)

Message: 102128   

 

When the initramfs is enabled, mounting the rootfs from bootargs "root = " will be skipped, for more information you may refer to the last few lines in kernel document: linux-2.6.x/Documentation/early-userspace/README and implementation of function "prepare_namespace" in kernel source code. First it will try initrd_load(), if success it will go to out directly, skipping the mount_root().

QuoteReplyEditDelete

 

 

2011-07-05 12:22:44     Re: spi flash mtdblock confusion

Mike Frysinger (UNITED STATES)

Message: 102139   

 

i dont believe the order is hard coded anywhere.  it's just the order in which things are initialized.

QuoteReplyEditDelete

 

 

2011-07-05 12:24:38     Re: spi flash mtdblock confusion

Mike Frysinger (UNITED STATES)

Message: 102140   

 

not entirely true ... once the initramfs exits, it'll continue on to mounting root=.  it's just that in the way we build the image for ADI, we never exit the initramfs.

Attachments

    Outcomes