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.

Linux/TMDSCSK388: Problems with creating SD card for DM388 camera kit

Part Number: TMDSCSK388
Other Parts Discussed in Thread: DM388

Tool/software: Linux

Hello,

I have modified some configuration options and have compiled using 'make syscal all'. I am trying to write to the SD card as per the steps explained in http://processors.wiki.ti.com/index.php/IPNC_RDK_DM38x_,_DM8127#Boot_setup_for_custom_build.

root@ubuntu:~/ti/ipnc_rdk-3.9.1/Utils/sd-script# ./mksd-ti81xx.sh /dev/sdb  ../../Source/ipnc_rdk/tftp/DM388/sd/MLO  ../../Source/ipnc_rdk/tftp/DM388/sd/u-boot.img ../../Source/ipnc_rdk/tftp/DM388/sd/dm38x-csk.dtb ../../Source/ipnc_rdk/tftp/DM388/sd/uImage ../../Source/ipnc_rdk/target/filesys.tar.gz 
All data on /dev/sdb now will be destroyed! Continue? [y/n]
y
[Partitioning /dev/sdb...]
unmounting device '/dev/sdb'
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.896747 s, 1.2 MB/s
DISK SIZE - 15987638272 bytes
CYLINDERS - 1943
sfdisk: invalid option -- 'D'
Try 'sfdisk --help' for more information.
[Making filesystems...]
[Copying files...]
mount: /mnt: special device /dev/sdb1 does not exist.
umount: /dev/sdb1: no mount point specified.
mount: /mnt: special device /dev/sdb2 does not exist.
umount: /dev/sdb2: no mount point specified.
[Done]

Here is the script file as provided in the IPNC rdk software. ( I have not modified this script)

#!/bin/bash

if [[ -z $1 || -z $2 || -z $3 || -z $4 || -z $5 || -z $6 ]]
then
        echo "mksd-ti81xx Usage:"
        echo "  mksd-ti81xx <device> <MLO> <u-boot.img> <dtb> <uImage> <rootfs tar.gz>"
        echo "  Example: mksd-ti81xx /dev/sdc MLO u-boot.img dm38x-csk.dtb uImage nfs.tar.gz"
        exit
fi

if ! [[ -e $2 ]]
then
        echo "Incorrect MLO location!"
        exit
fi

if ! [[ -e $3 ]]
then
        echo "Incorrect u-boot.img location!"
        exit
fi

if ! [[ -e $4 ]]
then
        echo "Incorrect dtb location!"
        exit
fi

if ! [[ -e $5 ]]
then
        echo "Incorrect uImage location!"
        exit
fi

if ! [[ -e $6 ]]
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

for i in `ls -1 $DRIVE?`; do
 echo "unmounting device '$i'"
 umount $i 2>/dev/null
done

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.img
cp $4 /mnt/
cp $5 /mnt/uImage
umount "$1"1

mount "$1"2 /mnt
tar zxvf $6 -C /mnt &> /dev/null
chmod 755 /mnt
umount "$1"2

echo "[Done]"
                     

In the script in Line 9:

for i in `ls -1 $DRIVE?`; do

 Is the  '?' required. I tried removing the '?' and I still have the same issue.

For some reason sdb1 and sdb2 are not created. However 'lsblk' shows '/dev/sdb'

Does anyone have a hand on this issue?

  • May I know which Ubuntu Version You are using to run the script ?

  • I am using Ubuntu 18.04 LTS with kernel (4.15.0-20-generic). I am running Ubuntu on VMWare.
  • Just try to run the sfdisk command present in the script ( 26 line ) then you will come to why that script is not working
  • Thanks, Mr. Bonthu. A little reading into this and I see that since version 2.26 for sfdisk, the DOS(-D) and HEADS (-H) options are not supported.
    But how do I solve this? Is using an older version of Ubuntu the only solution?
  • There are two solutions for that
    1.do sd-card partition manually and copy boot Image and root file system manually from the path they provided in the guide
    2.Downgrade the sfdisk version, it is under util-linux package and run the script with arguments
  • Super!! I will try this.

    Are you also working on DM388 applications. I have just begun working on this platform and would like to discuss and learn different solutions that can be implemented on this platform. Is there any other way of contacting you via email or blog?
  • Instead of sfdisk we can add the following 4 instructions in your script and run it

    parted -s $DRIVE mklabel msdos
    parted -s $DRIVE unit cyl mkpart primary fat32 -- 0 9
    parted -s $DRIVE set 1 boot on
    parted -s $DRIVE unit cyl mkpart primary ext2 -- 9 -2
  • which part of the script should be replaced for this? should I remove sfdisk and replace it with these 4 lines?

    echo CYLINDERS - $CYLINDERS
    {
    echo ,9,0x0C,*
    echo 10,,,-
    } | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
    

  • Don't remove Just comment it and add those 4 instructions instead of that
  • WIth the changes, I am able to create the SD card. However, when running the demo application,I am unable to see any video streaming using the web browser provided by TI. The same is the case using VLC media player. The application is highly unreliable and inconsistent . For the same configuration and setting, it works at times and it does not most of the times.

    Coming back to debugging the issue, after using your suggestions to create the SD card, I see the following  error messages:

    [   31.802341] autorun-usecase.sh[113]: umount: can't unmount /mnt/mmc: Invalid argument
    [   32.282362] autorun-usecase.sh[113]: mount: /dev/mmcblk0 is already mounted or /mnt/mmc busy
    [   32.367414] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
    [   32.826313] autorun-usecase.sh[113]: killall: dhcpcd: no process killed
    [   47.596835] autorun-usecase.sh[113]: TimeOut occure in boot_proc.
    [   47.600534] autorun-usecase.sh[113]: Program exit.
    [   51.705604] autorun-usecase.sh[113]: TimeOut occure in boot_proc.
    [   51.706623] autorun-usecase.sh[113]: Program exit.

    As suggested by some of the threads in the forum to resolve the 'time out in boot proc' error, i have done the following, though it did not help:

    1. delete sysenv file from '/mnt/nand/'

    2. Enable full feature option:  IPNC_CONFIG := FULL_FEATURE

    3.  Modified the option : DM388_MCTNF_ON := NO

    However, with all these changes as well, the application does not run consistently. 

    Do you have any ideas on this? 

    I hope TI takes notice of this and replies with a solution.

  • Hello,

    I tried doing this again for some changes I did in the ipnc application. However this time I face another issue :

    All data on /dev/sdb now will be destroyed! Continue? [y/n]
    y
    [Partitioning /dev/sdb...]
    unmounting device '/dev/sdb'
    dd: failed to open '/dev/sdb': No medium found
    fdisk: cannot open /dev/sdb: No medium found
    DISK SIZE - bytes
    (standard_in) 1: syntax error
    Error: Error opening /dev/sdb: No medium found
    Error: Error opening /dev/sdb: No medium found
    Error: Error opening /dev/sdb: No medium found
    Error: Error opening /dev/sdb: No medium found
    [Making filesystems...]
    [Copying files...]
    mount: /mnt: special device /dev/sdb1 does not exist.
    umount: /dev/sdb1: no mount point specified.
    mount: /mnt: special device /dev/sdb2 does not exist.
    umount: /dev/sdb2: no mount point specified.
    [Done]
    

    whenever, I plug the SD card I can see '/dev/sdb' and after removing it there is no such entry as  'sdb'.

    In such a case what can be the issue here?