Issues while eMMC partitioned using sfdisk

1,173 views
Skip to first unread message

Ankur Tank

unread,
Apr 22, 2015, 10:25:40 PM4/22/15
to beagl...@googlegroups.com, ankur...@lnttechservices.com
I am writing firmware(MLO,u-boot.img, uImage(ver 3.12), dtb, rootfs.tar.gz) programming script for
 am335x based custom board which is based on Beaglebone black.   
Rootfile system is to be put onto the eMMC. 
Firmware programming script runs as the one of the init script from 
the nfsroot folder when board boots for the first time at programming station.

Basically script   
1. Partitions the eMMC and   
2. writes MLO, u-boot.img, uImage, dtb in the raw area of the first partition and  
3. Then formats the other partitions as ext4 and  
4. mounts ext4 partitions and extacts the rootfs.tar.gz.

Now there are two issues with the script and one with backup kernel memory area.

Script issues

1. I am not able create more than 7 partition(including logical partitions)
   though sfdisk creates the partitions, device files related to partition is not available in /dev directory

Here is sfdisk command i used

    #Partition emmc 
    sfdisk -D -H 255 -S 63 -C 467 /dev/mmcblk0 -uM << EOF
    ,32,C,*
    ,200,L
    ,200,L
    ,,E
    ,100,L
    ,60,L
    ,200,L
    ;1269,L
    ;
    EOF

When i list the partitions fdisk/sfdisk reports 8 partitions but i don't see partition files related to 8th partition.

Here is fdisk output for the same,

    # fdisk -l /dev/mmcblk0
    
    Disk /dev/mmcblk0: 3841 MB, 3841982464 bytes
    255 heads, 63 sectors/track, 467 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    
            Device Boot      Start         End      Blocks  Id System
    /dev/mmcblk0p1   *           1           5       40131   c Win95 FAT32 (LBA)
    /dev/mmcblk0p2               6          31      208845  83 Linux
    /dev/mmcblk0p3              32          57      208845  83 Linux
    /dev/mmcblk0p4              58         467     3293325   5 Extended
    /dev/mmcblk0p5              58          70      104391  83 Linux
    /dev/mmcblk0p6              71          78       64228+ 83 Linux
    /dev/mmcblk0p7              79         104      208813+ 83 Linux
    /dev/mmcblk0p8             105         266     1301233+ 83 Linux
    /dev/mmcblk0p9             267         467     1614501  83 Linux

2. Some times after partitioning eMMC device files(/dev/mmcblk0p2, /dev/mmcblk0p3 etc) doesn't appear and mkfs utility fails to format the partition and firmware flashing fails.

I used partprobe after partitioning eMMC but with not help. :(

eMMC memory issue

First partition of the eMMC is of type "Win95 FAT32 (LBA)"
We are not formatting this partition and using it as raw.
There are 3 copies of MLO, 2 copies of u-boot.img, uImage and dtb in the that partition.

After trying multiple time flashing using dd, uImage first copy memory area is corrupted and board complains the image in that partition is corrupted.
Now if eMMC is having controller handling wear leveling and error correction mechanism then how memory area where kernel is stored is corrupted?

Any suggestions/ideas/pointers to any of the mentioned problem?

Robert Nelson

unread,
Apr 22, 2015, 10:46:33 PM4/22/15
to Beagle Board, ankur...@lnttechservices.com
You've run into:

CONFIG_MMC_BLOCK_MINORS=8

Regards,

--
Robert Nelson
https://rcn-ee.com/

Ankur Tank

unread,
Apr 23, 2015, 1:03:33 AM4/23/15
to beagl...@googlegroups.com, ankur...@lnttechservices.com
Oh that was the problem..I was referring JDEC spec and all :)

Thank you very much for reply Mr. Nelson,
7 Partition problem solved :)

Let me know if you have any suggestions for other problems.
One more questions,

