Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 06 Dec 2007 01:37 PM by  mcelweep@msoe.edu
Mounting the yaffs filesystem created by Lolo on the M5329
 8 Replies
Sort:
You are not authorized to post a reply.
Author Messages
mcelweep@msoe.edu
New Member
New Member
Posts:


--
15 Aug 2007 07:59 AM
    Hello all,

    New issues I have run into. I have compiled in the YAFFS2 support into my uclinux kernel (version 2.6.17) and I wanted to mount the partition that Lolo made on the flash. I attempted to mount it and I got these lovely messages:

    # mount -t yaffs /dev/mtdblock1 /tmp
    yaffs: dev is 32505857 name is "mtdblock1"
    yaffs: passed flags ""
    yaffs: Attempting MTD mount on 31.1, "mtdblock1"
    yaffs_ObjectHeader should be 512 but is 510

    yaffs_CheckStructures failed

    mount: Mounting /dev/mtdblock1 on /tmp failed: Invalid argument
    # mount -t yaffs2 /dev/mtdblock1 /tmp
    yaffs: dev is 32505857 name is "mtdblock1"
    yaffs: passed flags ""
    yaffs: Attempting MTD mount on 31.1, "mtdblock1"
    yaffs: MTD device does not have the right page sizes
    mount: Mounting /dev/mtdblock1 on /tmp failed: Invalid argument


    I am pretty sure the nand flash is at mtdblock1 because that is the device I used to mount it with jffs2, but I have decided against using jffs2 because it randomly got corrupted and yaffs is already being used by Lolo. Are there any special gotchas about mounting the yaffs partition that Lolo makes?
    ashwinb@logicpd.com
    New Member
    New Member
    Posts:


    --
    15 Aug 2007 08:33 AM
    If you do "cat /proc/mtd" you should see the partitions that are currently on the flash and you can confirm that mtdblock1 is indeed what you want to mount.
    mcelweep@msoe.edu
    New Member
    New Member
    Posts:


    --
    23 Aug 2007 11:48 AM
    I am convinced there is something janky with the YAFFS2 stuff. I did figure out how to stop corrupting the flash system. There was a patch recently released to the uclinux mailing list that fixes a bug in the MTD code for the nand flash. The nand flash chip enable had to be changed so it used the gpio latch to control it. I can use jffs2 now without a problem.
    sygi@canbus.pl
    New Member
    New Member
    Posts:


    --
    27 Nov 2007 03:29 AM
    Posted By pmcelwee13 on 23 Aug 2007 11:48 AM
    I am convinced there is something janky with the YAFFS2 stuff. I did figure out how to stop corrupting the flash system. There was a patch recently released to the uclinux mailing list that fixes a bug in the MTD code for the nand flash. The nand flash chip enable had to be changed so it used the gpio latch to control it. I can use jffs2 now without a problem.



    Hi
    Could You tell me where to look for a latest nand patch and yaffs support patch ??
    Regards
    mcelweep@msoe.edu
    New Member
    New Member
    Posts:


    --
    28 Nov 2007 09:40 AM
    I got this patch from the guy who maintains the M5329 MTD drivers. It should patch against the 2.6.17 kernel relatively ok.

    diff U3b Z:/uClinux_linux-2.6.x_arch/m68knommu/platform/532x/config.c@@/main/anta_EMV_Mod3/1 Z:/wipe/linux-2.6.x/arch/m68knommu/platform/532x/config.c@@/main/anta_EMV_Mod3/2
    --- Z:/uClinux_linux-2.6.x_arch/m68knommu/platform/532x/config.c@@/main/anta_EMV_Mod3/1 Fri Sep 15 16:59:33 2006
    +++ Z:/wipe/linux-2.6.x/arch/m68knommu/platform/532x/config.c@@/main/anta_EMV_Mod3/2 Mon Oct 02 14:41:44 2006
    @@ -47,6 +47,21 @@

    /***************************************************************************/

    +int sys_clk_khz = 0;
    +int sys_clk_mhz = 0;
    +
    +void wtm_init(void);
    +void scm_init(void);
    +void gpio_init(void);
    +void fbcs_init(void);
    +void sdramc_init(void);
    +int clock_pll (int fsys, int flags);
    +int clock_limp (int);
    +int clock_exit_limp (void);
    +int get_sys_clock (void);
    +
    +/***************************************************************************/
    +
    /*
    * DMA channel base address table.
    */
    @@ -91,6 +106,9 @@

    void config_BSP(char *commandp, int size)
    {
    + sys_clk_khz = get_sys_clock();
    + sys_clk_mhz = sys_clk_khz/1000;
    +
    mcf_setimr(MCFSIM_IMR_MASKALL);

    #if defined(CONFIG_BOOTPARAM)
    @@ -168,24 +186,9 @@

    #define NAND_FLASH_ADDRESS (0xD0000000)

    -int sys_clk_khz = 0;
    -int sys_clk_mhz = 0;
    -
    -void wtm_init(void);
    -void scm_init(void);
    -void gpio_init(void);
    -void fbcs_init(void);
    -void sdramc_init(void);
    -int clock_pll (int fsys, int flags);
    -int clock_limp (int);
    -int clock_exit_limp (void);
    -int get_sys_clock (void);

    asmlinkage void __init sysinit(void)
    {
    - sys_clk_khz = clock_pll(0, 0);
    - sys_clk_mhz = sys_clk_khz/1000;
    -
    wtm_init();
    scm_init();
    gpio_init();
    @@ -234,14 +237,14 @@
    /* Initialize latch to drive signals to inactive states */
    *((u16 *)(0x10080000)) = 0xFFFF;

    - /* External SRAM */
    - MCF_FBCS1_CSAR = EXT_SRAM_ADDRESS;
    - MCF_FBCS1_CSCR = (MCF_FBCS_CSCR_PS_16
    - | MCF_FBCS_CSCR_AA
    - | MCF_FBCS_CSCR_SBM
    - | MCF_FBCS_CSCR_WS(1));
    - MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_512K
    - | MCF_FBCS_CSMR_V);
    +// /* External SRAM */
    +// MCF_FBCS1_CSAR = EXT_SRAM_ADDRESS;
    +// MCF_FBCS1_CSCR = (MCF_FBCS_CSCR_PS_16
    +// | MCF_FBCS_CSCR_AA
    +// | MCF_FBCS_CSCR_SBM
    +// | MCF_FBCS_CSCR_WS(1));
    +// MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_512K
    +// | MCF_FBCS_CSMR_V);

    /* Boot Flash connected to FBCS0 */
    MCF_FBCS0_CSAR = FLASH_ADDRESS;
    diff U3b Z:/uClinux_linux-2.6.x_drivers/mtd/nand/m5329.c@@/main/anta_EMV_Mod3/1 Z:/wipe/linux-2.6.x/drivers/mtd/nand/m5329.c@@/main/anta_EMV_Mod3/2
    --- Z:/uClinux_linux-2.6.x_drivers/mtd/nand/m5329.c@@/main/anta_EMV_Mod3/1 Fri Sep 15 17:48:45 2006
    +++ Z:/wipe/linux-2.6.x/drivers/mtd/nand/m5329.c@@/main/anta_EMV_Mod3/2 Fri Sep 29 09:21:32 2006
    @@ -36,6 +36,9 @@
    /*
    * Values specific to the SPIA board (used with EP7212 processor)
    */
    +#define NAND_FLASH_CE ((u16 *)(0x10080000))
    +#define NCE_LOW_VAL 0xfbfb
    +#define NCE_HIGH_VAL 0xffff
    #define NAND_FLASH_ADDRESS 0xd0000000 /* Fash address mapping */

    #define CLE_ADDR_BIT 4
    @@ -90,10 +93,12 @@
    m5329_fio_base &= ~(1<<ALE_ADDR_BIT);
    break;
    case NAND_CTL_SETNCE:
    - m5329_fio_base &= ~(1<<NCE_ADDR_BIT);
    + *NAND_FLASH_CE = NCE_LOW_VAL;
    +// m5329_fio_base &= ~(1<<NCE_ADDR_BIT);
    break;
    case NAND_CTL_CLRNCE:
    - m5329_fio_base |= 1<NCE_ADDR_BIT;
    + *NAND_FLASH_CE = NCE_HIGH_VAL;
    +// m5329_fio_base |= 1<NCE_ADDR_BIT;
    break;
    }
    /* Set address of NAND IO lines */
    @@ -135,6 +140,8 @@

    /* Link the private data with the MTD structure */
    m5329_mtd->priv = this;
    +
    + *NAND_FLASH_CE = NCE_HIGH_VAL;

    /* Set address of NAND IO lines */
    this->IO_ADDR_R = (void __iomem *) m5329_fio_base;

    sygi@canbus.pl
    New Member
    New Member
    Posts:


    --
    29 Nov 2007 02:03 AM
    Thanks

    I think this solved my few problems (I had some CRC warnings from jffs2 driver during mounting). Now seems to be OK.
    I stil got one problem with mounting my flash device as rootfs.
    I am using "rootfs=/dev/mtdblock1 rootfstype=jffs2" line in kernel command line but I get these lines during boot:

    Empty flash at 0x001a4ad0 ends at 0x001a4ad4
    Empty flash at 0x001a4b34 ends at 0x001a4b38
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6000: 0x004d instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6004: 0x5f4f instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6008: 0x004d instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a600c: 0x5f45 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6010: 0x004b instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6014: 0x5400 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6018: 0x0025 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a601c: 0x7325 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6020: 0x0028 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6024: 0x6c29 instead
    Further such events for this erase block will not be printed
    Empty flash at 0x001a6364 ends at 0x001a6368
    Empty flash at 0x001a6374 ends at 0x001a6378


    How do You prepare Your rootfs ?? (what command ??)

    I wondering I there is a bug in jffs2 or my flash is broken.
    Maybe yaffs could clear this, but I do not have support compiled into kernel (can't find any patch for yaffs support either)

    Regards
    mcelweep@msoe.edu
    New Member
    New Member
    Posts:


    --
    29 Nov 2007 08:49 AM
    Posted By sygi on 29 Nov 2007 2:3 AM
    Thanks

    I think this solved my few problems (I had some CRC warnings from jffs2 driver during mounting). Now seems to be OK.
    I stil got one problem with mounting my flash device as rootfs.
    I am using "rootfs=/dev/mtdblock1 rootfstype=jffs2" line in kernel command line but I get these lines during boot:

    Empty flash at 0x001a4ad0 ends at 0x001a4ad4
    Empty flash at 0x001a4b34 ends at 0x001a4b38
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6000: 0x004d instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6004: 0x5f4f instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6008: 0x004d instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a600c: 0x5f45 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6010: 0x004b instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6014: 0x5400 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6018: 0x0025 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a601c: 0x7325 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6020: 0x0028 instead
    jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x001a6024: 0x6c29 instead
    Further such events for this erase block will not be printed
    Empty flash at 0x001a6364 ends at 0x001a6368
    Empty flash at 0x001a6374 ends at 0x001a6378


    How do You prepare Your rootfs ?? (what command ??)

    I wondering I there is a bug in jffs2 or my flash is broken.
    Maybe yaffs could clear this, but I do not have support compiled into kernel (can''t find any patch for yaffs support either)

    Regards




    I don't boot from a jffs2, I boot from ram that was loaded from LoLo. I just need to mount a jffs2 partition to store 5 bytes of data (overkill ?!?!). It looks like you just need to wipe the flash and reformat it.

    I am having trouble remembering the commands but there is an erase flash program that gets compiled into the userspace progs called mtdutils that can wipe the flash then you just mount it as jffs2 and the mount command will reformat it as jffs2 for you and clean up all those bad magic thingies.

    HTH
    sygi@canbus.pl
    New Member
    New Member
    Posts:


    --
    30 Nov 2007 05:20 AM
    That's right. I am using flash_eraseall (from mtdutils) command to prepare my filesystem.
    I've noticed that those jffs2 warnings appear when I store large files on the flash.
    It is probably jffs2 (or another mtd ) bug.
    You have mentioned about yaffs patch. Could You tell where to look for the patch and for yaffs code ??

    Regards
    mcelweep@msoe.edu
    New Member
    New Member
    Posts:


    --
    06 Dec 2007 01:37 PM
    You can get the code from http://www.yaffs.net. They have some pretty good explanations of what to do, you are going to have to insert the code into the kernel build tree and add make file stuff to get it to compile. I never got yaffs to work very well, hope you get it to work.
    You are not authorized to post a reply.