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/TMS320DM8148: sfdisk

Guru 20755 points
Part Number: TMS320DM8148

Tool/software: Linux

Hello,

I have a need to program mmc from target.

I first thought of using u-boot for that, but u-boot has no capability to create a partition table for sd/mmc.

So, trying to do it from linux target, I encountered another problem. 

I am trying to understand the requirements for a valid sd card.

Is it that I just need to different partitions or do they need to be in a specific offset ?

There is no sfdisk in filesystem, so is it possible to acheive it with fdisk ? What parameters should be gived to fdisk ?

I see the following commands in TI's sciprt for SD, but I am not sure how to achieve in target filesystem:

CYLINDERS=`echo $SIZE/255/63/512 | bc`

sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE << EOF
,9,0x0C,*
10,114,,,
EOF

mkfs.vfat -F 32 -n "boot" ${DRIVE}1
umount ${DRIVE}1
mkfs.ext3 -L "rootfs" ${DRIVE}2

Thank you,

Ran

  • Hi Ran Shalit,

    1. sfdisk is for script and not different from fdisk, it reads from a file. and not interactive. fdisk should suffice to do the partition
    2. The requirements w.r.t partitions are MBR, FAT32 partition( ~30 MB to 50 MB. Not strictly. It should be sufficient enough to hold two stage bootloaders and kernel image and if any boot scripts.) and then EXT4 partition(Remaining).

    3. usage example is below:

    #To clear MBR so that can create partition
    dd if=/dev/zero of=${DRIVE} bs=512 count=1 conv=fsync
    fdisk -u ${DRIVE} <<EOF
    n
    p
    1

    60000
    n
    p
    2


    w

    EOF
    mkfs.ext4 -t ext4 -L "rootfs" ${DRIVE}2
    mkfs.vfat -F 32 -n "boot" ${DRIVE}1

    n = > create partition
    p = > primary partition
    1 = > partition no. 1 (used for FAT)

    2 => partition no. 2 (used for EXT4)

    empty space => default size (For partition 1 start sector. For partition 2, both start and end are default for using the remaining size)

    60000 => no. of sectors roughly for 30MB with 512 as sector size (Can make this assumption for SDCard)

  • Dwarakesh R,

    Thanks a lot !