# blkid
/dev/mmcblk0p2: LABEL="rootfs" UUID="3bb8e52f-1434-4e04-9d76-a50d75380c39" TYPE="ext4"
/dev/mmcblk0p5: LABEL="recovery_rootfs" UUID="5f8060da-b692-4278-9120-af0258579e12" TYPE="ext4"
/dev/mmcblk0p8: LABEL="logging" UUID="72064afc-e114-4339-89cd-76725fedbc86" TYPE="ext4"
/dev/mmcblk0p3: LABEL="rootfs2" UUID="0287571c-6965-4906-91d0-347ec26f7aea" TYPE="ext4"
/dev/mmcblk0p7: LABEL="firmware" UUID="b812c1a2-12dc-4543-b4f5-1bfc5f4c4e0a" TYPE="ext4"
/dev/mmcblk0boot0: LABEL="logging" UUID="72064afc-e114-4339-89cd-76725fedbc86" TYPE="ext4"
/dev/mmcblk0p6: LABEL="database" UUID="45b8786e-bcb2-457d-8796-e78f9188aa55" TYPE="ext4"

Why is /dev/mmcblk0boot0 appears here, it doesn't show up in fdisk -l output?
from where is this mysterious partition coming from?

Ankur Tank

unread,
Apr 24, 2015, 12:22:09 PM4/24/15
to beagl...@googlegroups.com, ankur...@lnttechservices.com
Problem in short:
eMMC partition's device files are not visible in /dev/ directory after partitiong using "sfdisk"
HI ,

I have put log of script here, any suggestions,

+ partition_emmc /dev/mmcblk0
+ DRIVE=/dev/mmcblk0
+ HEADS=255
+ SECTOR_SIZE=512
+ SECTORS_PER_TRACK=63
+ dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=108
108+0 records in
108+0 records out
+ sync
+ dd if=/dev/mmcblk0 of=/dev/null bs=1M count=108
108+0 records in

108+0 records out
+ sync
+ blockdev --flushbufs /dev/mmcblk0
+ + grepgrep+  bytes Disk

fdisk -l /dev/mmcblk0
+ awk {print $5}
+ SIZE=3841982464
+ echo DISK SIZE - 3841982464 bytes
DISK SIZE - 3841982464 bytes
+ echo 3841982464 255 / 63 / 512 / p
+ dc
+ CYLINDERS=467.094
+ echo CYLINDERS - 467.094
CYLINDERS - 467.094
+ sfdisk -R /dev/mmcblk0
BLKRRPART: Device or resource busy
sfdisk: This disk is currently in use.

+
+ [ 1 -ne 0 ]
+ + + grepawk /dev/mmcblk0 {print $3}

mount
+ mntpoint=/media/mmcblk0p8
/media/mmcblk0p6
/media/mmcblk0p7
/media/mmcblk0p5
+ echo unmounting /media/mmcblk0p8
unmounting /media/mmcblk0p8
+ umount /media/mmcblk0p8
+ echo unmounting /media/mmcblk0p6
unmounting /media/mmcblk0p6
+ umount /media/mmcblk0p6
+ echo unmounting /media/mmcblk0p7
unmounting /media/mmcblk0p7
+ umount /media/mmcblk0p7
+ echo unmounting /media/mmcblk0p5
unmounting /media/mmcblk0p5
+ umount /media/mmcblk0p5
+ sfdisk --force --in-order --Linux -H 255 -S 63 -C 467.094 /dev/mmcblk0 -uM
Checking that no-one is using this disk right now ...
OK

Disk /dev/mmcblk0: 467 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 184348 does not have an msdos signature
sfdisk:  /dev/mmcblk0: unrecognized partition table type

Old situation:
sfdisk: No partitions found

New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
/dev/mmcblk0p1   *     0+    31     32-     32767+   c  W95 FAT32 (LBA)
/dev/mmcblk0p2        32    231    200     204800   83  Linux
/dev/mmcblk0p3       232    431    200     204800   83  Linux
/dev/mmcblk0p4       432   3663   3232    3309568    5  Extended
/dev/mmcblk0p5       432+   531    100-    102399+  83  Linux
/dev/mmcblk0p6       532+   591     60-     61439+  83  Linux
/dev/mmcblk0p7       592+   791    200-    204799+  83  Linux
/dev/mmcblk0p8       792+  2060   1269-   1299455+  83  Linux
/dev/mmcblk0p9      2061+  3663   1603-   1641471+  83  Linux
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
+ sync
+ blockdev --flushbufs /dev/mmcblk0
+ partprobe
Auto-mount of [/media/mmcblk0p5] successful
Auto-mount of [/media/mmcblk0p6] successful
Auto-mount of [/media/mmcblk0p7] successful
Auto-mount of [/media/mmcblk0p8] successful
Error: Error informing the kernel about modifications to partition /dev/mmcblk0p5 -- Device or r.
Error: Failed to add partition 5 (Device or resource busy)

