ltib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ltib] JFFS2 Implementation using Ltib


From: aaron
Subject: Re: [Ltib] JFFS2 Implementation using Ltib
Date: Wed, 8 Apr 2009 10:07:09 -0500 (CDT)
User-agent: SquirrelMail/1.4.16

You need to find the name of your physically mapped flash so that you can
pass the correct command line string to the kernel.  Unfortunately it's
not in your kernel printout as it is in mine, but it should have a name
nonetheless.  Mine is set in the file "drivers/mtd/maps/physmap.c".

There is a struct in this file

struct map_info physmap_map = {
        .name = "phys_mapped_flash",
        .phys = CONFIG_MTD_PHYSMAP_START,
        .size = CONFIG_MTD_PHYSMAP_LEN,
        .bankwidth = CONFIG_MTD_PHYSMAP_BANKWIDTH,
};

So, you just need to dig through your kernel code to find out what your
physically mapped flash is called.  A little bit below that, in the same
source file, in the function init_physmap, there is some code

#ifdef CONFIG_MTD_PARTITIONS
                mtd_parts_nb = parse_mtd_partitions(mymtd, part_probes,
                                                    &mtd_parts, 0);

That's where it's parsing the values you pass on the command line from
U-Boot to the kernel.  If you're going to put a printk somewhere to try to
find the name of your device, that would be a good spot.  You'll need to
dig around the 2.4 source because I don't have it in front of me.

I made a little mistake in my reply to you yesterday.  My kernel command
line is set like this:

rootfstype=jffs2 rw root=/dev/mtdblock1
mtdparts=phys_mapped_flash:2m(hrcw/kernel)ro,address@hidden(rootfs),address@hidden(spare),address@hidden(uboot)ro

The syntax of this is described in the file "drivers/mtd/cmdlinepart.c",
but it's basically address@hidden(partition name)(rw/ro).

As a result, I get kernel printouts at boot like:

4 cmdlinepart partitions found on MTD device phys_mapped_flash
Creating 4 MTD partitions on "phys_mapped_flash":
0x00000000-0x00200000 : "hrcw/kernel"
0x00200000-0x00800000 : "rootfs"
0x00800000-0x03f00000 : "spare"
0x03f00000-0x04000000 : "uboot"

And the mtd file contains:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00020000 "hrcw/kernel"
mtd1: 00600000 00020000 "rootfs"
mtd2: 03700000 00020000 "spare"
mtd3: 00100000 00020000 "uboot"

Once you can find the name of your physically mapped flash device you can
correctly set the mtdparts command line variable with the name of your
device and any partitioning information you want to pass to it.

Another thing I would check is if your erase block size is correct.  I
don't know if you have support in U-Boot for your flash, but if you do you
can use the command flinfo to show you what your flash looks like.  I put
some printouts from my U-Boot below, and dots where I skipped output.

----

U-Boot 1.2.0 (Apr  1 2009 - 14:39:54)
...
FLASH: 64 MB
...
=> flinfo

Bank # 1: CFI conformant FLASH (16 x 16)  Size: 64 MB in 512 Sectors
  AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x7E2301
  Erase timeout: 16384 ms, write timeout: 2 ms
  Buffer write timeout: 5 ms, buffer size: 32 bytes

  Sector Start Addresses:
  FC000000        FC020000        FC040000        FC060000        FC080000
...
  FFE80000        FFEA0000        FFEC0000        FFEE0000        FFF00000
  RO
  FFF20000   RO   FFF40000   RO   FFF60000   RO   FFF80000        FFFA0000
  FFFC0000        FFFE0000
=>

----

I can get my erase block size by subtracting any sequential block
addresses (FFEC0000 - FFEA0000 = 20000), or by looking at the
documentation from the manufacturer.  You need to set this value correctly
in the kernel code, either with a menuconfig option, or in the kernel
code.  It looks like your erase block size is set to 40000, so I would
check that as well.

