This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

boot nand flash and fat filesystem

Is it possible to format nand flash like SD card (with fat) and treat the boot in nand to interpret fat filesystem with MLO, u-boot.img and uImage into fat, like it is to the SD card boot?

If it is possible, what is the vantage or disadvantage of this approach?

  • Hi Daniel,

    The FAT file system doesn't offer wear leveling, which means that either the driver needs to implement this, or the NAND chip needs to provide hardware wear leveling. Otherwise the NAND chip will reach its erase cycle limit very fast.

    Best regards,
    Miroslav

  • I see, but the same problem doesn`t occur when I write directly using "nand write", "nand erase" commands? They don`t have wear leveling too?
    for example, if I work with 2 images:

    mlo1
    mlo2
    mlo3
    uboot
    environment variables
    ---------------- image 1
    kernel1
    filesystem1
    ---------------- image 2
    kernel2
    filesystem2

    and I switch between image1 and 2 when an update occurs in image1 or image2. What is the difference if I use something like that in nand flash (similar to SD card):

    ---------------- FAT
    mlo
    uboot
    environment variables
    kernel1
    kernel2
    ---------------- ext3
    filesystem1
    ---------------- ext3
    filesystem2

    thank you for your responses.

  • Hi,

    I have never seen or heard of such an approach. I don't really think this would work. The ROM code inside the AM335x chip expects the following NAND layout:

    |-->0x00000000-> SPL start (SPL copy on 1st block)
    |
    |-->0x0001FFFF-> SPL end
    |-->0x00020000-> SPL.backup1 start (SPL copy on 2nd block)
    |
    |-->0x0003FFFF-> SPL.backup1 end
    |-->0x00040000-> SPL.backup2 start (SPL copy on 3rd block)
    |
    |-->0x0005FFFF-> SPL.backup2 end
    |-->0x00060000-> SPL.backup3 start (SPL copy on 4th block)
    |
    |-->0x0007FFFF-> SPL.backup3 end
    |-->0x00080000-> U-Boot start
    |                                    
    |-->0x002BFFFF-> U-Boot end
    |-->0x00260000-> ENV start
    |
    |-->0x0027FFFF-> ENV end
    |-->0x00280000-> Linux Kernel start
    |
    |-->0x10000000-> NAND end (Free end)

    Here is the layout of the FAT file system:

    -->0x00000000--> Master Boot Record
    -- 1st Partition Boot Record
    -- Fat Table 1
    -- Fat Table #
    -- Root Directory - This address is (Partition Start Address + 512 + (Size of FAT Table x Number of Copies of FAT))
    -- Files and Folders

    Your SPL, U-Boot and uImage will be located inside the Root Directory, which is offsetted from the NAND flash start address. I don't have access to the ROM code, but I suppose it will try to read from address 0x0, so it will read the FATFS Master Boot record as the first copy of the SPL and the booting process will fail.

    Somebody, please correct me if my assumptions are wrong.

    Daniel, what are you trying to accomplish with this design? Reload the kernel image without ever using an SD card?

    Best regards,
    Miroslav

  • It was only an alternative way to mount flash data layout. The first alternative is showed bellow, but arise up the affraid of bad blocks corrupts the kernel1 or kernel2  after some writes in nand, even with bad blocks control. Mainly because  writes in nand flash don`t have wear leveling. The idea of FAT in nand will be forget. Thank you for yours clarifications.

    mlo1
    mlo2
    mlo3
    uboot
    environment variables
    ---------------- image 1
    kernel1
    filesystem1
    ---------------- image 2
    kernel2
    filesystem2