+ rm -rf /tmp/.a*
+ mdev -s
mount: mounting /dev/mmcblk0p1 on /media/mmcblk0p1 failed: Invalid argument
rm: can't remove '/tmp/.automount-mmcblk0p1': No such file or directory
mount: mounting /dev/mmcblk0p2 on /media/mmcblk0p2 failed: Invalid argument
rm: can't remove '/tmp/.automount-mmcblk0p2': No such file or directory
mount: mounting /dev/mmcblk0p3 on /media/mmcblk0p3 failed: Invalid argument
rm: can't remove '/tmp/.automount-mmcblk0p3': No such file or directory
mount: mounting /dev/mmcblk0p4 on /media/mmcblk0p4 failed: Invalid argument
rm: can't remove '/tmp/.automount-mmcblk0p4': No such file or directory
rm: can't remove '/tmp/.automount-mmcblk0p7': No such file or directory
rm: can't remove '/tmp/.automount-mmcblk0p8': No such file or directory
+ sync
+ blockdev --flushbufs /dev/mmcblk0
+ mount
rootfs on / type rootfs (rw)
192.168.1.3:/nfsboot on / type nfs (rw,relatime,vers=2,rsize=4096,wsize=4096,namlen=255,hard,nol)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
none on /dev/pts type devpts (rw,relatime,mode=600)
tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
tmpfs on /var/run type tmpfs (rw,relatime,mode=777)
tmpfs on /var/spool/cron type tmpfs (rw,relatime,mode=755)
tmpfs on /var/sftp type tmpfs (rw,relatime,mode=755)
+ sfdisk -R /dev/mmcblk0
+
+ [ 0 -ne 0 ]
+ echo Nothing is mounted on /dev/mmcblk0
Nothing is mounted on /dev/mmcblk0

+ RETRY=50
+ NO_OF_PARTITIONS=2
+ 2 != 10
./BAK_S99-flashfirmware: line 1: 2: not found
+ check_and_format_partition /dev/mmcblk0p2 rootfs
+ PARTITION=/dev/mmcblk0p2
+ LABEL=rootfs
+ MNTPNT=0
+ mount
+ grep /dev/mmcblk0p2
+ awk {print $3}
+ MNTPNT=
+ [ -n  ]
+ [ -b /dev/mmcblk0p2 ]
+ mkfs.ext4 -L rootfs /dev/mmcblk0p2
mke2fs 1.42.8 (20-Jun-2013)
Auto-mount of [/media/mmcblk0p5] successful
mkfs.ext4: No such file or directory while trying to determine hardware sector size
+ check_and_format_partition /dev/mmcblk0p3 rootfs2
+ PARTITION=/dev/mmcblk0p3
+ LABEL=rootfs2

+ MNTPNT=0
+ mount
+ grep+ awk /dev/mmcblk0p3
 {print $3}
Auto-mount of [/media/mmcblk0p8] successful
+ MNTPNT=
+ [ -n  ]
+ [ -b /dev/mmcblk0p3 ]
+ echo Cant find /dev/mmcblk0p3 partition
Cant find /dev/mmcblk0p3 partition
+ check_and_format_partition /dev/mmcblk0p5 recovery_rootfs
+ PARTITION=/dev/mmcblk0p5
+ LABEL=recovery_rootfs
+ MNTPNT=0
+ mount
+ grep /dev/mmcblk0p5+ awk {print $3}