> Dear Aaron,
>
>        Thanks for your prompt reply.
>
>      You said to enable support in the kernel, device drivers for mtd
> mappings as follows,This implimentation is done and I get the following
> message when I do
> #cat /proc/mtd upon kernel bootup
> dev:    size   erasesize  name
> mtd0: 02000000 00040000 "Physically mapped flash"
>
> But I don't get phys_mapped_flash: Found 1 x16 devices at 0x0 in 16-bit
> bank
> in my Kernel Bootup
> I have also attached the kernel boot message for your reference
>
>
> Any ways thanks a lot.Or Is there any documentation available with you
> related for this kind of implimentation.
>
>
>
>
>
>
>>
>> In my menuconfig, that's device drivers -> mtd -> RAM/ROM/Flash chip
>> drivers -> Support for AMD/Fujitsu flash chips.  I also have Detect
>> flash
>> chips by Common Flash Interface (CFI) probe checked.
>>
>> Then you'll probably have to enable support to map the memory of your
>> flash chip to physical memory.
>>
>> device drivers -> mtd -> Mapping drivers for chip access -> CFI Flash
>> device in physical memory map.  In my system, my flash is physically
>> mapped to 0xfc000000, which is the value I have in Physical start
>> address
>> of flash mapping, and is 64 MB in size, so I put 0x4000000 in Physical
>> length of flash mapping, and 2 for Bank width in octets.  If you have
>> the
>> correct setup for this stuff, then you should see appropriate messages
>> in
>> your kernel printout when you boot.
>>
>> My kernel says:
>>
>> physmap flash device: 4000000 at fc000000
>> phys_mapped_flash: Found 1 x16 devices at 0x0 in 16-bit bank
>>  Amd/Fujitsu Extended Query Table at 0x0040
>> phys_mapped_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.
>>
>> Note the name of my device, phys_mapped_flash.
>>
>> Also in menuconfig, if you want to do command line partitioning (from
>> U-Boot to the kernel) you'll need device drivers -> mtd -> MTD
>> partitioning support (and) -> Command line partition table parsing.  I
>> also have Direct char device access to MTD devices and Caching block
>> device access to MTD devices checked.  This enables me to create
>> partitions on the phys_mapped_flash device, and mount them as jffs2 file
>> systems.  You'll need support for jffs2 file systems compiled into your
>> kernel as well.  As far as I know, you don't need to do anything in
>> U-Boot
>> for what you want to do other than pass the appropriate command line
>> arguments to the kernel.  In my case, I set the bootargs variable as
>> such:
>>
>> setenv bootargs root=/dev/mtdblock1
>> mtdparts=phys_mapped_flash:2m(hrcw/kernel)ro,address@hidden(rootfs),address@hidden
>> (uboot)ro
>> rootfstype=jffs2 rw
>>
>> I worked with another kernel earlier, 2.6.12, where the bootargs were
>> set
>> to:
>>
>> setenv bootargs root=/dev/mtdblock1 ro mtdparts=phys:2M(ROM)ro,-(root)
>> rootfstype=jffs2
>>
>> It depends what your kernel is naming your flash mapped to physical
>> memory, either phys_mapped_flash, or phys in these cases.  You partition
>> your flash any way you want with the appropriate start locations and
>> sizes.  Refer to drivers/mtd/cmdlinepart.c for more details.
>>
>> If successful, you'll see kernel printouts on boot similar to these that
>> I
>> get:
>>
>> 4 cmdlinepart partitions found on MTD device phys_mapped_flash
>> Creating 4 MTD partitions on "phys_mapped_flash":
>> 0x00000000-0x00200000 : "hrcw/kernel"
>> 0x00200000-0x00800000 : "rootfs"
>> 0x00800000-0x03f00000 : "spare"
>> 0x03f00000-0x04000000 : "uboot"
>>
>> You'll have to translate this into 2.4 kernel options.  Afterwards,
>> you'll
>> be able to mount your flash with something like:
>>
>> mount -t jffs2 -o rw /dev/mtdblock4 /mnt/flash
>>
>> If it's the first time you've mounted this partition, it could take a
>> while, as it seems like the kernel has to format and initialize the
>> jffs2
>> file system, like doing a mkfs.jffs2 /dev/mtdblock4.
>>
>> > Dear All,
>> >    I am working on EP885 Development board with ltib deployed on Open
>> Suse
>> > 10.2
>> > and also on Red Hat 7.3.The iso image for board BSP was provided by
>> > Freescale
>> > in the CD by the name ep88x_ltib.iso.It works fine.But currently I am
>> > stucj
>> > up with the implementaion of Jffs2 on the Board.I will be grateful to
>> you
>> > if
>> > any help is provided in this respect.
>> > My Board Specifications are:
>> >      CPU:    MPC885
>> >      Flash:    32MB
>> >      SDRAM:    64MB     AM29LV640B
>> >      U-Boot :    1.1.3
>> >      Kernel:    Linux-2.4.22
>> >
>> > Now I want to partition the flash as follows
>> >
>> > ______________________ 0xFC000000-0xFC03FFFF
>> > |                                     |
>> > |  Bootloader (256K)         |
>> > |_____________________|0xFC040000-0xFC07FFFF
>> > |Bootloader Env Variab     |
>> > |   (256K)                        |
>> > |_____________________|0xFC100000-0xFC19FFFF
>> > |                                     |
>> > |Kernel Image                  |
>> > |_____________________|0xFD000000-0xFDF7FFFF
>> > |                                     |
>> > |rootfs.ext2.gz.uboot        |->(Ram disk Image)
>> > |_____________________|0xFDF80000-0xFDFFFFFF
>> > |                                     |
>> > |  Jffs2 File System          |->>This is required for
>> > |                                     | configuration related para-
>> > |_____________________| meters  which should
>> >                                        be R/W e.g: /etc
>> >
>> > I searched a lot but didn't get something relevant to this kind of
>> > deployment
>> > Can anyone clear me some doubts as follows:
>> > 1>Is Mtd partition necessary to be implemented in U-boot?
>> > 2>How The implimentation will be done?
>> > 3>If I need to add something, then where it is to be done?
>> > 4> Is there any documentation for similar kind of scenario?
>> >
>> > Hoping to hear from you soon.
>> > Thanking you in anticipation.
>> >
>> > BR,
>> > Sagar Kadam,
>> > Cygnusmicro Systems,
>> > Hyderabad-51
>> >
>> >
>> >
>> >
>> >
>> > --
>> > BR,
>> > Sagar Kadam
>> >
>> >
>> >
>> > Happiness keeps you Sweet,
>> > Trials keep you Strong,
>> > Sorrows keep you Human,
>> > Failures keep you humble,
>> > Success keeps You Glowing,
>> > but Only God keeps You Going
>> > _______________________________________________
>> > LTIB home page: http://bitshrine.org
>> >
>> > Ltib mailing list
>> > address@hidden
>> > http://lists.nongnu.org/mailman/listinfo/ltib
>> >
>>
>>
>>
>
>
> --
> BR,
> Sagar Kadam
>
>
>
> Happiness keeps you Sweet,
> Trials keep you Strong,
> Sorrows keep you Human,
> Failures keep you humble,
> Success keeps You Glowing,
> but Only God keeps You Going
>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]