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.

mksdboot uflash SD Booting

Is there an equivalent of mksdboot for the DM368 and DM8127 IPNC? I found the mksdboot as part of the EVM, but it requires many utilities from the EVM and installs many features not used in the IPNC. I was hoping for a more streamlined utility.

I also tried the uflash utility that comes in the IPNC RDK, but while the SD boots, it halts because the filesystem can't be found.  Perhaps there is a BOOTCMD that will help, but I wasn't able to find it.

Basically I'm trying to make a bootable SD card for the IPNC for testing, and that will allow UBL, u-boot, kernel, and filesystem to be written to NAND Flash. Can anyone help?

Thanks in advance...

  • P.S. - I have downloaded the DVSDK to get that version of mksdboot.  I tried installing the DVSDK under Ubuntu 14.04, but the install appears to "hang". I can quit the install, so the application is still running, but it is waiting for something.  There is no window or message to indicate what it is waiting for.

  • Hi,

    You can prepare the bootable SD-card by following this document. Make sure you don't erase your HDD contents, while erasing SD-card. You will need a DVSDK for preparing SD card. downloads.ti.com/.../TMS320DM3730_Software_Developers_Guide.pdf Once you complete this, UBL, uboot will be flashed into the SD card. You need to change your bootcmd and bootargs accordingly, to boot from SD card. You can find the bootcmd and bootargs in User-guide provided with IPNC RDK.

    If you want to flash UBL, uboot and kernel & file system(UBIFS) into NAND, flash the binaries provided with IPNC package using CCS. All the steps are provided in User-guide(provided with IPNC RDK). Make sure you set appropriate bootcmd & bootargs. 

  • Hi Prashanth,

    Thank you for your reply. I had found that document on the TI Web site. When I downloaded the DVSDK, I found it would not install on Ubuntu 14.04 (it appears to hang as described above), so I could not get mksdboot.sh from the DVSDK to run the command "sudo ${DVSDK}/bin/mksdboot.sh --device /dev/sdc --sdk ${DVSDK} /path/to/dvsdk_dm3730-evm_4_xx_xx_xx_xx_setuplinux".  In TI's defense, it is mentioned that the DVSDK would only run on much older versions of Ubuntu, such as 11.04.  However, the issue remains that I can't get mksdboot.sh.

    If you have access to this file, could you please send it to me here or via email?

    Thanks,

    John

  • Hi John,

    Yes, DVSDK will run on Ubuntu ver 12.04, I did not try with later versions. Please find the attached sample mksdboot.sh of DM368. You may need to modify for your target board.

    mksdboot.sh.txt
    #! /bin/sh
    # Script to create SD card for DM368 plaform.
    #
    # Author: Brijesh Singh, Texas Instruments Inc.
    #
    #         Arnie Reynoso, Texas Insturments Inc.
    #           Update to use uflash utility
    #
    
    VERSION="0.4"
    
    execute ()
    {
        $* >/dev/null
        if [ $? -ne 0 ]; then
            echo
            echo "ERROR: executing $*"
            echo
            exit 1
        fi
    }
    
    version ()
    {
      echo
      echo "`basename $1` version $VERSION"
      echo "Script to create bootable SD card for DM368 EVM"
      echo
    
      exit 0
    }
    
    usage ()
    {
      echo "
    Usage: `basename $1` [options] <sdk_install_dir> <device>
    Mandatory options:
      --device              SD block device node (e.g /dev/sdd)
      --sdk                 Where is sdk installed ?
      --rootfs              Where is the TAR.GZ root filesystem file?
    Optional options:
      --version             Print version.
      --help                Print this help message.
    "
      exit 1
    }
    
    # Process command line...
    while [ $# -gt 0 ]; do
      case $1 in
        --help | -h)
          usage $0
          ;;
        --device) shift; device=$1; shift; ;;
        --sdk) shift; sdkdir=$1; shift; ;;
        --rootfs) shift; rootfs=$1; shift; ;;
        --version) version $0;;
        *) copy="$copy $1"; shift;;
      esac
    done
    
    test -z $sdkdir && usage $0
    test -z $device && usage $0
    
    if [ ! -d $sdkdir ]; then
       echo "ERROR: $sdkdir does not exist"
       exit 1;
    fi
    
    if [ ! -f $rootfs ]; then
      echo "ERROR: failed to find rootfs $rootfs"
      exit 1;
    fi
     
    if [ ! -b $device ]; then
       echo "ERROR: $device is not a block device file"
       exit 1;
    fi
    
    echo "************************************************************"
    echo "*         THIS WILL DELETE ALL THE DATA ON $device        *"
    echo "*                                                          *"
    echo "*         WARNING! Make sure your computer does not go     *"
    echo "*                  in to idle mode while this script is    *"
    echo "*                  running. The script will complete,      *"
    echo "*                  but your SD card may be corrupted.      *"
    echo "*                                                          *"
    echo "*         Press <ENTER> to confirm....                     *"
    echo "************************************************************"
    read junk
    
    for i in `ls -1 $device?`; do
     echo "unmounting device '$i'"
     umount $i 2>/dev/null
    done
    
    execute "dd if=/dev/zero of=$device bs=1024 count=1024"
    
    # get the partition information.
    total_size=`fdisk -l $device | grep Disk | awk '{print $5}'`
    total_cyln=`echo $total_size/255/63/512 | bc`
    
    # start from cylinder 20, this should give enough space for flashing utility
    # to write u-boot binary.
    pc1_start=20
    pc1_end=10
    
    # start of rootfs partition
    pc2_start=$(($pc1_start + $pc1_end))
    
    # calculate number of cylinder for the second parition
    if [ "$copy" != "" ]; then
      pc2_end=$((($total_cyln - $pc1_end) / 2))
      pc3_start=$(($pc2_start + $pc2_end))
    fi
    
    {
    if [ "$copy" != "" ]; then
     echo $pc1_start,$pc1_end,0x0B,-
     echo $pc2_start,$pc2_end,,-
     echo $pc3_start,,-
    else
      echo $pc1_start,$pc1_end,0x0B,-
      echo $pc2_start,,-
    fi
    } | sfdisk -D -H 255 -S 63 -C $total_cyln $device
    
    if [ $? -ne 0 ]; then
        echo ERROR
        exit 1;
    fi
    
    echo "Formating ${device}p1 ..."
    execute "mkfs.vfat -F 32 -n "BOOT" ${device}p1"
    echo "Formating ${device}p2 ..."
    execute "mke2fs -j -L "ROOTFS" ${device}p2"
    if [ "$copy" != "" ]; then
      echo "Formating ${device}3 ..."
      execute "mke2fs -j -L "START_HERE" ${device}3"
    fi
    
    # creating boot.scr
    execute "mkdir -p /tmp/sdk"
    cat <<EOF >/tmp/sdk/boot.cmd
    mmc rescan 0
    setenv bootargs 'console=ttyS0,115200n8  root=/dev/mmcblk0p2 rw ip=off mem=60M video=davincifb:vid0=OFF:vid1=OFF:osd0=480x272x16,4050K dm365_imp.oper_mode=0 vpfe_capture.interface=1 davinci_enc_mngr.ch0_output=LCD davinci_enc_mngr.ch0_mode=480x272 rootwait'
    fatload mmc 0 80700000 uImage
    bootm 80700000
    EOF
    
    echo "Executing mkimage utilty to create a boot.scr file"
    mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n 'Execute uImage' -d /tmp/sdk/boot.cmd /tmp/sdk/boot.scr
    
    if [ $? -ne 0 ]; then
      echo "Failed to execute mkimage to create boot.scr"
      echo "Execute 'sudo apt-get install uboot-mkimage' to install the package"
      exit 1
    fi
    
    echo "Copying uImage/boot.scr on ${device}p1"
    execute "mkdir -p /tmp/sdk/$$"
    execute "mount ${device}p1 /tmp/sdk/$$"
    execute "cp /tmp/sdk/boot.scr /tmp/sdk/$$/"
    execute "cp /tmp/sdk/boot.cmd /tmp/sdk/$$/"
    execute "cp $sdkdir/psp/prebuilt-images/uImage*.bin /tmp/sdk/$$/uImage"
    #execute "cp $sdkdir/bin/top_evm368_evm.png /tmp/sdk/$$/"
    #execute "cp $sdkdir/bin/windows_users.htm /tmp/sdk/$$/"
    #execute "cp $sdkdir/bin/README.boot.scr /tmp/sdk/$$/"
    sync
    execute "umount /tmp/sdk/$$"
    
    FILE=$sdkdir/psp/u-boot-*/tools/uflash/uflash
    if [ -f $FILE ]; then
      echo "Executing uflash tool to write ubl and u-boot.bin"
      $sdkdir/psp/u-boot-*/tools/uflash/uflash -d ${device} -u ${sdkdir}/psp/board_utilities/serial_flash/dm365/UBL_DM36x_SDMMC_ARM432_DDR340_OSC24.bin -b ${sdkdir}/psp/prebuilt-images/u-boot-dm368-evm.bin -vv
    else 
      echo "uflash utility not found, u-boot must be built prior to running script"
      echo "From the $sdkdir directory run: make u-boot"
      exit 1
    fi
    
    if [ $? -ne 0 ]; then
      echo "Failed to execute uflash"
      exit 1
    fi
    
    echo "Extracting filesystem on ${device}p2 ..."
    execute "mkdir -p /tmp/sdk/$$"
    execute "mount ${device}p2 /tmp/sdk/$$"
    execute "tar zxf $rootfs -C /tmp/sdk/$$"
    
    # check if we need to create symbolic link for matrix 
    echo -n "Creating matrix-gui-e symbolic link..."
    if [ -f /tmp/sdk/$$/etc/init.d/matrix-gui-e ]; then
      if [ -h /tmp/sdk/$$/etc/rc3.d/*matrix* ]; then
        echo " (skipped) "
      else
        ln -s  ../init.d/matrix-gui-e /tmp/sdk/$$/etc/rc3.d/S99matrix-gui-e
        ln -s  ../init.d/matrix-gui-e /tmp/sdk/$$/etc/rc5.d/S99matrix-gui-e
        echo "done"
      fi
    fi
    
    sync
    echo "unmounting ${device}p2"
    execute "umount /tmp/sdk/$$"
    
    if [ "$copy" != "" ]; then
      echo "Copying $copy on ${device}3 ..."
      execute "mount ${device}3 /tmp/sdk/$$"
      execute "cp -ar $copy /tmp/sdk/$$"
      execute "cp $sdkdir/bin/setup.htm /tmp/sdk/$$"
      execute "cp $sdkdir/bin/top_dm368_evm.png /tmp/sdk/$$/"
      execute "cp $sdkdir/docs/TMS320DM368_EVM_Quick_Start_Guide.pdf /tmp/sdk/$$/quickstartguide.pdf"
      sync
      echo "unmounting ${device}3"
      execute "umount /tmp/sdk/$$"
    fi
    
    execute "rm -rf /tmp/sdk/$$"
    echo "completed!"
    

  • Thank you Prashanth. I was unable to get the mksdboot any other way.

    I have another issue regarding the NAND Flash bad block table.  Using nandwriter, I erase NAND before writing the new UBL and u-boot.  However, during writing I get a verify failure:

    Writing image data to Block 0xC, Page 0x0

    Writing image data to Block 0xC, Page 0x1

    Writing image data to Block 0xC, Page 0x2

    Writing image data to Block 0xC, Page 0x3

    Writing image data to Block 0xC, Page 0x4

    Writing image data to Block 0xC, Page 0x5

    Writing image data to Block 0xC, Page 0x6

    Writing image data to Block 0xC, Page 0x7

    Writing image data to Block 0xC, Page 0x8

    Writing image data to Block 0xC, Page 0x9

    Writing image data to Block 0xC, Page 0xA

    Writing image data to Block 0xC, Page 0xB

    Data verification failed! Block: 0xC page: 0xB. First Failing Byte: 0x700

    Verify failed. Attempting to clear page

    Erasing block 0xC through 0xD.

    ERROR: Write Failed


    Is there a way to recreate or update the bad block table?

    Thanks,

    John

     

     

    NAND flashing failed!

  • Hi John,

    Which is your Hardware? I had tried flashing through CCS for DM368 and it worked fine for me. Did you try flashing through CCS (steps are mentioned in UserGuide). 

  • Hi Prashanth,

    My hardware is the Appro DM368-based IPNC.  The output I showed was from CSS console during nandwriter operation, attempting to write UBL and u-boot into NAND flash of the IPNC over JTAG.

    Thanks,
    John

  • Hi John, 

    I donot have much information about NAND Flash bad blocks. Lets me share you the steps I tried(which worked fine at my side). I used pre-build binaries to NAND Flash. Which is your RDK version?

    To burn UBL and U-Boot for DM36x IPNC:

    1. Connect JTAG to you IPNC debug board.
    2. Open Setup Code Composer Studio version 3.3 with DM36x ARM9 configuration from CCS setup program.
    3. Load gel_ipnc_dm36x_xxx.gel. GEL file path is <IPNC_INSTALL_DIR>/Utils/gel_dm36x/ (From GEL menu run Gel->default->golden_pll_ddr_init_test_270arm_216ddr function)
    4. Connect Code Composer Studio to the target board. You can also press Alt+C. The message “The target is now connected” should appear.
    5. On the File menu, select Load Program. Load file <IPNC_INSTALL_DIR>/Binaries/dm36x/nandwriter_ipnc_dm36x.out.
    6. Type ‘y’ to erase the NAND contents in DM36x IPNC and Hit ENTER key.
    7. Enter the UBL file path(full path) for ubl_ipnc_dm36x.bin. Click OK. UBL binary is loaded to target board.
    8. Enter the U-Boot file path(full path) for u-boot-1.3.4-dm36x_ipnc.bin. Click OK. U-Boot binary is loaded to target board.
    9. Then set 0x81080000 for the Application Entry Point and set 0x81080000 for the Application Load Address.
    10.  Enter the Diagnostic file path(full path) for diagnostic_ipnc_dm36x.bin file. Click OK. Diagnostic binary is loaded to target board.
    11. Wait until Nand program completion message is displayed on Code Composer Studio message window.
    12. When UBL and U-Boot are effectively flashed on DM36x IPNC board, disconnect the Code Composer Studio from the target board.
    13. Power reset and you should see UBL and uboot messages in console(minicom).

    Pre-built ubl_ipnc_dm36x.bin, u-boot-1.3.4-dm36x_ipnc.bin and diagnostic_ipnc_dm36x.bin file is available in <IPNC_INSTALL_DIR>/Binaries/dm36x/ folder.

  • Hi Prashanth,

    Yes, I have performed this procedure many times over the years.  My issues is that, after entering the Application Entry Point and Application Load Address (Step 9 in your description), a write of UBL and u-boot is done before asking for the Diagnostic file path (Step 10).  The error I am seeing occurs after Step 9 but before Step 10.  NAND Flashing fails, and a reset does not show UBL or u-boot messages.  I never get a u-boot prompt that would allow a "nand scrub", which would rewrite the bad block table.

    I was hoping there was a NAND utility, much like nandwrite.out, that would initialize NAND Flash and write the bad block table prior to using nandwrite.out to load UBL and u-boot...  Any thoughts on this would be most appreciated...

    Thanks,
    John

  • Hi John,

    Sorry for delay. Yes, you are right. With NAND scrub it should re-write all the bad blocks. For that we at-least first stage boot loaders should be present in NAND. I am not very sure about NAND utility, can you please open a new thread on this in same forum, so that  experts can answer?

    Mean while you can try to transfer UBL & uboot to NAND through kermit protocol. Once this is successful you can do a nand scrub from uboot prompt.