+ MNTPNT=/media/mmcblk0p5
+ [ -n /media/mmcblk0p5 ]
+ echo /dev/mmcblk0p5 is mounted on /media/mmcblk0p5
/dev/mmcblk0p5 is mounted on /media/mmcblk0p5
+ [ -b /dev/mmcblk0p5 ]
+ echo Cant find /dev/mmcblk0p5 partition
Cant find /dev/mmcblk0p5 partition
+ check_and_format_partition /dev/mmcblk0p6 database
+ PARTITION=/dev/mmcblk0p6
+ LABEL=database
+ MNTPNT=0
+ mount
+ grep /dev/mmcblk0p6
+ awk {print $3}
Auto-mount of [/media/mmcblk0p7] successful
+ MNTPNT=
+ [ -n  ]
+ [ -b /dev/mmcblk0p6 ]
+ mkfs.ext4 -L database /dev/mmcblk0p6
Auto-mount of [/media/mmcblk0p6] successful
mke2fs 1.42.8 (20-Jun-2013)
/dev/mmcblk0p6 is mounted; will not make a filesystem here!
+ check_and_format_partition /dev/mmcblk0p7 firmware
+ PARTITION=/dev/mmcblk0p7
+ LABEL=firmware
+ MNTPNT=0
+ grep /dev/mmcblk0p7
+ mount
+ awk {print $3}
+ MNTPNT=/media/mmcblk0p7
+ [ -n /media/mmcblk0p7 ]
+ echo /dev/mmcblk0p7 is mounted on /media/mmcblk0p7
/dev/mmcblk0p7 is mounted on /media/mmcblk0p7
+ [ -b /dev/mmcblk0p7 ]
+ mkfs.ext4 -L firmware /dev/mmcblk0p7
mke2fs 1.42.8 (20-Jun-2013)
/dev/mmcblk0p7 is mounted; will not make a filesystem here!
+ check_and_format_partition /dev/mmcblk0p8 logging
+ PARTITION=/dev/mmcblk0p8
+ LABEL=logging
+ MNTPNT=0
+ grep /dev/mmcblk0p8
+ awk {print $3}
+ mount
+ MNTPNT=/media/mmcblk0p8
+ [ -n /media/mmcblk0p8 ]
+ echo /dev/mmcblk0p8 is mounted on /media/mmcblk0p8
/dev/mmcblk0p8 is mounted on /media/mmcblk0p8
+ [ -b /dev/mmcblk0p8 ]
+ echo Cant find /dev/mmcblk0p8 partition
Cant find /dev/mmcblk0p8 partition
+ sed -r s/://g
+ cat /sys/class/net/eth0/address
+ MACADDRESS=7c669d19cce2
+ BASE_MOUNT_POINT=/mnt/7c669d19cce2
+ ROOTFS_MOUNT=/mnt/7c669d19cce2/rootfs
+ ROOTFS2_MOUNT=/mnt/7c669d19cce2/rootfs2
+ ROOTFS_RECOVERY_MOUNT=/mnt/7c669d19cce2/recovery_rootfs
+ DB_MOUNT=/mnt/7c669d19cce2/database
+ FIRMWARE_MOUNT=/mnt/7c669d19cce2/firmware
+ LOGGING_MOUNT=/mnt/7c669d19cce2/logging
+ echoAndLog mount all the partitions
+ echo mount all the partitions
mount all the partitions
+ logger -p 5 -t ./BAK_S99-flashfirmware mount all the partitions
+ [ ! -d /mnt/7c669d19cce2/rootfs ]
+ [ ! -d /mnt/7c669d19cce2/rootfs2 ]
+ [ ! -d /mnt/7c669d19cce2/recovery_rootfs ]
+ [ ! -d /mnt/7c669d19cce2/database ]
+ RETRY=50
+ [ 50 -ne 0 ]
+ [ ! -b /dev/mmcblk0p2 ]
+ echo ....Waiting till /dev/mmcblk0p2 appears retry=50
....Waiting till /dev/mmcblk0p2 appears retry=50

Anything fishy ?? If same partitioning command i run from command prompt it works but not from script do you suggestion anything ?

Script looks as show below..

DRIVE="/dev/mmcblk0"
RFS1_PARTITION=${DRIVE}p2
RFS2_PARTITION=${DRIVE}p3
RECOVERYRFS_PARTITION=${DRIVE}p5
DATABASE_PARTITION=${DRIVE}p6
FIRMWARE_PARTITION=${DRIVE}p7
LOGGING_PARTITION=${DRIVE}p8

