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.

Setting up NAND from bootable SD for first time on proprietary HW

Other Parts Discussed in Thread: CCSTUDIO

Hello to all,

We're using DM8127 custom board with IPNC RDK.

After trying many different ways and reading many WIki articles about how to boot from an SD card and then how to copy u-boot, uImage and filesystem to NAND so that unit will work stand-alone (without NFS and without SD card), I came up with the instructions below.

Unfortunately, with all of the documentation, these steps were not clear. I'm not sure if I have to prepare the filesystem on the SD card, if I'm using the SD card just in order to prepare the NAND on a new board.

I'd appreciate any comments. The SD card is recognized as /dev/sdb.

In order to build the bootableSD so that the NAND can be burned, files were copied as follows into a single directory:

from Binaries/DM8127/Rev1/sd/J003
---------------------------------
mksd-ti81xx.sh

filesys_full_feature.tar.gz

MLO

from Binaries/DM8127/Rev1/nand/J003
-----------------------------------
u-boot.bin
u-boot.min.nand
uImage

Steps for creating bootable SD:
-------------------------------
1) first umount /dev/sdb1 and /dev/sdb
2) navigate to directory with all of above files and run script as follows:
       ./mksd-ti81xx.sh /dev/sdb MLO u-boot.bin uImage filesys_full_feature.tar.gz

3) It should take a while - ending with
       [Making filesystems...],
       [Copying files...]
       and then [Done]

4) fdisk -l should show:
    Disk /dev/sdb: 3965 MB, 3965190144 bytes
    255 heads, 63 sectors/track, 482 cylinders, total 7744512 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Device    Boot    Start      End    Blocks   Id    System
    /dev/sdb1 *          63   144584     72261    c    W95 FAT32 (LBA)
    /dev/sdb2        160650  7743329   3791340   83    Linux

    [Note: lines with disk details and bottom line will be different according to size of SD card]

5) copy ubifs_ipnc_full_feature.bin into the SD/boot directory

The umount step was not mentioned anywhere - but without it, the disk is not recognized and can't be partitioned.

The link below was helpful - but the ecc commands caused errors - and I understand that in the newer versions, there should be no ecc commands.

http://processors.wiki.ti.com/index.php/DM814x_AM387x_PSP_U-Boot#Setting_Up_Boot_Environment_on_SD_Card

Insert SD card and put jumper on JP2. Boot system from SD card.

To copy from the SD card to the NAND, perform the following at the TI8148_IPNC# prompt (also partially documented):

mmc rescan 0

nand scrub 0x006C0000 0xB940000

mw.b 0x81000000 0xFF 0x5000000

fatload mmc 0 0x81000000 ubifs_ipnc_full_feature.bin

nand erase 0x006C0000 0xB940000

nand write 0x81000000 0x006C0000 0x5000000

mmc rescan 0
mw.b 0x81000000 0xFF 0x20000
fatload mmc 0 0x81000000 u-boot.min.nand

nand erase 0x0 0x20000

nand write.i 0x81000000 0x0 0x20000

mmc rescan 0
mw.b 0x81000000 0xFF 0x20000
fatload mmc 0 0x81000000 u-boot.bin

nand erase 0x20000 0x60000

nand write.i 0x81000000 0x20000 0x60000

The environment variables must be set, also:

setenv bootargs 'console=ttyO0,115200n8 rootwait=1 rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs init=/init mem=80M vram=4M notifyk.vpssm3_sva=0xBFD00000 eth=00.0C.0C.02.39.5F cmemk.phys_start=0x85000000 cmemk.phys_end=0x89000000 cmemk.allowOverlap=1 earlyprintk'
setenv fileaddr 81000000
setenv filesize 3980000

saveenv

Power off system. Remove SD card, remove JP2 jumper. Power up. Should be running from NAND.

I'd appreciate any comments - and also if this helps someone, I'd like to know.

Thanks,

