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
On Monday, 27 April 2015 20:20:17 UTC+5:30, Ankur Tank wrote:
>
> 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/mmcblk0lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:00 mmcblk0boot0 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0boot0lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:00 mmcblk0boot1 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0boot1lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:12 mmcblk0p1 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p1lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:12 mmcblk0p2 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p2lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:12 mmcblk0p3 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p3lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:12 mmcblk0p4 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p4lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:12 mmcblk0p5 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p5lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:12 mmcblk0p6 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p6lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:12 mmcblk0p7 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p7lrwxrwxrwx
>
> 1 root root 0 Dec 31 19:12 mmcblk0p8 ->
> ../../devices/ocp.2/481d8000.mmc/mmc_host/mmc1/mmc1:0001/block/mmcblk0/mmcblk0p8lrwxrwxrwx
>
> 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
>
> On Friday, 24 April 2015 21:57:07 UTC+5:30, RobertCNelson wrote:
>>
>> On Fri, Apr 24, 2015 at 11:22 AM, Ankur Tank <[email protected]> wrote:
>> > 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__
>>
>> 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..)
>>
>> > ,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
>> >
>> >
>> >
>> > }
>> >
>>
>>
>> Regards,
>>
>> --
>> Robert Nelson
>> https://rcn-ee.com/
>>
>
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.