partition_emmc()                                                                         
{                                                                                        
        DRIVE=$1                                                                         
        HEADS=255                                                                        
        SECTOR_SIZE=512                                                                  
        SECTORS_PER_TRACK=63            
                           
        #Clear the first 512KB of the disk to clear MBR
        dd if=/dev/zero of=${DRIVE} bs=1M count=108   
        sync                                          
        dd if=${DRIVE} of=/dev/null bs=1M count=108   
        sync                                                                               
        blockdev --flushbufs ${DRIVE}                                               
                                                      
        #Get the size of the disk                     
        SIZE=$(fdisk -l $DRIVE | grep "Disk" | grep bytes | awk '{print $5}')            
        echo "DISK SIZE - $SIZE bytes"                                                   
                                                                                         
        #calculate the no of cylinders in the disk                                       
        CYLINDERS=$(echo "$SIZE $HEADS / $SECTORS_PER_TRACK / $SECTOR_SIZE / p" | dc )   
        echo "CYLINDERS - $CYLINDERS"                                                
                                                                                     
        #Check if any of the partition is mounted, umount it if mounted.             
        $(sfdisk -R ${DRIVE})                                                        
        if [ $? -ne 0 ];then                                                         
                mntpoint=$(mount | grep ${DRIVE} | awk '{print $3}')                 
                for i in $mntpoint ; do                                              
                        echo "unmounting $i"                                         
                        umount $i                                                    
                done                                                   
        else                                                           
                echo "Nothing is mounted on ${DRIVE}"                  
        fi                                                         
                                                                   
        #Partition drive                                           
#       sfdisk --force --in-order --Linux -H 255 -S 63 -C $CYLINDERS ${DRIVE} -uM <<-__EOF__
        sfdisk --force --in-order --Linux -H 255 -S 63 -C 467 ${DRIVE} -uM <<-__EOF__      
        ,32,C,*                                                                            
        ,200,L                                                                             
        ,200,L                                                                             
        ,,E                                                                                
        ,100,L                                                                             
        ,60,L                                                                              
        ,200,L                                                                             
        ,1269,L                                                                            
        ,,,-                                                                        
        __EOF__   

}

# arg1 = partition
# arg2 = label
check_and_format_partition()
{
    PARTITION=$1
    LABEL=$2
        MNTPNT=0
        MNTPNT=$(mount | grep $PARTITION | awk '{print $3}')
        if [ -n "$MNTPNT" ]; then
            echo "$PARTITION is mounted on $MNTPNT"
        fi
    if [ -b $PARTITION ]; then
        mkfs.ext4 -L $LABEL $PARTITION
        #TODO : Find correct tunning parameter and set it.
        #tune2fs
    else
        echo "Cant find $PARTITION partition"
    fi
}

#Partition the eMMC
    partition_emmc $DRIVE

    sync
    blockdev --flushbufs $DRIVE

    partprobe
    rm -rf /tmp/.a*

    #Trigger the creation of the device files
    mdev -s
    sync
    blockdev --flushbufs $DRIVE

    mount

    $(sfdisk -R ${DRIVE})
    if [ $? -ne 0 ]; then
       mntpoint=$(mount | grep ${DRIVE} | awk '{print $3}')
            for i in $mntpoint ; do
                  echo "unmounting $i"
                umount $i
            done
    else
        echo "Nothing is mounted on ${DRIVE}"
    fi

    #Wait till mmcblk0pX partitions are available.
    RETRY=50
    NO_OF_PARTITIONS=2
    while (( $NO_OF_PARTITIONS != 10 )); do

        while (( [ $RETRY -ne 0 ] &&  [ ! -b "${DRIVE}p$i" ] )); do
           echo "....Waiting till $RFS1_PARTITION appears"
           RETRY=`expr $RETRY - 1`
           sleep 1
        done

    if [ $RETRY -eq 0 ];then
        echo "Error..Device files are not present"
        exit 1;
    fi
        NO_OF_PARTITIONS=`expr NO_OF_PARTITIONS + 1`
    done

    #Format the partitions
    check_and_format_partition $RFS1_PARTITION $RFS_STRING
    check_and_format_partition $RFS2_PARTITION $RFS2_STRING
    check_and_format_partition $RECOVERYRFS_PARTITION $RFS_RECOVERY_STRING
    check_and_format_partition $DATABASE_PARTITION $DATABASE_STRING
    check_and_format_partition $FIRMWARE_PARTITION $FIRMWARE_STRING
    check_and_format_partition $LOGGING_PARTITION $LOGGING_STRING

      MACADDRESS=`cat /sys/class/net/eth0/address | sed -r 's/://g'`
      BASE_MOUNT_POINT=/mnt/$MACADDRESS
      ROOTFS_MOUNT=$BASE_MOUNT_POINT/rootfs
      ROOTFS2_MOUNT=$BASE_MOUNT_POINT/rootfs2
      ROOTFS_RECOVERY_MOUNT=$BASE_MOUNT_POINT/recovery_rootfs
      DB_MOUNT=$BASE_MOUNT_POINT/database
      FIRMWARE_MOUNT=$BASE_MOUNT_POINT/firmware
      LOGGING_MOUNT=$BASE_MOUNT_POINT/logging

      echoAndLog "mount all the partitions"
      #Create mount point if it doesn't exist.
      if [ ! -d "$ROOTFS_MOUNT" ]; then
         mkdir -p $ROOTFS_MOUNT
      fi
      if [ ! -d "$ROOTFS2_MOUNT" ]; then
         mkdir -p $ROOTFS2_MOUNT
      fi
      if [ ! -d "$ROOTFS_RECOVERY_MOUNT" ]; then
         mkdir -p $ROOTFS_RECOVERY_MOUNT
      fi
      if [ ! -d "$DB_MOUNT" ]; then
         mkdir -p $DB_MOUNT
      fi

