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.

How to flash a kernel and a FS without using the Ethernet port?

Hello,

I am currently working on a EVM DM368, using the ti dvsdk 4.02, and a kernel linux.

To flash the UBL and uboot, I used the flash program and the appropriated files and the transfer was made via the RS port.
To flash my kernel and FS, I followed the processes described into the SDG provided by TI. For the kernel, I used TFTP and for the file system I used a NFS.
On each system boot, the UBL, uboot, kernel and file system are booted from the NAND flash.
All was correctly done.

Now, I would like to make the same (using the same files and tar archive) but without using the ethernet port to transfer kernel and FS.
I would like to use the USB port and/or the RS port.

Is it possible? If yes, how to do it?



Thank you very much for your help!

  • Hello, Julien!

    Yes, it is possible, you can download Linux and filesystem in U-Boot via UART. Please use loadb command, as example http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:serial_port_loading_files

  • Hi Kirill,

    Firstly, thanks a lot for helping me. Your link was really helpful.

    I succeeded in a transfer of linux kernel image (I used the default kernel image from the ti-dvsdk). I tried the two different UART protocoles, i.e. Ymodem and Kermit. Both OK. The main drawback is that these protocols are really slow for file transferring. My kernel image was pretty small (appr. 2MB) and it took several minutes.

    Now, I have a problem for transferring the FS. Indeed, before, when I used ethernet, I worked thanks to NFS and I followed the process described into the TI SDG to flash the FS, like that :
    - A filesystem compressed in a file filesystem.tar.gz and a NFS between host and target running.
    - Boot the EVM with default kernel image and NFS root filesystem.
    - Wait the EVM is ready, and use the following commands :
    root# flash_eraseall /dev/mtd4
    root# mkdir -p /mnt/nand
    root# mount /dev/mtdblock4 /mnt/nand -t jffs2
    root# cd /mnt/nand
    root# tar zxf /home/root/filesystem.tar.gz
    root# sync
    root# cd /home/root
    root# umount /mnt/nand
    - Reboot the EVM and then stop the autoboot
    - Type in EVM# setenv bootargs console=ttyS0,115200n8 (...) root=/dev/mtdblock4 rootfstype=jffs2 ip=off
    - Type EVM# saveenv then reboot the system.

    If I would like to use the UART protocols, as I previously did for kernel image, how to do it for FS?
    I mean what is the command line to type in my terminal : loady [load adr] [baud rate] -------> what is the value for load adr?

    Please, can I have some help to do that? I am sorry for my lack of knowledges about this...

  • Hello, Julien!

    Usualy this used for read-only filesystem, .e.g. CRAMFS. Please see http://processors.wiki.ti.com/index.php/Put_CRAMFS_Image_to_Flash and http://processors.wiki.ti.com/index.php/Creating_a_Root_File_System_for_Linux_on_OMAP35x , may be it will be helpful.

    If you use read/write filesystem you should pack filesystem in file, e.g. http://processors.wiki.ti.com/index.php/Create_a_JFFS2_Target_Image and http://www.denx.de/wiki/DULG/RootFileSystemOnAJFFS2FileSystem
    After this you can download this file in U-Boot and write it on NAND.

  • Hi Kirill,

    Thanks a lot for your links. In my project, I need a read/write filesystem, so I chose jffs2 filesystem.
    In my embedded system, I already mounted a jffs2 fs, booting from NAND flash, but I mounted it thanks to a NFS I previously used.

    My aim is now to mount a jffs2 fs into the NAND directly, without using the NFS anymore. So, I tried to follow the process described into http://processors.wiki.ti.com/index.php/Create_a_JFFS2_Target_Image wiki page, process named "Making the File System Image >>>Making a JFFS2 image".

    To do that, I used the provided filesystem tarball into the ti-dvsdk, named "dvsdk-dm368-evm-rootfs.tar.gz" (appr. 260MB).

    I well done the first steps I think, here are my comand lines:
    root# mkdir -p /home/ju/workdir
    root# cd /home/ju/workdir
    root# cp /home/ju/ti-dvsdk_dm368-evm_4_02_00_06/filesystem/dvsdk-dm368-evm-rootfs.tar.gz ramdisk.gz
    root# mkdir ram
    root# gunzip ramdisk.gz
    root# mount ramdisk ram -o loop //HERE IS THE PROBLEM!

    After that last comand line, an error message is displayed, telling that "mount : only the ROOT can do that".
    So, I tried : root# sudo mount ramdisk ram -o loop instead, but new error message displayed : "mount : you must specify the filesystem type".

    I do not really know what the problem is, is it a mistake in the wiki page? A bad using of "mount" function?
    I am not able to follow the next of the process (creation of the filesystem image...). I apologize for my lack of knowledges about Linux and all around this O.S. because it is the first time I am using it and I am not familiar with the environment and the comands yet. Sorry...


    Hope you could give me help again Kirill. Thanks again!



  • Because you mount non-standart filesystem you should be set it type, e.g. sudo mount -t jffs2 -o loop <your file> <mount point>

  • Hi Kirill,

    I just tried your line... without any success!
    The error displayed is now : "mount : bad filesystem type, bad option, bad superbloc on /dev/loop0, codepage or help missing or other error. In a few cases information could help into the syslog - have a try
    dmesg | tail or something like this"

    I think my problem is that the original archive is a tarball, and maybe it is not understood.
    So I tried a different method, using untar function :
    root# mkdir -p /home/ju/workdir/fs
    root# cd /home/ju/workdir/fs
    root# cp /home/ju/ti-dvsdk_dm368-evm_4_02_00_06/filesystem/dvsdk-dm368-evm-rootfs.tar.gz filesystem.tar.gz
    root# mkdir ram
    root# cd ram
    root# sudo tar zxf /home/ju/workdir/fs/filesystem.tar.gz
    root# cd /home/ju/workdir/fs
    root# mkfs.jffs2 -n -r ram -e 128 -o rootfs.jffs2

    I created a jffs2 filesystem image, which is about 300MB.

    Now I am using the method you gave me previously, i.e. using the UART file transfer protocol (Ymodem) at u-boot prompt.
    The file is transferring, it takes so long! (estimated time : 9 hours! lol).

    Thanks Kirill, I will tell you the result, when the transfer will finish...

  • Hello, Julien!

    Usualy I build filesystem manualy, this is not very hard. I think you can make it and have your personal filesystem.

  • Hi Kirill,

    Do you mean by manualy : create, with for instance "-mkdir", all the needed directories for linux, such as /bin /home /proc /usr etc.??

    I tried to load my image fs jffs2 as I previously told. I did not succeed! First, I tried EVM# loady 0x1410000 115200 (because according to my MTS partitions for the NAND flash):
    0x0 -> 0xf00000 : "bootloader"
    0xf00000 -> 0x1000000 : "params"
    0x1000000 -> 0x1400000 : "kernel"
    0x1400000 -> 0x21400000 : "fs 1"
    0x21400000 -> 0x80000000 : "fs 2"

    The transfer failed automatically, after a few minutes of file loading...

    I made a new try with a smaller jffs2 fs image (=0x6398400), and type : EVM# loady 0x80700000 115200. No file loading problem. The file seems to be totally transfered.
    Then, I wrote : EVM# nand erase 0x1410000 0x6399000 //erase the MTD partition fs1 with a size of 0x6399000 (nearest 0x1000 size of the filesystem image)
    Here, a lot of failures : MTD erase failure : -22
    Then, I try : EVM# nand write 0x80700000 0x1410000 0x6399000.

    Reboot of the EVM, the boot took place normally (kernel + fs). But, I can see it is not my new mounted filesystem I access but the former one! All my old applications, included in the former filesystem are still there!

    What is missing/wrong?

    Thank you!

  • Julien Hoet said:
    Do you mean by manualy : create, with for instance "-mkdir", all the needed directories for linux, such as /bin /home /proc /usr etc.??

    Yes, create all directories, build all programm and create all scripts, this is not very hard. I use http://www.busybox.net/ , but you can chouse another, e.g. http://buildroot.uclibc.org/ , http://arago-project.org/wiki/index.php/Main_Page or http://www.angstrom-distribution.org/

  • Kirill,

    I see. I have not try this mean yet.

    For the problems I told, what do you think about?
    Is there something I am doing wrong?

    Thank you!

  • Julien Hoet said:
    For the problems I told, what do you think about?
    Is there something I am doing wrong?

    Julien, I think you have problem with NAND (MTD erase failure : -22):
    - please recheck NAND configuration
    - you can enable debug, if NAND driver support it, and get more information about fault reason

  • Kirill Brilliantov said:

    - please recheck NAND configuration
    - you can enable debug, if NAND driver support it, and get more information about fault reason

    How to do both instructions you are giving?

    At this time, I retry something with a different filesystem, already created and provided into the ti-dvsdk. It is very light (arago based FS)-13MB.
    Here are my comand lines :

    DM36x EVM # loady 0x80700000 115200
    ## Ready for binary (ymodem) download to 0x80700000 at 115200 bps...
    CCxyzModem - CRC mode, 2(SOH)/13892(STX)/0(CAN) packets, 4 retries
    ## Total Size      = 0x00d90cf8 = 14224632 Bytes
    DM36x EVM # nand erase 0x1400000 0xd91000

    NAND erase: device 0 offset 0x1400000, size 0xd91000
    Erasing at 0x2180000 -- 100% complete.
    OK
    DM36x EVM # nand write 0x80700000 0x1400000 0xd91000

    NAND write: device 0 offset 0x1400000, size 0xd91000
     14225408 bytes written: OK

    As you can see, no problem for flash erasing nor writing, according to the log...

    I made a printenv to show you what args I am using for the boot:
    DM36x EVM # printenv
    autoload=no
    baudrate=115200
    bootargs=console=ttyS0,115200n8 rw dm365_imp.oper_mode=0 video=davincifb:vid0=OF
    F:vid1=OFF:osd0=480x272x16,4050K mem=48MB davinci_capture.device_type=4 vpfe_cap
    ture.cont_bufsize=12582912 davinci_enc_mngr.ch0_output=LCD davinci_enc_mngr.ch0_
    mode=480x272 root=/dev/mtdblock4 rootfstype=jffs2 ip=off
    bootcmd=nboot 0x80700000 0 0x400000;bootm
    bootdelay=4
    bootfile=uImage-dm368-evm.bin
    ethact=DaVinci-EMAC
    ethaddr=00:0e:99:03:52:40
    filesize=D90CF8
    serverip=192.168.1.63
    serverip=192.168.1.66
    stderr=serial
    stdin=serial
    stdout=serial
    ver=U-Boot 2010.12-rc2 (Mar 24 2011 - 16:49:26)

    Environment size: 637/262140 bytes

    Is there something wrong there? Something which is not really good for what I want to do?
    Please, I am so sorry to ask you a lot of questions like this, but I am not yet familiar with Linux...

    Thanks Kirill!

  • Maybe the nand write is not "really efficient"?!
    I found this page : http://processors.wiki.ti.com/index.php/Put_JFFS2_Image_to_Flash#NAND_Flash, it talks about that you must use a version of u-Boot which supports the ".trimffs" option to the "nand write" command.

    Is it?

  • Hello, Juleint!

    In this output I not see any problem, but note what U-Boot is a simpler than Linux, I hope what all will be well after loading filesystem from NAND.