Hi All,
1. I've NOR which as 10 partitions.
2. I want to flash ext2 on /dev/mtdblock7 and create /startup on /dev/mtdblock8
3. I get this error,
mount: mounting /dev/mtdblock7 on tmp_rootfs failed: Invalid argument
4. Interesting point is on one board yesterday , I was able to flash mtdblock7 and mtdblock8 without any problem. No errors. But today on same board I'm able to flash only mtdblock8 and on other boards I'm not able to flash any of the partitions.
5. Below is the script I'm using and also the prints that I get when I run the script,
#!/bin/bash
#Flashing NOR:
mkdir tmp_rootfs
mount -t cifs -o user=Admin //192.168.0.221/images /mnt/smbshare/
update_nor_partition () {
## Kill any partition info that might be there
dd if=/dev/zero of=$DRIVE bs=4k count=1
sync
sync
sleep 2
echo "Partitioning NOR..."
sfdisk $DRIVE << EOF
;
EOF
sleep 2
mkfs.ext2 -L "rootfs" $DRIVE
sync
sync
sleep 2
## If 'dd'ing the rootfs, there is no need to mount it. Comment out the below.
mount -t ext2 ${DRIVE} tmp_rootfs
echo "untarring file system...."
time tar -xf /mnt/smbshare/${ROOTFS_PARTITION} -C tmp_rootfs
sync
sync
sleep 2
#cleanup
umount ${DRIVE}
}
ROOTFS_PARTITION="rootfs.tar.gz"
DRIVE="/dev/mtdblock7"
update_nor_partition
ROOTFS_PARTITION="startup.tar.gz"
DRIVE="/dev/mtdblock8"
update_nor_partition
rm -rf tmp_rootfs
umount /mnt/smbshare
Prints:
root@am335x-evm:~# ./flasher.sh
1+0 records in
1+0 records out
Partitioning NOR...
Checking that no-one is using this disk right now ...
BLKRRPART: Invalid argument
OK
Disk /dev/mtdblock7: 1 cylinders, 255 heads, 63 sectors/track
sfdisk: /dev/mtdblock7: unrecognized partition table type
Old situation:
sfdisk: No partitions found
New situation:
Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/mtdblock7p1 0+ 0 1- 8032 83 Linux
/dev/mtdblock7p2 0 - 0 0 0 Empty
/dev/mtdblock7p3 0 - 0 0 0 Empty
/dev/mtdblock7p4 0 - 0 0 0 Empty
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table
Re-reading the partition table ...
BLKRRPART: Invalid argument
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).)
mke2fs 1.42.7 (21-Jan-2013)
Filesystem label=rootfs
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
3712 inodes, 14848 blocks
742 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=15204352
2 block groups
8192 blocks per group, 8192 fragments per group
1856 inodes per group
Superblock backups stored on blocks:
8193
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
mount: mounting /dev/mtdblock7 on tmp_rootfs failed: Invalid argument
untarring file system....
real 0m 1.55s
user 0m 0.66s
sys 0m 0.38s
umount: can't umount /dev/mtdblock7: Invalid argument
1+0 records in
1+0 records out
Partitioning NOR...
Checking that no-one is using this disk right now ...
BLKRRPART: Invalid argument
OK
Disk /dev/mtdblock8: 0 cylinders, 255 heads, 63 sectors/track
sfdisk: /dev/mtdblock8: unrecognized partition table type
Old situation:
sfdisk: No partitions found
New situation:
Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/mtdblock8p1 0 - 0 0 0 Empty
/dev/mtdblock8p2 0 - 0 0 0 Empty
/dev/mtdblock8p3 0 - 0 0 0 Empty
/dev/mtdblock8p4 0 - 0 0 0 Empty
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table
Re-reading the partition table ...
BLKRRPART: Invalid argument
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).)
mke2fs 1.42.7 (21-Jan-2013)
Filesystem label=rootfs
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
256 inodes, 2048 blocks
102 blocks (4.98%) reserved for the super user
First data block=1
Maximum filesystem blocks=2097152
1 block group
8192 blocks per group, 8192 fragments per group
256 inodes per group
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
untarring file system....
real 0m 0.01s
user 0m 0.00s
sys 0m 0.00s
root@am335x-evm:~#
What is the solution?
Regards,
Gangadhar