Robert Nelson

unread,
Apr 24, 2015, 12:27:07 PM4/24/15
to Beagle Board, ankur...@lnttechservices.com
Stop with all the cylinders crap, it's not 2009 anymore and we "fixed"
x-loader/u-boot spl, with the boot from "63" location "years" ago...

> ,32,C,*
1,32,C,* (now you have a 1Mb hole, which will work with
the bootloader..)

Ankur Tank

unread,
Apr 27, 2015, 10:50:17 AM4/27/15
to beagl...@googlegroups.com, ankur...@lnttechservices.com
Hi Mr. Nelson,

Problem in short
I changed partitioning command but with help,
Here is my sfdisk commad,


        #Partition drive                                                       
        sfdisk --force --in-order --Linux ${DRIVE} -uM <<-__EOF__              
        1,32,C,*                                                               
        ,200,L                                                                 
        ,200,L                                                                 
        ,,E                                                                    
        ,100,L                                                                 
        ,60,L                                                                  
        ,200,L                                                                 
        ,1269,L                                                                
        ,,,-                                                                   
        __EOF__

After above command i sync and flush buffers using blockdev command.
and then run "mdev -s" but

I get following output,


sfdisk: ERROR: sector 184348 does not have an msdos signature

sfdisk:  /dev/mmcblk0: unrecognized partition table type

Old situation:
sfdisk: No partitions found

New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
/dev/mmcblk0p1   *     1     32     32      32768    c  W95 FAT32 (LBA)
/dev/mmcblk0p2        33    232    200     204800   83  Linux
/dev/mmcblk0p3       233    432    200     204800   83  Linux
/dev/mmcblk0p4       433   3663   3231    3308544    5  Extended
/dev/mmcblk0p5       433+   532    100-    102399+  83  Linux
/dev/mmcblk0p6       533+   592     60-     61439+  83  Linux
/dev/mmcblk0p7       593+   792    200-    204799+  83  Linux
/dev/mmcblk0p8       793+  2061   1269-   1299455+  83  Linux
/dev/mmcblk0p9      2062+  3663   1602-   1640447+  83  Linux

Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
Auto-mount of [/media/mmcblk0p5] successful
Auto-mount of [/media/mmcblk0p6] successful
Auto-mount of [/media/mmcblk0p7] successful
Auto-mount of [/media/mmcblk0p8] successful
Error: Error informing the kernel about modifications to partition /dev/mmcblk0p5 -- Device or resource busy.  This means Linux won't know about any changes you made to /dev/mmcblk0p5 until you reboot -- .

Error: Failed to add partition 5 (Device or resource busy)
mount: mounting /dev/mmcblk0p1 on /media/mmcblk0p1 failed: Invalid argument
rm: can't remove '/tmp/.automount-mmcblk0p1': No such file or directory
mount: mounting /dev/mmcblk0p2 on /media/mmcblk0p2 failed: Invalid argument
rm: can't remove '/tmp/.automount-mmcblk0p2': No such file or directory
mount: mounting /dev/mmcblk0p3 on /media/mmcblk0p3 failed: Invalid argument
rm: can't remove '/tmp/.automount-mmcblk0p3': No such file or directory
mount: mounting /dev/mmcblk0p4 on /media/mmcblk0p4 failed: Invalid argument
rm: can't remove '/tmp/.automount-mmcblk0p4': No such file or directory
rm: can't remove '/tmp/.automount-mmcblk0p6': No such file or directory