Mechi

  • Mechi,

    From what I see, you are using DM8127 custom board with IPNC RDK, is that correct?

    Please note that NAND can be flashed (written with u-boot, linux kernel, root fs) from many sources: JTAG/CCStudio, MMC/SD card, UART, Ethernet.

    To flash the NAND from MMC/SD card, you should be able to load the u-boot from the MMC/SD card and enter in the u-boot prompt. See the below wiki page for more details:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_UBOOT_User_Guide#TI814X.2FTI813X
    SD-Flash-Method

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_UBOOT_User_Guide#Flashing_images_to_TI814X_.26_TI813X_NAND_in_SD_boot

    BR
    Pavel
  • Hi Pavel,

    But no where in the documentation is it mentioned how to write the filesystem from the SD card to the NAND. Hence these rows:

    mmc rescan 0

    nand scrub 0x006C0000 0xB940000

    mw.b 0x81000000 0xFF 0x5000000

    fatload mmc 0 0x81000000 ubifs_ipnc_full_feature.bin

    nand erase 0x006C0000 0xB940000

    nand write 0x81000000 0x006C0000 0x5000000

    We are talking about the production floor, where many new cards will have to be booted and burned with the u-boot, uImage and file system.

    There will be no host computer and no communication (UART, SPI) - just the console with the debug board.

    We need to have the process done as semi-automatically as possible.

    Thanks,

    Mechi

  • Mechi,

    Mechi Fendel said:
    But no where in the documentation is it mentioned how to write the filesystem from the SD card to the NAND.

    See the below wiki:

    You just need to change tftp command with mmc:

    TI8148_EVM# tftp 0x81000000 <filesystem_image> 

    TI8148_EVM# mmc rescan 0
    TI8148_EVM# fatload mmc 0 0x81000000 <filesystem_image>

    BR
    Pavel
  • see also if the below e2e thread will be in help:
    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/p/333020/1169771#1169771

    BR
    Pavel
  • I couldn't find the mksd script file (maybe it is not is not included in the 3.8.0 installation)

    #!/bin/bash
    
    if [[ -z $1 || -z $2 || -z $3 || -z $4 ]]
    then
    	echo "mksd-ti814x Usage:"
    	echo "	mksd-ti814x <device> <MLO> <u-boot.bin> <uImage> <rootfs tar.gz >"
    	echo "	Example: mksd-ti814x /dev/sdc MLO u-boot.bin uImage nfs.tar.gz"
    	exit
    fi
    
    if ! [[ -e $2 ]]
    then
    	echo "Incorrect MLO location!"
    	exit
    fi
    
    if ! [[ -e $3 ]]
    then
    	echo "Incorrect u-boot.bin location!"
    	exit
    fi
    
    if ! [[ -e $4 ]]
    then
    	echo "Incorrect uImage location!"
    	exit
    fi
    
    if ! [[ -e $5 ]]
    then
    	echo "Incorrect rootfs location!"
    	exit
    fi
    
    echo "All data on "$1" now will be destroyed! Continue? [y/n]"
    read ans
    if ! [ $ans == 'y' ]
    then
    	exit
    fi
    
    echo "[Partitioning $1...]"
    
    DRIVE=$1
    dd if=/dev/zero of=$DRIVE bs=1024 count=1024
    	 
    SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
    	 
    echo DISK SIZE - $SIZE bytes
     
    CYLINDERS=`echo $SIZE/255/63/512 | bc`
     
    echo CYLINDERS - $CYLINDERS
    {
    echo ,9,0x0C,*
    echo 10,,,-
    } | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
    
    echo "[Making filesystems...]"
    
    mkfs.vfat -F 32 -n boot "$1"1 &> /dev/null
    mkfs.ext3 -L rootfs "$1"2 &> /dev/null
    
    echo "[Copying files...]"
    
    mount "$1"1 /mnt
    cp $2 /mnt/MLO
    cp $3 /mnt/u-boot.bin
    cp $4 /mnt/uImage
    umount "$1"1
    
    mount "$1"2 /mnt
    tar zxvf $5 -C /mnt &> /dev/null
    chmod 755 /mnt
    umount "$1"2
    
    echo "[Done]"
    
    - so

    I attached it. Remove the txt suffix.