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 24 Feb 2008 11:17 AM by  bvmagaldi
boot from nand with iMX31
 8 Replies
Sort:
You are not authorized to post a reply.
Author Messages
amiko
New Member
New Member
Posts:


--
05 Aug 2007 01:38 PM
    Hi

    We plan to first have a working Linux BSP on our lite SOM-LV imx31 and then to modify it into a boot from nand system by changing some of the bootstrap resistors.
    My question is: Does anyone know about any promlem with boot from nand with iMX31 in general and also with the SOM-LV ?

    Maybe even someone here had an experience with Linux booting from nand on the imx31 processor ?

    Thanks in advance for any kind of help or remark

    Ami
    motraat
    New Member
    New Member
    Posts:


    --
    14 Aug 2007 02:19 AM
    Hi! I will interested in knowing about your findings on booting from nand. I am also searching for information. I ll share if I get any information.
    titinger@digigram.com
    New Member
    New Member
    Posts:


    --
    10 Jan 2008 04:59 AM
    Hello All,

    we developed our own CPU module, very likely to the SOM module with slight differences upon which a secondary ethernet controler (using the "user" chip select forseen in the SOM design), and no NOR flash. It has the same Samsung flash as the SOM.

    I went to the Lolo users manual and read the "NAND Boot Process" and I have some questions :
    - what is LPD's policy on providing binaries and/or sources for Nolo, for Lolo ?
    - has anyone here some experience with implementing a no-NOR-boot-from-NAND who could kindly share his experience ?
    - how complex is the first step loader (Nolo, that is copied by the NAND controler to the internal SRAM), I guess if i have to code it myself, I need to be able to drive the NAND controler to copy the "big" bootloader to the SDRAM ?

    It seems to me that the simplest solution would be if we could download some .bit file to initialise the Samsung flash containing Nolo in block0 and Lolo(lboot.elf) in block1.

    Also, what happens to the /dev/config device and the CREATE command when no NOR is there ? does Lolo lose his ability to run a boot script after reset ?

    thanks

    Marc.
    mattwick
    New Member
    New Member
    Posts:


    --
    11 Jan 2008 11:31 AM
    We got this to work using Lolo with LTIB rev5. We first applied the litekit patches that you will find in this post: http://tdg.logicpd.com/viewtopic.php?f=29&t=1310.

    We decided to partition our NAND accordingly: 20MB for rootfs, 42MB for userfs, 2MB for the kernel zImage and bootloader. To do this, we modified arch/arm/mach-mx3/mx31lite.c as follows:
    static struct mtd_partition mxc_nand_partitions[2] = {
    {
    .name = "nand.rootfs",
    .offset = 0x00000000,
    .size = 20 * 1024 * 1024},
    {
    .name = "nand.userfs",
    .offset = MTDPART_OFS_APPEND,
    .size = 42 * 1024 * 1024},
    };


    You will notice that we did not include the final 2MB where we will save the zImage and bootloader because the Lolo Yaffs is incompatible with the kernel.

    The next thing we did is to first compile the kernel with settings for an NFS only root file system. LTIB will set up a directory structure for you. We then recompile the kernel for jffs2 as the root file system. When done making the kernel, you will find rootfs.jffs2 in the root of your LTIB directory. This should be the same size as specified in mx31lite.c.

    The next thing to do is to boot the kernel with an NFS root file system. You can use the kernel compiled for a jffs2 rootfs, it doesn't matter. What matters is the arguments passed into the kernel from the bootloader. You will find the second stage bootloader we used: http://tdg.logicpd.com/viewtopic.php?f=29&t=1074&hilit=loader+bootloader.

    When booting from NFS, we use this as the command line argument (in the source code):
    #define COMMAND_LINE "console=ttymxc0 root=/dev/nfs nfsroot=192.168.3.11:/tftpboot/rootfs rw init=/linuxrc ip=192.168.3.31::192.168.3.1:255.255.255.0 noalign"


    When booting from jffs2, we use this as the command line argument:
    #define COMMAND_LINE "console=ttymxc0 root=/dev/mtdblock2 rootfstype=jffs2"

    You will notice that our rootfs is in mtdblock2. mx31lite.c defines two nor partitions (mtdblocks 0 & 1), and our change defines two nand partitions (mtdblocks 2 & 3).

    On this site there are plenty of instructions how to load the boot loader and zImage into RAM using Lolo. Do so and boot the kernel. We then put the rootfs.jffs2 file into the nfs directory our litekit can see and then execute the following:
    cat /proc/mtd
    will confirm your mtd blocks are correct.
    flash_eraseall -j /dev/mtd/2
    will erase and setup mtdblock2 to receive a jffs2 formatted file.
    nandwrite /dev/mtd/2 $YOUR_LOCATION/rootfs.jffs2
    copies the rootfs into nand flash (mtdblock2)

    To check to make sure everything is OK, mount the new file system and read its structure. After reboot, you will not need to worry about this again:
    mx31# mount -t jffs2 /dev/mtdblock2 /mnt/rootfs.jffs2
    mx31# ls /mnt/rootfs.jffs2


    To return to Lolo, do the following:
    reboot


    Now it is time to install zImage and the loader into nand flash. You will recall we reserved the upper 2 MB of nand flash for this. This region begins at block 3968 for a length of 128 blocks. Once you have your networking running in Lolo (ifconfig), do the following (your IP and directory names will differ):
    losh> erase B3968 B128 /dev/nand0
    losh> add-yaffs boot nand B3968 B128; mount yaffs /boot
    losh> cp /tftp/192.168.3.11:/tftpboot/loader_jffs2 /boot/loader_jffs2; cp /tftp/192.168.3.11:/tftpboot/zImage /boot/zImage


    To boot the kernel, do the following:
    losh> load elf 0x800d03a8 36000 /boot/loader_jffs2; load raw 0x81000000 1684324 /boot/zImage; exec 0x800d03a8


    The Lolo reference manual will provide instuctions how to use VOLOecho to make a boot script. Once done, your machine will boot autonomously with a jiffs2 rootfs and no need for NFS.
    DrOctavius
    New Member
    New Member
    Posts:


    --
    11 Jan 2008 01:24 PM
    mattwick,

    Niceeeee!!

    Thanks to you, finally I will boot from NAND!
    titinger@digigram.com
    New Member
    New Member
    Posts:


    --
    14 Jan 2008 02:11 AM
    Indeed, thanks a lot mattwick, it's a very nice and clear post !

    but still, as we first planned on removing the NOR from our design, and I haven't yet figured out what is the right path to go, to bring up the losh prompt when no NOR is in the design. I've found the binaries for Lolo on Logicpd's download section, but I'll need to provide something to our factory to initialize the Samsung NAND, and this must contain not only the Lolo binary, but the little "Nolo" loader that initialises the clocks and SDRAM and finaly loads Lolo : the imx31-Nand Controler expects, I believe, a little loader to be found in the first 2kbytes of the NAND when the chip is configured for NAND boot. And I wonder how Lolo manages it's /dev/config without NOR.

    Marc.
    DrOctavius
    New Member
    New Member
    Posts:


    --
    14 Jan 2008 02:32 AM
    My plan is to move to u-boot as soon as I have time and penguitronix's I.MX31 porting gets more functionality.

    You can find u-boot's patch here:
    http://www.nabble.com/-pa...Boot-to9491594.html.
    prashm_77@yahoo.com
    New Member
    New Member
    Posts:


    --
    11 Feb 2008 05:28 AM
    hai,

    I tried this its work's fine, but how to make loader & zImage to load by itself while powering ON.
    Is there any documents related to this. pls share with me.

    Thanks in advance.
    bvmagaldi
    New Member
    New Member
    Posts:


    --
    24 Feb 2008 11:17 AM
    Hi,
    Where can I find flash_eraseall and nandwrite tools?
    Is there some Ltib' set or are they a kernel set?
    Thanks a lot
    [SOLVED]
    You are not authorized to post a reply.