rm: can't remove '/tmp/.automount-mmcblk0p7': No such file or directory
rm: can't remove '/tmp/.automount-mmcblk0p8': No such file or directory
rootfs on / type rootfs (rw)
192.168.1.3:/nfsboot on / type nfs (rw,relatime,vers=2,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=udp,timeo=11,retrans=3,sec=sys,mountaddr=192.168.1.3,mountvers=1,mountproto=udp,local_lock=all,add)

proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
none on /dev/pts type devpts (rw,relatime,mode=600)
tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777)
tmpfs on /var/run type tmpfs (rw,relatime,mode=777)
tmpfs on /var/spool/cron type tmpfs (rw,relatime,mode=755)
tmpfs on /var/sftp type tmpfs (rw,relatime,mode=755)
+ sfdisk -R /dev/mmcblk0
+
+ [ 0 -ne 0 ]
+ echo Nothing is mounted on /dev/mmcblk0
Nothing is mounted on /dev/mmcblk0
+ RETRY=50
+ NO_OF_PARTITIONS=2
+ 2 -ne 10

./BAK_S99-flashfirmware: line 1: 2: not found
+ set +x
mke2fs 1.42.8 (20-Jun-2013)
Discarding device blocks: done                           
Auto-mount of [/media/mmcblk0p6] successful
Auto-mount of [/media/mmcblk0p7] successful
Auto-mount of [/media/mmcblk0p5] successful
Filesystem label=rootfs

I checked /sys/class/block directory and i see following,
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 loop0 -> ../../devices/virtual/block/loop0
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 loop1 -> ../../devices/virtual/block/loop1
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 loop2 -> ../../devices/virtual/block/loop2
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 loop3 -> ../../devices/virtual/block/loop3
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 loop4 -> ../../devices/virtual/block/loop4
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 loop5 -> ../../devices/virtual/block/loop5
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 loop6 -> ../../devices/virtual/block/loop6
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 loop7 -> ../../devices/virtual/block/loop7
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 mmcblk0 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 mmcblk0boot0 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0boot0
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 mmcblk0boot1 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0boot1
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p1 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p1
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p2 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p2
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p3 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p3
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p4 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p4
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p5 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p5
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p6 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p6
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p7 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p7
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p8 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p8
lrwxrwxrwx    1 root     root             0 Dec 31 19:12 mmcblk0p9 -> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p9

lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram0 -> ../../devices/virtual/block/ram0
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram1 -> ../../devices/virtual/block/ram1
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram10 -> ../../devices/virtual/block/ram10
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram11 -> ../../devices/virtual/block/ram11
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram12 -> ../../devices/virtual/block/ram12
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram13 -> ../../devices/virtual/block/ram13
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram14 -> ../../devices/virtual/block/ram14
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram15 -> ../../devices/virtual/block/ram15
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram2 -> ../../devices/virtual/block/ram2
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram3 -> ../../devices/virtual/block/ram3
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram4 -> ../../devices/virtual/block/ram4
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram5 -> ../../devices/virtual/block/ram5
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram6 -> ../../devices/virtual/block/ram6
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram7 -> ../../devices/virtual/block/ram7
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram8 -> ../../devices/virtual/block/ram8
lrwxrwxrwx    1 root     root             0 Dec 31 19:00 ram9 -> ../../devices/virtual/block/ram9

Can we conclude that from mmc driverside there is problem.
Do you doubt mdev ??
Can network boot affect ? I am booting from network to update eMMC.

Thank you,

Regards,
Ankur

Ankur Tank

unread,
Apr 29, 2015, 8:00:39 AM4/29/15
to beagl...@googlegroups.com, ankur...@lnttechservices.com
Hi Mr. Nelson,

I made some progress,

mdev was auto-mounting /dev/mmcblk0* partitions, i changed following line in the mdev.conf file.

#mmcblk[0-9]p+[0-9]* root:root 660 */etc/mdev/mount.sh $MDEV
mmcblk[0-9]p+[0-9]* root:root 660

But i don't understand why auto-mounting was creating problem,
Because before erasing the partition, I was checking if partition is mounted or not and if mounted i was umounting it.

Is it right change ?

Thank you
Reply all
Reply to author
Forward
Message has been deleted
0 new messages